Relay module is not working with arduino

Hello, I have tried to trigger relay ON and OFF using arduino digital pin.

This is how I connected the power source to the arduino and the relay module.

The relay is not switching ON though the arduino digital pin is activated. If I use the arduino power source +5v to the relay module then it is working as expeted. Dont know where I am doing mistake.

Please help me on the same.

My crystal ball tells me that you didn't set the pin to OUTPUT.
Leo..

This would go better if you posted your code. Per Wawa you did set your digital pin as Output correct? The default is Input so if you want a Digital Out you need to include it in your code. Here is a basic example.

void setup() {
  pinMode(7, OUTPUT);    // sets the digital pin 7 as output
}

void loop() {
  digitalWrite(7, HIGH); // sets the digital pin 7 on
  delay(1000);            // waits for a second
  digitalWrite(7, LOW);  // sets the digital pin 7 off
  delay(1000);            // waits for a second
}

The example uses pin 7 but applies to any digital pin. You also fail to mention which pin you are using? Again, please post your code?

Ron

1 Like

Your diagram looks good but? Post a link to your 12V to 5V converter and let us know if it is an isolated converter or if ground is the same on both sides. Also post a link to the relay module and is it rated for a digital input.

I am using the simple code and it is working if I use 5v and Gnd pins of arduino to power the relay module. But if I am trying to power the relay module as per my above diagram, the relay is not responding.

Post a link to the relay technical info.

Here is the Relay which I am using

This is my relay module circuit diagram

Hello, I just checked the GND connection and I noticed that the ground is common for both AC to DC module and 12v to 5v converter module.

Here is the module I am using as 12v DC to 5v DC converter based on 34063API IC.

That does not match your picture. Per the diagram remove the jumper and JDVcc goes to the 12V supply. All grounds are connected. Using it as it I would expect it not to work.

I removed the jumper and I connected as same as in the relay module circuit diagram. Same GND is using for both arduino and relay module.

Is there any way to isolate the GND?

Not if you expect it to work. Ground is the reference for the pins of the Arduino.

There is no need to connect the relay module GND to the Arduino GND

Hello,

I guess you have already gone through post#1

I connected as same as post#8

JD-Vcc - 12v external supply
GND - external ground

Vcc - Arduino 5v
IN - Digital pin 7

So the grounds are isolated and it works.

yes. Is there any simple circuit to drive the relay from arduino digital pin with external supply to the relay?

That's a 28V relay - the coil needs 28V.
Your post No.1 is showing 12V.
What is really going on over there ?

No No. Please see the top line of the relay L90E-CS-DC12V. I already tested the relay with 12v and it is working fine with 12v.

OK
That's a 28V rating for the output. (Sorry.)

Can you post a picture of this relay module and indicate in detail how you have it wired?
It's the 5V and JVCC jumper.
If you're bringing 12V to it, then the jumper-block (shunt) should be out/removed.
image

see post#12. I have done the same.

Sorry - can't help.