Wondering if anyone has ran into this problem. I have the quad relay shield connected to an Uno R3. I can control relays 1 and 4 (D7 and D4) just fine (no loads on any of the relays). But relays 2 and 3 won’t switch. If I remove the relay shield I can see all 4 control lines (D7-D4 changing as expected (0V when low, 5V when high) at the UNO. But when I plug the relay shield onto the Uno the voltage levels at D5 and D6 drop to only 0.47V when high, which explains why the relays aren’t activating. I’ve tried 2 different (new) Uno boards, 2 different (new) Zero boards, and 3 different relay shields (also new) and see the same behavior from any combination.
It appears the relay shield is loading D5 and D6, but not D4 and D7, and I have no idea why. I see the same behavior powering with a USB cable, or with a 9V, 3A power supply (again, I have no loads on any of the relays).
If anyone has encountered this before please let me know the trick to get around it. Since I can see all 4 digital control pins behaving correctly with the relay shield disconnected, I know the sketch is OK and twiddling the pins correctly, but it is puzzling why D7 and D4 (relays 1 and 4) work just fine, while D6 and D5 (relays 2 and 3) do not.
Checking with the schematics of shield (v3.0) there’s no way it could short the inputs.
There’s always some kOhms in all points that goes to ground, so even killing transistors on shield won’t make it short the inputs.
Well, unless your exact board assembly was faulty from the factory
But maybe there’s something wrong on your sketch side.
Check that you’ve configured arduino ports to push-pull output mode, and not as open drain with internal pullups.
The pull up resistor will allow you to see output levels when not loaded, but when loaded with led (as on the relay shield), the voltage will drop.
And it won’t be able to output enough mA to open the relay driving transistor.
Thanks … I’ll try to check this tomorrow. The sketch treats all 4 relay channels the same, with simply setting the pins to outputs and then setting them HIGH or LOW. So I don’t know why relays 1 and 4 would work while 2 and 3 would not. Here is the sketch (I’m new here, so pasting it between the CODE tags … not sure if that is the correct way to do it):
[code]
#define D1 7 // Digital pin 7 controls relay COM1
#define D2 6 // COM2
#define D3 5 // COM3
#define D4 4 // COM4
#define DELAY1 2000 // Delay in ms for test loop
int counter; // Run 1,2,3,4, then back to 1, and use to set D0 and D1
/***********************************************************************************/
void setup() {
int i;
Serial.begin(9600); // set up Serial library at 9600 bps
Serial.println(“Test Relay Program”);
// Have defined digital pins so that D1=pin7=COM1, so the “D” numbers correspond to the COM numbers
pinMode(D1, OUTPUT); // Define pin 7 (D1) as a digital output (controls COM1)
pinMode(D2, OUTPUT); // Ditto for pin 6 (COM2)
pinMode(D3, OUTPUT); // Ditto for pin 5 (COM3)
pinMode(D4, OUTPUT); // Ditto for pin 4 (COM4)
counter = 0; // Start with laser #1 (address bits 00), incremented in Loop
}
/***********************************************************************************/
void loop()
{
// Increment counter. This is initialized to 0 in Setup, so on first call it is set to 1
counter++;
if (counter == 5) // Reset to 1 if pass relay #4
counter = 1;
Serial.print("counter: ");
Serial.println(counter); // Print counter value
// Set digital pins to select relays in sequence
if (counter == 1)
{
Serial.println(“Selecting Relay #1”);
digitalWrite(D1, HIGH); // Connect COM1 to NO1
digitalWrite(D2, LOW); // Connect COM2 to NC2 = open circuit (disconnected)
digitalWrite(D3, LOW); // Connect COM3 to NC3 = open circuit (disconnected)
digitalWrite(D4, LOW); // Connect COM4 to NC4 = open circuit (disconnected)
delay(DELAY1); // Delay (also need delay between turn on and turn off, of few ms?
}
if (counter == 2)
{
Serial.println(“Selecting Relay #2”);
digitalWrite(D1, LOW);
digitalWrite(D2, HIGH);
digitalWrite(D3, LOW);
digitalWrite(D4, LOW);
delay(DELAY1); // Delay (also need delay between turn on and turn off, of few ms?
}
if (counter == 3)
{
Serial.println(“Selecting Relay #3”);
digitalWrite(D1, LOW);
digitalWrite(D2, LOW);
digitalWrite(D3, HIGH);
digitalWrite(D4, LOW);
delay(DELAY1); // Delay (also need delay between turn on and turn off, of few ms?
}
if (counter == 4)
{
Serial.println(“Selecting Relay #4”);
digitalWrite(D1, LOW);
digitalWrite(D2, LOW);
digitalWrite(D3, LOW);
digitalWrite(D4, HIGH);
delay(DELAY1); // Delay (also need delay between turn on and turn off, of few ms?
}
} // End of Loop
[/code]