[SOLVED] SPDT Relay not Switching

Hi Guys,

Hoping to get your help, I am new to Arduino, but I think it’s a fairly simple circuit. My relay just isn’t switching. I have replaced it with a separate relay, but same issue.

I’ve attached a Paint diagram of what I have currently.

Arduino Mega 2560 plugged into laptop via USB 2.0.

I have a 5V relay: https://www.jaycar.com.au/medias/sys_master/images/images/9376082755614/XC4419-dataSheetMain.pdf

I have a 5V usb wall wart (old phone charger with repurposed USB-A to USB-C charging cable). This is connected on an NC circuit of the relay with an LED.

The LED is lit (as expected).

However, when my Arduino sends the signal on pin 8 to the relay, the LED remains lit. The relay’s ‘ON’ LED is on during this time, so it definitely receives the signal.

Arduino switches pin 8 HIGH/LOW on 10s intervals, so it’s not switching too quickly to not notice the LED lose power.

Any advice would be much appreciated - I’m truly baffled.

SoapyRice

Have you double-checked your relay is actually a 5V one? (ie, does the blue cube actually say 5V where I indicated?)

songle 5v.PNG

songle 5v.PNG

Disconnect the Arduino from the relay and feed 5V to the relay control input. Does the relay turn on/off as you connect/disconnect it ?

Note that many relay modules are active LOW, ie they turn on when their control input is connected to GND

Please provide a link to the relay module being used ?

homelock_shers:
Have you double-checked your relay is actually a 5V one? (ie, does the blue cube actually say 5V where I indicated?)

songle 5v.PNG

Yep, double checked - exact same.

UKHeliBob:
Disconnect the Arduino from the relay and feed 5V to the relay control input. Does the relay turn on/off as you connect/disconnect it ?

Note that many relay modules are active LOW, ie they turn on when their control input is connected to GND

Please provide a link to the relay module being used ?

Link to relay: https://www.jaycar.com.au/medias/sys_master/images/images/9376082755614/XC4419-dataSheetMain.pdf

Disconnected pin 8 from S and 5V from + on the relay. Connected 5V (arduino) to S with + having nothing. It turns on/off as Arduino is connected/disconnected.

Apologies for double post.. my reply doesn't seem to be showing up when I check this thread without being signed in.

Checking if this fixes it.

soapyrice:
Yep, double checked - exact same.

Link to relay: https://www.jaycar.com.au/medias/sys_master/images/images/9376082755614/XC4419-dataSheetMain.pdf

Disconnected pin 8 from S and 5V from + on the relay. Connected 5V (arduino) to S with + having nothing. It turns on/off as Arduino is connected/disconnected.

Hi All,

I have been able to get the relay switch to work by making the 5v Wall Wart the signal/+/- of the relay and the Arduino as the NC circuit for the LED - see attached diagram. This circuit means when Arduino and Wall Wart are on, the LED is off. When wall wart is off, the LED is on.

I am confused, does this mean the Arduino doesn’t provide enough current to power the relay in my initial circuit (see diagram in first post)?
Hoping someone might be able to explain.

Hi All,

I have determined my issue - posting here if there's any rookie who may have done the same silly thing.

I was using analogWrite(8, HIGH) instead of digitalWrite(8, HIGH). The 5v relay will switch with digitalWrite(8, HIGH) on S, 5v on + and GND on -.

Cheers,
SoapyRice.