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.
Any help appreciated.
12V AC? Not DC?
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:
Great, thanks Bryce.
I did see that one but I was unsure I could use it with an AC load.
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.
AC is less of a problem than DC.
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.
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.
Thanking in Advance.
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.
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.
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.
- 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.
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.
in hindsight maybe 10k is better than 1k - currents will be pretty high and things will get hot with 1k
bob’s optoisolator idea is great! this could also be a preconditioning circuit to drive such an optoisolator
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.
Thanks Michael and Robert.
So based on your comments the circuit diagram would now look like this?
The capacitor in series instead of parallel.
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
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
Thanks for taking the time Bob.
Is there a specific type of Diode I need to rectify 12v ac to dc? or just a general purpose diode that can handle 12V?
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.