Hi, my front gate is controlled by a button inside the house that switches a 12V AC circuit that opens a door strike on the gate when pressed. I want to use my Pi 5B to open the gate. Which relay would be suitable for this purpose? I was looking at 1 Channel Solid State Relay Module (DC Control, AC Load) SKU: CE05352.
That SSR should do the trick for an AC load, although to keep it simple Iâd probably just go with a mechanical relay that can switch both AC and DC loads, fairly independently of the frequency, voltage, RMS voltage, etc. Something like this ought to do the trick depending on how much current you need to draw across it:
I donât see why not, it is a mechanical relay, essentially it is the equivalent of closing a switch in a circuit, the contacts are rated for up to 250VAC, arcing shouldnât be an issue, and any magnetic flux caused by the AC load should be negligible with a 12VAC supply at under 120W which is one of the main problems with using AC and a mechanical relay.
Re relay ratings. The switching capability is normally higher for AC loads than DC. For instance a relay rated for 240VAC @ 10A might only be rated to 30VDC @ 10A (only an example) for X number of operations.
It is to do with arcing at the contacts and metal migration at the opening and closing time.
Cheers Bob
PS. Look at what is printed on the relay in your own relay modules.
Just realised I also need to alert the PI (inside the house) when someone presses the doorbell. The doorbell button connects a circuit that gives 12AC to a buzzer inside the house. It would be handy to use this circuit to alert the PI on the GPIO pins. Would this be through another relay? or transistor? the Control would now be 12AC.
Hi Ed
What sort of 12VAC is this? Sine wave, square wave, modified sine wave or other. Is it true AC? That is does it go both positive and negative or is pulsing DC. How is it generated and presented to the buzzer? Transformer or other method. Donât forger there are DC buzzers so are you sure of the AC.
I ask these questions as from this end this â12VACâ is completely unknown and it is a bit hairy attempting to drive a RPi GPIO pin with such a system. The most obvious way would be to opto isolate this completely from the RPi which will require some additional electronics. What are your building skills like? there will probably be some soldering required unless there is a ready made device available. All depends on how you answer the above questions.
Cheers Bob
Hi Robert,
When I measure using my multimeter I get 12V when using the AC setting and the meter just jumps around if I use the DC setting. Up in the roof there is a power supply (pics attached).
Im happy to get my hands dirty soldering boards and parts etc. This is a learning experience as well as a bit of fun. My electonics experience is relatively low but I have the programming side covered.
Thanks, Ed.
Hi Ed - to achieve that end I have an idea. No guarantee itâs the best way to do this, but itâs the first idea that came to mind.
You could
rectify the 12AC to DC
reduce the voltage to an acceptable level for the pico
inject that DC logic level signal to a digital input in the pico.
below is a schematic that might work. In blue is what I expect the button-buzzer circuit looks like with a 12V AC source.
In red is the circuit that uses a diode to half-wave rectify 12VAC into DC
a 1k resistor with a 3v3 Zener diode creates a shunt voltage regulator with an output of 3.3V for the pico. It is a choppy DC though after being rectified
the 1uF capacitor smooths the output voltage
the 100k resistor drains the capacitor when there is no input voltage.
Could you do this with fewer components? Probably. But this is made up of common components and I think each step in the process is reasonably simple to understand.
What do you think? I pulled the resistor values out of thin air, Iâm sure they could be better considered to eg. reduce current or discharge the capacitor faster⊠whatever Iâm sure itâll work.
Hi Ed
The AC readings on a DMM are only valid for a sine wave. The device is described as a Power supply and âelectronicâ transformer so a bit hard to guess what the waveform actually is. The fact that it is quoted as 12VAC and you measured 12VAC indicates that is pretty close to sine wave .
Michaelâs circuit is probably pretty close to the mark and his solution is about as simple as you could get. One thing though the capacitor should be moved to the junction of the diode and 1k resistor. That is on the other side of the resistor. Even though the load will be light I think I would use a bit more than 1”F as it is only a half wave rectifier. I would go for 10”F or even 100”F. The resistor (1k) should be sized to suit the Zener. Calculate for enough current to keep the Zener working properly. Donât forget the DC voltage across the capacitor will be (12 * â2)-0.7 (one diode voltage drop) which will be a little above 16V.
I think you should measure the volts across the buzzer to verify Michaelâs guess.
There are more elaborate ways to do this but this little circuit should get you to have something to work with. You may wish later to have some isolation between the door buzzer and RPi but go with simple to start with.
Cheers Bob
The RPi load plus the 100k will be negligible but you will need enough current for the zener to operate correctly. As a general benchmark I usually go for about 25% of zener rated power so for a 1W zener I would look at about 250mW or maybe a bit less to fit in with preferred values.
Cheers Bob
Hi Ed
NO Cap negative to Neg volts or Gnd. Leave the diode cathode connected to 10k and connect the cap positive to the junction of diode cathode and 10k. Note 10k may not be the optimum for this resistor. depends on the ratings of the zener. The 10k will be dropping about 13V so that is only 1.3mA through the zener. Might be enough if you use s very small wattage zener.
Move the 100k resistor so it is across the capacitor.
although that is not critical. The difference between 100k and 110k is nothing. That will become a pull down resistor for the RPi so donât use or enable any pull ups to 3.3V
Cheers Bob
yeah i like that! instant charge for the cap should make it more responsive
my original idea relied on the RC period for the cap being quite small. this is more robust
Hi Ed
any of the 1N400X series would do, say 1N4001 (100V) or 1N4004 (400V) will do. Both good for 1A but you wonât use anything near that. Readily obtainable.
Cheers Bob