Go Down

Topic: Trouble getting relay to work with lights (Read 225 times) previous topic - next topic

ajayler

I'm having trouble getting a relay to work correctly. Here's what I'm working on:


It's a set of christmas lights that I want to turn on and off via input from photoresistor. The relay I'm using is this: .
 I have the wires from the lights in the NO and Common screw gates, and the lights are off when there's no input from the Arduino. When I have them in the NC and Common gates, the lights turn on. I also have the input to the relay working correctly. I can switch on and off the relay but the lights never respond accordingly. I'm also tried swapping the two wires in the two NO/Common gates. Is there something I'm missing?

Thanks!

TomGeorge

Hi,
Can you hear the relay clicking when you activate it.

Tom... :)
Everything runs on smoke, let the smoke out, it stops running....

TomGeorge

Hi, again.
When you have the load in the NC pair and the load is ON, does it switch OFF when you activate the relay?

Tom... :)
Everything runs on smoke, let the smoke out, it stops running....

amarotica

So you are saying that the relay doesn't do anything if you disconnect it from the signal IN?
"If computers have no doors or fences, who needs Windows and Gates?"

raschemmel

#4
Apr 26, 2016, 05:12 am Last Edit: Apr 26, 2016, 06:34 am by raschemmel
  I'm not satisfied with your diagram. I don't want to know how the relay board works . I want to know how you have it connected. You don't have a schematic because your voltages are missing.
Get a piece of blank printer paper and draw the schematic. Forget about the photos of the relay board. We are very familiar with those. Just draw the relay board as a box and label the pins. Show what pins connect to what and where and the voltages. Post a photo of the schematic. Post your code.
This circuit is dead simple. There is no reason why you should have any problem.
Do this.
Disconnect the lights from the relay board and power them on and off with a switch. If that works, the lights are fine.
Next, connect an ohmmeter to the N.O.  and common terminals of the relay and turn it on and off and see if the there is continuity when you turn it on. If so , the relay is fine.
If so, connect one end of the lights to the AC LINE and the other end to the N.O. terminal.
Connect the common terminal to the AC NEUTRAL.
Test the relay again. The lights should turn on.


Quote
I also have the input to the relay working correctly. I can switch on and off the relay but the lights never respond accordingly. I'm also tried swapping the two wires in the two NO/Common gates. Is there something I'm missing?
Yes, there is. If you tried this you are missing a lot. It's ac and it's a relay. What possible difference could it make if you swap those two connections ? If you tried something like that, your understanding of electronics is so minimal that anything at all could be wrong here. We have to consider you are doing things that are so far out of the realm of expected possibility that we can't even imagine them.

Post another photo of your circuit but from directly above instead of from the side. Make it a close up close enough that we can see where all the wires go.

Is the relay input active HIGH or active LOW. (does the relay turn on with a HIGH or a LOW ?)


Quote
. I also have the input to the relay working correctly. I can switch on and off the relay but the lights never respond accordingly
The relay is either working or it is not working. It is a simple matter to connect a meter to the contacts to measure continuity or make a continuity tester with an led and a resistor so the relay turns the led. On
Are the relay CONTACTS closing or not ? That means you need to test the contacts. We don't really care about the leds on the relay board. We are interested in the contacts.

On a lesser important note: the relay terminals are called "TERMINALS" (NOT PORTS)
A "PORT" is something else entirely , which, based on your post, I don't think you are quite ready for.

The relay contacts are not "ports" because they are SPDT contacts. A "port" is an electrical connection like a "+" and a "-" of an arduino GPIO , with the GPIO being the "+" and the GND being the "-" , with current flowing through them, as opposed to "across them" as in the case of contacts which connect to each other.


FYI, in electronics , when discussing AC , there is no such thing as "Fire" and "zero". The HOT is called "Line" and the other wire is called "Neutral"
Is that something that came from the relay vendor
site ?

Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,<br />DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

sarouje

#5
Apr 26, 2016, 08:45 am Last Edit: Apr 26, 2016, 09:14 am by sarouje
Attached a simple drawing of how I connect relay to a load.



As you said you can switch on/off relay, does that mean you can hear the clicking sound from the relay?

I wrote a post about how to connect Relay to Arduino, please check https://sonyarouje.com/2016/04/19/control-acdc-devices-using-arduino/

I also had some bad luck with some relays I bought from Aliexpress, if possible change the relay and try again.

The relay is either working or it is not working. It is a simple matter to connect a meter to the contacts to measure continuity or make a continuity tester with an led and a resistor so the relay turns the led. On
Are the relay CONTACTS closing or not ? That means you need to test the contacts. We don't really care about the leds on the relay board. We are interested in the contacts.

Try all the possibilities mentioned in Raschemmel's post.
Sony Arouje
http://sonyarouje.com

raschemmel

Correct wiring but does OP know relay is opto idolated and opto led resistor id connected to Vcc and ooto "input" led cathode is connected to "Inp" pin so it is " sinking" led current ? ( IF it IS optoidolated).
That means a LOW turns it ON .
Maybe he has  a different type.
Either way , if the lights "work" without the relay and the relay "works" without the lights, then WHAT could possibly be wrong ?
Either the contacts wofk ( and the lights should work ) or they don't work and the relay can't switch on anything, not even a led.
Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,<br />DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

TomGeorge

#7
Apr 26, 2016, 10:22 am Last Edit: Apr 26, 2016, 10:34 am by TomGeorge
Hi,
If you disconnect the IN from the arduino output and connect IN to Vcc then gnd, does the relay make a noise, does the light work?


Have you got a DMM?

With the controller reconnected can you measure the voltage from Vcc to gnd on the relay, when you activate it and deactivated it.
Then measure the voltage from IN to gnd on the relay, when you activate it and deacivate it.


Thanks.. Tom... :)

Everything runs on smoke, let the smoke out, it stops running....

raschemmel

This isn't rocket science. Something is wrong.
It's either operator error or faulty relay.
If's Chinese it could be crap.
Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,<br />DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

TomGeorge

#9
Apr 26, 2016, 10:41 am Last Edit: Apr 26, 2016, 10:42 am by TomGeorge
Hi,

Can you post a picture of an overhead shot of he controller board and the protoboard please, so we can see your layout.

Also check your protoboard, the red and blue or black power lines down the side on some boards have a break in the middle.
This means that you do not have continuity for the full length.

Tom... :)
Everything runs on smoke, let the smoke out, it stops running....

dlloyd

The 2 Relay Module shown does have opto isolation (the green JD-VCC jumper can be seen)



Here's how to wire it up and make use of the isolation feature (8 Relay Module shown). Make sure to use a separate power supply, remove the jumper and do not use a GND connection to the Arduino.


Paul__B


raschemmel

Quote
Recursion, what?
Oops !
I pasted the wrong link for a post about an 8-relay module where they posted the schematic and now I can't find that post so I had to remove my post.

Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,<br />DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy