Here is my problem

I've built my own home automation by using some relays, driven by 12V AC (read Alternating Current) to switch them.

Now i want to use my raspberry's GPIO pins to switch these relays.

-The GPIO pins deliver 3.3V DC

-My relays need 12V AC to switch

As far as i know i can't use a transistor because it only works for DC?

Is there any solution to this? And i prefer not using any other power source but my raspberry and the 12VAC i already have.

1 Answer 1


As far as i know i can't use a transistor because it only works for DC?

You are correct on not directly using single transistor to drive an AC relay.

You will likely need to use a TRIAC, or additional smaller relay to drive your 12 VAC relays. You can find lots of help over in "Electrical Stack Exchange" regarding smaller relays and triacs, such as this Triac Driver Circuit

The linked page describes using 120 VAC, however, if you follow the comments and answers the circuit will work for your 12 VAC. enter image description here

  • I've done some research about TRIACS and what do you think about this? TRIAC i found: I max = 0.8A (this should be enaugh for switching a relay) IGT (Q1) 3 to 25 mA GPIO delivers 3.3V and the TRIAC gate wants between 3 and 25mA (if i am correct?) So the resistor for the gate: 3.3/0.025=132ohm So i will user a resistor of 220ohm maybe?
    – PiBuster
    Jun 14, 2014 at 15:16
  • Use 3.3 volts for calculating resistor R1 (assume 12mA for LED). 3.3v-1.2v/.012 = 175 ohms. For other side of the optocoupler, use 12 VAC for all calculations.
    – Marla
    Jun 14, 2014 at 16:38
  • Why the 3.3v-1.2v?
    – PiBuster
    Jun 14, 2014 at 22:00
  • The Led has a typical voltage drop of 1.2v at 12mA. Remaining voltage is across the resistor
    – Marla
    Jun 14, 2014 at 22:03
  • @PiBuster . I did some further research. I am astounded that I could NOT find an add on board for RPi that has relay contacts output for high level AC switching. I use the "Gertboard" for many applications, but it only uses transistor buffers for switching of DC relays. The Triac circuit I suggested does require the user to build quite a bit of extra circuitry. Perhaps others know of a commercially available (multiple relay) board.
    – Marla
    Jun 14, 2014 at 22:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.