Help, relay weirdness!

I have four relays connected to my breadboard as shown in the attached photo.
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?


//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);

// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(pin5, HIGH);   
  digitalWrite(pin4, HIGH);
  digitalWrite(pin3, HIGH);
  digitalWrite(pin2, HIGH);
  digitalWrite(pin5, LOW);   
  digitalWrite(pin4, LOW);
  digitalWrite(pin3, LOW);
  digitalWrite(pin2, LOW);

Moderator edit:
</mark> <mark>[code]</mark> <mark>

</mark> <mark>[/code]</mark> <mark>
tags added.


My eyes cannot follow the wiring.
Would you draw a circuit diagram of one of the relay/led circuits and show us it?

For your reference:

this is a video of the behavior. Is there insufficient insufficient current available for the coils?

I’ve attached a copy of the circuit I’ve adapted and repeated four times on my breadboard. I added an 100ohm resistor and an LED on each of the four circuits at the transistor emittor.


Measure the 12 volt supply, does it drop when there is more than one relay on?
What transistors are you using?
Is the LED+100R in parallel with the relay?
Are all your emitters going to ground?

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?


draw it on paper and take a picture?

See #3:
See #7:,148850.0.html

Put your LED in series with it's dropping resistor in parallel with the relay coil.

And use a higher value current-limiting resistor when its being driven from 12V, around
1k will do.

Just to be clear the LED and its current limiting resistor are another part of the load, so go in
parallel with the relay winding and its diode.

When you had them in the emitter circuit you were putting 100 ohms and an LED's
voltage drop in series with the relay winding, preventing it getting enough current.

A switching transistor has the load on the collector, not the emitter.