Chattering relay on microcontroller power supply
The most common cause of relay chatter is the supply to the relay coil falling below coil hold on point... 

this relaxes the load on the supply....

The supply then rises again above the coil pull-in point... 

The supply sags again and the cycle repeats.

The solution in most cases is a higher current supply.

EDIT......
Sometimes it is not the supply current that is the problem but a high resistance between the coil and the supply. This could be because the driving transistor or FET not being driven hard enough or a bad connection. 

Examples are dry solder joints or loose screw terminals

EDIT 2...

Also this rapid switching can introduce noise in to the supply that can affect sensor circuits. The supply rail going up and down will affect circuits that assume a stable supply rail. This could cause the wrong action to be taken by the micro (corrupt inputs) and in bad cases the micro to reset depending on the circuit.

The contacts opening and closed rapidly increases the production of EMI as well,  each arc of the contacts sending pulses in to the environment and the rest of the circuit  ...