Go Down

Topic: Need help with Relays not switching back. (Read 6793 times) previous topic - next topic


Again without a drawing of how you have it wired it's hard to see where you have gone wrong. Have you connecter the negitive side of the 6 volt external ground to the emitter lead AND to the Arduino ground pin? What size resistor are you using? See all these micro questions might not be required if we could we a drawing.



My setup is configured exactly like this:


im using a 1k Resistor, although ive tried with 470 ohm and 2.2k and same thing :/

one interesting thing, is that if i put a really small transistor (180 ohm) it clicks back and forth, and with no transistor it clicks really fast,

with bigger transistors (> 2.2k ) it doesnt even click once.


maybe i should try using a Tip102 transistor?



and its an SPDT relay, could that be it?


Ok, I went thru all the listings that RadioShack has for relays, I didn't see any that were 5 or 6V for the coil & 58ohm resistance.
Is it this one?

However, with 6v & 58 ohm you described, your transistor needs to sink ~ 100mA.
The 2n2222 is certainly good for that if you are turning it on enough.
With 5V coming out of the arduino and a 180 ohm resister, that should be putting around 24mA into the transistor, and with its gain of 50 that should certatinly be enough to be turned on full & drive your relay.
What is your code trying to make it do?
Use the # sign above & paste in your sketch between code & /code.
Maybe you just need to slow down how fast you are turning the relay off & on.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.


Hey guys, im trying to interface my arduino with a 5v relay through a Transistor, my diagram is as follows:

Arduino Pin 13 --> 1k R --> Transistor Base
5v External Input --> Transistor Collector
Transistor Emitter --> Relay Coil

Dear Roddiy,

correct me if I'm wrong, but that is not the circuit shown in the PDF.
With the NPN transistor you are using, you should connect the Emitter to GND and the Collector to the Relay coil. The other coil connection can then be connected to your relay supply, adding the protecting diode and so on.
Your problem may result from the protection diodes built into the AVR Microcontroller.

Best regards,


the correct way of connecting relais is as follows:
                          +5    +5  
         DIODE       |     _|_
         1n4148    _|_    |  |  RELAIS
                         /\     |_|  
               ____   |    b /   c
pin 13 ----|____|-----|
                                \   e
Good Luck!
Marko Hiero


Arduino Pin 13 --> 1k R --> Transistor Base
5v External Input --> Transistor Collector
Transistor Emitter --> Relay Coil


This is not the circuit everyone has been trying to describe and not the one in the playground PDF that you say you're using. Which is correct? The text description above will not work.


Rob Gray aka the GRAYnomad www.robgray.com


hey guys, sorry i didnt check the forum in a while, i figured out i also needed to GND the Collector of the transistor, idk exactly why, but it worked.

now im trying to re-do the whole thing on a nicer way ( the last was a bit messy) and im encountering another problem: the relay just switches back and forth, does anyone know why?


Jan 13, 2011, 01:39 am Last Edit: Jan 13, 2011, 01:41 am by graynomad Reason: 1
GND the Collector of the transistor

That sounds a bit strange, as before how about a schematic.

the relay just switches back and forth, does anyone know why?

Sounds like you've built a buzzer buy having the coil power passing through one of the contacts. Once again, post the schematic.

Rob Gray aka the GRAYnomad www.robgray.com

Go Up