Controlling 4 channel 12V triggered relay with Arduino

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?

Link to the relay

Circuit Diagram:

Show us a good schematic of the actual relay board module you have purchased.

Here's the schematic with actual relay image.

According to the data from your link, the relays should be able to be controlled with 3.3 or 5 volt logic.

Hello ankurb43

You might use optocouplers to read the external signal.

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

could you explain a bit more here pls?

https://www.electronics-tutorials.ws/blog/optocoupler.html

Your board already has optocouplers on it

You just need to make the correct connections to the Arduino

You don't need the 9V supply or diode.

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.

Thank you!
This worked perfectly fine and I am able to control multiple relays now without issue and without using external 9v supply

Glad it worked
Have a nice day!

There are already opto couplers on that board, and transistors.

No external transistors needed. Just drive the optos directly from an Arduino pin.
Leo..

  • Anyone have a schematic of this relay module ?

Four jumpers to select active HIGH or LOW.
Seems fully opto isolated.
Leo..

Yes


Was looking for a schematic to post when this comes up next Thursday.

:wink:

Please, someone who has a 4 channel relay (12V) module like this, confirm from the PCB traces this represents the relay circuit shown below ?

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

I did try connecting 10uF capacitor between reset and gnd pins and it seems to resolve the issue. Is this correct?

Probably not.
The code you posted has nothing to do with sending and receiving serial data.
You need to post all of your code.