Electronic – Measuring 230V from Raspberry Pi

inputraspberry pi

I have a problem: We use some Raspberry Pi to manage some contactor with a simple relay. This relay can manage one or more three-phase switches, so basically it is linked at least to three contactors. The relay sends an impulse both to put up or down the contactors.

The problem is that our software needs an input to understand if the contactors are up or down because we cannot demand everything to the software. There can always happen something that will cause the system to go out of sync.

How can I read the status of the contactors? My knowledge tells me that I should put a transformer 230 > 5 under the contactors, then a resistance to bring the 5 V to 3.3 V which is the maximum voltage bearable for a Raspberry Pi's GPIO, but I don't know if this solution is enough, also because the contactors have different negatives… Is there another possible solution, even electronically, to read this information?

Best Answer

The industry-standard way of doing this is to use an optically-isolated coupler. The proper industrial method is to use a modular system where you can select a module for mains power input and logic-level output. For example this AC input, 5V logic output module from Opto22:

Opto22 AC input, 5V logic output isolation module

If you were designing your own circuit, you could do an equivalent with an opto-coupler component such as a TIL111 or one of the MOC series. An example circuit:

Example AC mains input opto-coupler circuit