Go Down

Topic: Controlling a relay with a transistor switch (Read 2895 times) previous topic - next topic


Hello first post here,

The reason I'm doing this is because the relay is going to be dealing with a very high ac voltage and I'm trying to keep the arduino as safe as possible - also the relay may need its own power source.

In other words, is replacing the LEDs in this circuit with a 120v rated relay feasible?


Any and all input is welcome.


Sep 23, 2012, 11:21 pm Last Edit: Sep 23, 2012, 11:25 pm by jackrae Reason: 1
Definitely not !

If you want to switch 120vAC and your level of expertise is low then the following relay shield, or similar, is recommended  - actually if your level is low then steer clear of mains voltage until you've developed some skill.
Note that this is only rated for 360VA.


Thanks for your response jackrae

Can you explain why it wouldn't work?

It seems that this relay shield would only bring that high voltage closer to sensitive electronics, which I'm trying to remove it from.

My skill level is not necessarily low with these kinds of electronics, I'm just new to the arduino controller.


A well designed mains-relay shield will keep all the relay contacts well separated from the relay coil connections (about a cm is good), preferably with a plastic sheet on the underside to protect the traces from touching anything accidentally.

And of course the relays must be mains-rated.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]



With significant power being switched, I recommend getting the relay(s) physically away from Arduino (Close to the load if possible), and using Optical Isolation so you don't need any direct electrical connection between Arduino and the relay circuitry.

See the schematic diagram on this page: http://goo.gl/PcWJ2  You could do something like this yourself, or buy relay boards. (The one shown is only $4)..

Read up on controlling power with Arduino on the ArduinoInfo WIKI here - http://arduinoinfo.info   
See: http://arduino-info.wikispaces.com/ArduinoPower

DISCLAIMER: Mentioned stuff from my own shop...
Regards, Terry King terry@yourduino.com  - Check great prices, devices and Arduino-related boards at http://YourDuino.com
HOW-TO: http://ArduinoInfo.Info


If you want to control many channels, says more than 4 channels, I would suggest to use ULN2803 Line Driver to control the relay.
Electronics and computer projects


To be honest a relay would work providing A. it's rated for the voltage. B. it's located away from your breadboard C. there's a protective diode to protect the arduino board...


your led's are going quite fast it will wear out the contacts fast as the voltage arcs as the relay makes contact.

if you wish to keep that speed up and not worry about replacing all the relays every few months invest in solid state relays.



The light now works with a 5vdc relay switch rated for 120vac connected to the arduino. This is just a proof of concept and will be updating the code to increase the delay between switches.




That relay won't last 6 months at that speed


That relay won't last 6 months at that speed

Thats true, but I think you missed this part in my post:

This is just a proof of concept and will be updating the code to increase the delay between switches.

Either way, this is only meant to be running during parties so it doesnt even need to last 6 months.


Your relay will work, assuming that a) it is rated for 5v drive, and b) you have a free-wheeling diode on the relay; and c) your transistor is rated as such.

You may also consider a solid state switch for high frequencies or life.

Go Up