? strange relay behavior? - Page 1
Forum section: electronics / beginners

author: snailFury
author_rank: Contributor
timestamp: December 22, 2013, 12:24:14 am
content: I have four relays connected to my breadboard as shown in the attached photo. I am using an arduino and transistors to trigger the relays.I am running the code below.When I send a voltage to multiple pins as HIGH without sending them a LOW signal, that is leaving the relay and LED "on", then some of the following pins I send a voltage to and their associated relays won't close even though the LED comes on. Is there some reason that having some relays switches closed would cause other relays switches to not close?Thanks!//Arduino Code:#include <math.h>// Pin 13 has an LED connected on most Arduino boards.// give it a name:int pin2 = 2;int pin3 = 3;int pin4 = 4;int pin5 = 5;// the setup routine runs once when you press reset:void setup() {// initialize the digital pin as an output.pinMode(pin2, OUTPUT);pinMode(pin3, OUTPUT);pinMode(pin4, OUTPUT);pinMode(pin5, OUTPUT);Serial.begin(9600);}// the loop routine runs over and over again forever:void loop() {digitalWrite(pin5, HIGH);delay(1000);digitalWrite(pin4, HIGH);delay(1000);digitalWrite(pin3, HIGH);delay(1000);digitalWrite(pin2, HIGH);delay(1000);digitalWrite(pin5, LOW);delay(1000);digitalWrite(pin4, LOW);delay(1000);digitalWrite(pin3, LOW);delay(1000);digitalWrite(pin2, LOW);delay(1000);}

author: DrLuke
author_rank: Contributor
timestamp: December 22, 2013, 12:32:07 am
content: Which relays are you using? Which circuit are you using?

author: sleemanj
author_rank: Super Contributor
timestamp: December 22, 2013, 12:40:26 am
content: Circuit diagram required.At a guess you probably just can't provide sufficient current for the coils.

author: snailFury
author_rank: Contributor
timestamp: December 22, 2013, 12:44:25 am
content: Relay I'm using:http://www.mouser.com/search/ProductDetail.aspx?qs=dLWB%2FtR6aAb0iRPw5CU5kw%3D%3DHere is a video of the behavior:The circuit is something like the attached image below, except that I've added an LED off the emitter of the transistor with a 100 ohm resistor going to ground. And I've duplicated the circuit 4 times.thanks!

author: sleemanj
author_rank: Super Contributor
timestamp: December 22, 2013, 12:49:00 am
content: Quote from: snailFury on December 22, 2013, 12:44:25 amDraw on your diagram how you have these leds connected. It sounds wrong.

author: TheBay
author_rank: Unknown
timestamp: December 22, 2013, 12:52:38 am
content: What is the 12v source? sounds like not enough current for coils, are you sure transistors are supplying power and the relays are not being energised directly.What happens if you do the reverse and have a common ground for the relay coils and switch the +12v with transistors?

author: snailFury
author_rank: Contributor
timestamp: December 22, 2013, 12:59:20 am
content: I removed the LED's and 100ohm resistor at the emitters of the transistors and now the relays sound like they are clicking appropriately in sync. So the lack of appropriate current appears to have been the culprit.BTW, as a novice here, what is the best way to present a circuit one makes up to the forum, draw it on paper and take a picture?thanks!

author: sleemanj
author_rank: Super Contributor
timestamp: December 22, 2013, 01:17:05 am
content: Quote from: snailFury on December 22, 2013, 12:59:20 amI suspect that you had a circuit like12v -- COIL -- TRANSISTOR (C, E) -- RESISTOR -- LED -- GNDIgnoring that raising the emitter above ground isn't very common, lets do some basic analysis.The coil of your relays specify a current of 30mA at 12v to trip, so we can use Ohm's law to work out the resistance, 400 Ohms.Let's for the sake of argument just say that the Collector to Emitter resistance is effectively Zero so we can ignore the transistor.Add in your 100 Ohm resistor, you now have 500 Ohms over 12v.Let's assume your LED has a forward voltage of 2v. If you started with 12, and your led is eating 2 of them, how many are left. You now have 500 Ohm over 10V.How much current is flowing, using Ohm's law, 10 divided by 500 = 20mA at the best theoretical case. That might be enough to trip, or it might not, it's well below the specified current either way.If you put your resistor and LED in parallel with the relay coil instead of series, you will give the relay coil the current it wants, and your led too. (Assuming that the base resistor of the transistor, and the transistor itself, is appropriate).

author: sleemanj
author_rank: Super Contributor
timestamp: December 22, 2013, 01:19:32 am
content: Quote from: snailFury on December 22, 2013, 12:59:20 amWhatever works for you, pencil and paper is fine. Or a screenshot, image export, or PDF from a circuit design software (Fritzing, Diptrace, Eagle, DesignSpark, Circuits.io ......).

author: DrLuke
author_rank: Contributor
timestamp: December 22, 2013, 01:26:56 am
content: Quote from: sleemanj on December 22, 2013, 01:17:05 amThis sounds like the solution here.