What is the best way to power the separate sides of an optically isolated relay circuit?

I am working on a Raspberry Pi based thermostat for my air conditioner and have come across a variety of pre-made relay boards that would allow me to interface with the 24v AC control circuits. Most of the boards I have found have optoisolators that separate the input side of the board from the relay side of the board. I assume this is to prevent damage to the GPIO pins in the event of a mechanical failure of one of the relays.

These boards also have separate power inputs for the respective sides. I intend to use a bridge rectifier and voltage regulator so that I can power both the Raspberry Pi and relay board directly from the 24v AC line on the wall. My questions specifically is how I should isolate the power for both sides of the board. Do I need to have two separate bridge rectifiers and voltage regulators to essentially create two power buses or is there another acceptable way to protect the Raspberry Pi in the situation? Also, is the isolation even necessary in this situation?

The circuit diagram for the relay board can be found at http://imgur.com/UiXmfKC.

Thanks in advance for your advice.

sort by: active | newest | oldest
Nighter3D2 years ago

The reason there is a Opto-isolator is purely cause of the difference power-sources. a Relay needs more power then most logic supplies can give so for safety they make sure they are isolated as much as possible in which case the isolator is ideal.

This doesn't mean you can't use the same Supply though. So long as the supply is protected you can safely regulate power from the line for the Raspberry and Relay. these "voltage rails" are quite common.

Ideally tough you would just get your raspberry a reliable source from elsewhere.

Remember that if you want to protect your project from a possibly surge there are few things that can beat the simple old-fashioned fast-acting Fuse. I would suggest to look up a "Crowbar" circuit which would create a artificial short-circuit to purposefully blow a fuse if the voltage suddenly goes up.

iceng2 years ago

If you have a long distance over 50 feet wire run from one source to a target device.

A local lightning strike as close as a mile can induce enough voltage in the wire to blow a piece of plastic right off a Raspberry Pi IC.

Best way to run signals outside of conduit is an opto transistor driving a twisted pair to an led opto receiver.

If you want to use a single supply just use two separation diodes and place a capacitor at the use end making sure a twisted pair of suitable gauge.

LIGHTNING isolation.bmp

Even a screen in the cable can help.

iceng iceng2 years ago

BTW I used this circuit in a 7 BINGO display system back east when lightning struck the power pole which took out the VCR, the phone system, the entire kitchen and the PS in the nearest Bingo display board.

My system with 6 displays was used continuously for several days until I arrived and replaced the Power Supply in the 7th display next to the power pole outside.


No, a separate recifier/reg does NOT count as "isolating" ! Only two separate transformers are isolating enough.

Even the isolation in the circuit you have is only good enough, if the board is laid out correctly - at high voltages "flashover" can occur, and leap across the board to the "isolated" section.

Each side should use a separate power source. The PI side should be running off the PI's power source and the side that's controlling the Thermostat needs to be running off that power source. The whole idea behind using an isolated board like that is to isolate one side from the other so you don't have power surges and your not trying to deal with higher voltages than the PI can handle.

matthewsheffield (author)  mpilchfamily2 years ago

Thanks for the reply. I definitely want to protect my Raspberry Pi from getting fried but I was trying to avoid having to run another wire in the wall to provide power to it separately. Would a separate bridge rectifier and voltage regulator count as a separate power source? Is there some other way to electrically isolate them with some type of fuse? I'd like the finished product to be a drop in replacement for the existing thermostat.

Sure you can rectify the 24VAC and run it to the PI. But if they are going to share the power source like that there is no need to optically isolate the circuit. You can use a basic relay board for that.