Go Down

Topic: controlling a relay (Read 5946 times) previous topic - next topic


Sorry to start a new topic as my first post, but in my defense, I did do some searching.

Has anybody found a easy relay that can be driven by the arduino?  All the ones I found at radio shack seem to need greater than 5V to light up.  I need both 12VDC and 120VAC relays.

Thanks for your help.  I love my arduino, but I am new to electronics.



(I think/hope this is correct...)

One way to control a relay from the arduino board is to use a transistor inbetween. As follows...

the input goes to the arduino output pin. When the pin goes high (or low - depending on the type of transistor) the transistor allows current to flow and activate the relay. The plus is 12V. I believe you can use a standard darlington transistor array.

You could also use a optoisolator IC, instead of the transistor.

Regards // Jonathan


the circuit is correct
the transistor can be a bc547 for smallish relays
while the resistor could be a 2.2k

don't use optocouplers here as they're redundant and the relay is a mechanical coupler anyway:)

for big relays (coil current more that say 100mA) you need to use a darlington or an Mosfet like the IRF520. in that case you can get rid
of the resistor!

have fun



Moderator: Could we post this circuit somewhere permanent? It could be very handy to have around. :D


Apr 22, 2008, 09:26 am Last Edit: Apr 22, 2008, 09:54 am by tchiseen Reason: 1
I'm looking for a tid bit more help regarding this. I am an electronics nub basically, but I've done some research.

I want to throw a 12V DC Avionics battery using the arduino.

If I were to use a relay such as this one:

Control voltage range: 4 - 6VDC
Max. input current: 20mA
Load voltage: 3 - 52.8VDC
Load current: 0.01 - 2

Would I need to modify the R1,D1, or others in this diagram?
Also, I just wanted to clarify, can the Relay Power V+ on the right in the diagram come from the Arduino?

Edit: I should explain what I'm attempting.
I have a 12V battery powering a regulator which powers sensors. I want to have a tri-state switch - with states: Off, On, and Computer Controlled. When switched "On" the relay should switch the sensors on. When switched to "Computer Control" an event trigger on a computer (which is on a different power ciruit altogether) will decide the state of the sensors. The "On" state of the switch will be powered via the  12V of the battery, I suppose, whilst I'm unsure of how the arduino "Computer Controlled" will power the relay.

Just for the record, it wasn't my idea. I want a simple on-off switch NOT connected to the arduino. Don't ask me why I want a "Computer Control" setting, because it doesn't make sense to me either.


just kinda curious, i bought this relay today http://www.radioshack.com/product/index.jsp?productId=2062480 and i was kinda curious how would i get this to work with arduino? could i use the motorshield, or is that not necessary?


If I were to use a relay such as this one:

Hm, They are the same as I am planning on using. They seem to work fine but I have only done basic testing. They have a built in LED on the input side so it is easy to see when they are triggered.

They can be triggered directly by the Arduino but observe polarity and note the Pin numbering at the Pins not on the top.

Here, I am using 4 x SY4092's as outputs and 4 x SY4093's as inputs.

So the 4092's can be triggered by The Arduino's 5 volts and switch 3-50 volts at 2 amps.

The 4093's handle 12 volts on the input side so I will use these to switch power from the 5 volt Arduio rail to the input pins.

Jaycar also have 4090 http://jaycar.com.au/productView.asp?ID=SY4090&CATID=28&form=CAT&SUBCATID=754

Which I am using here

I have found you need to be realy careful with these. Connect PIN 1 to your output pin via a 220 ohm resistor, Pin 2 to GND and switch DC on pins 4 (negative) & 5 (positive). Forget the resistor and you smoke the chip...

Pressing the button here will trigger a pattern on the LED's which are being driven by the 3.3 Volt supply on the output side. The LED's represent buttons on my car PC monitor I will be pressing with the Arduino eventually when a voltage on the reverse lights is seen on one of the SY4093's. The result will be that the monitor will select the reversing camera input and return to the VGA input when the reversing lights go out.


Mar 19, 2009, 06:15 pm Last Edit: Mar 19, 2009, 06:16 pm by florinc Reason: 1
Hey DaveD, it's been in the playground forever:

PS This post made me a "full member" now :)

Go Up