I have got a 4 channel relay that gets triggered with 12V and was given to me as it can be controlled using arduino. Late I realized since arduino can't supply 12 V thru its pins, it would be hard to control it. Hence I searched and after many attempts was able to create a circuit to trigger one channel of the relay using 2 external power sources --- one 12V to power on the relay board and one 9V to trigger one channel of the relay.
Now while my circuit is working perfectly fine for one channel, I am unable to expand it to build it separately for 4 channel relay, with an aim to control all 4 channels at the will of triggering them via Arduino. Is there a way to get this solved?
yes, that's how I got tricked as well. The website description is incorrect I think since the relays don't get triggered that way, rather only above 9V atleast. Have tested this multiple times and hence ended up using 9V
Connect the transistor collector to the relay IN4.
Connect the Arduino GND to the relay board COM and the transistor emitter.
Keep the transistor base connection as you now have it.
Set the jumpers on the relay board for trigger LOW.
When you set the Arduino pin HIGH, the relay should go on.
Hi Jim,
Thank you for the help earlier. I have a followup question on operating relays from arduino. I am sending a serial text from raspberry Pi to arduino connected via usb. While the relays work okay, the concern is, every time i send a serial input to arduino it resets all the pins and all the relays first go on and then off and post that my desired command to turn specific relays on / off are executed. Is there a reason why this could be happening pls? And any way to avoid this behaviour of on/off before actual command gets executed? I have read a way to attach a capacitor in other posts, but not sure if that will resolve this issue?
Surprisingly, i have another old raspberry pi with Arduino 1.0.5 installed and when i upload the sketch from that Pi to same arduino, the on/off behaviour is not observed and the commands get executed as desired.
I am using baud rate of 9600 on dev/ttyACM0 to open the serial connection to arduino in both cases.
This is the sketch portion relevant to the setup:
void setup()
{
Serial.begin(9600); //baudrate
pinMode(relay_1, OUTPUT);
pinMode(relay_2, OUTPUT);
pinMode(relay_3, OUTPUT);
pinMode(relay_4, OUTPUT);
digitalWrite(relay_1, 0); // Relay off
delay(500);
digitalWrite(relay_2, 0); // Relay off
delay(500);
digitalWrite(relay_3, 0); // Relay off
delay(500);
digitalWrite(relay_4, 0); // Relay off
delay(500);
}
Any guidance would help to debug this behaviour. Thanks!
Ankur