JCA34F:
Where is the LED strip power coming from? Maybe the relay is buzzing and putting intermittent power on the LEDs, who knows.
Sorry, please see the updated schematic image...
JCA34F:
3.3V is NOT enough to fully illuminate the opto coupler LED.
If the opto LED drops 1.1V and the indicator LED drops 1.8V, 3.3V - 2.9V = 0.4V / 1kΩ = 0.4mA.
Put 5V on Vcc, the Wemos output can sink the 2 ~ 3 mA OK.
Already put 5V on Relay VCC (please see my schematic above) but doesn't solve the issue
johndg:
Unfortunately, the documentation from Sainsmart is one of the saddest apologies for a documentation set I've ever met. The signal input current is not specified, and the schematic is little help, as none of the component values nor device type numbers is given.Blurb claims it can be driven by TTL (IOL = 16mA). Arduino, well, it's a bit doubtful with a 3.3V supply (IOL = 5mA). Blurb also says " It can be controlled directly by ... Arduino", but doesn't say 5V or 3.3V supply.
As @raschemmel suggested, just check with a meter (or a battery and test lamp) whether the relay contacts are closing (and opening, for that matter!).
Also, if you have a DMM, measure the voltage at the board input pin when the Arduino output is LOW. It should be close to 0.5V. If it's much higher you risk damaging the Arduino.
DMM measurement result on D1 Mini signal output:
LOW = 0.09V
HIGH = 3.28V
Please let me know, how to make HIGH = 5V (enough voltage to drive 5V relay) without damaging D1 Mini signal pin?
And the voltage cross the relay contacts ?
raschemmel:
And the voltage cross the relay contacts ?
5.29V
Then the contacts are open because if they were closed the voltage would be zero because there
would be NO potential difference between
the contacts. In other words , it would be like trying to measure the voltage between the DMM
leads by touching them together.
raschemmel:
Then the contacts are open because if they were closed the voltage would be zero because there
would be NO potential difference between
the contacts. In other words , it would be like trying to measure the voltage between the DMM
leads by touching them together.
Your information above is a new knowledge to me, thank you so much.
What I should do to make the LED strip completely off?
I've a couple of questions.
1: why does the OP have a pull-up or pull-down on an output?
2: what does he mean by "completely" off?
Ignoring all else the relay is an on/off device. It cant be "partly" on.
If the LEDs are still not "ccompletely" off when the contacts are open the inescapable conclusion is that SOMETHING is letting current through.
Modern LEDs will light (dimly) with TINY currents. So ANY leakage will cause them to be "not completely OFF".
Our mains LED lights have a nice "ghost light" effect when turned off, due to leakage capacitance across the switches.
The OP is using a mains LED strip, so I'd suggest that similar leakage across the relay due to capacitance is the culprit.
Why do they need to be "completely" off? Eliminating the TINY leakage current may not be easy.
Since energy can neither be created or destryed,
we must conclude that something is wrong because I guarantee you that if I cut that led string in half
where the OP connected the relay contacts that those leds are going to be as OFF as they could be
so clearly there is something wrong with this whole
story. We are not getting all the information. or somehow it is not wired like we think it is. There is just no way the leds can be lit when power is removed so I must conclude the OP has found a
way to do the impossible: make leds light with NO
voltage. If I were there I could solve it 10 seconds.
Just for the record, there is no such thing as an "AC
led string" since there is no such thing as an "AC LED" (you can put leds back to back to make a bipolar led but it's still two dc leds)
.What the OP is calling an AC led string is an AC/DC converter powering a constant current PS powering a string of leds. What do you want to bet that the relay contacts are not where we think they are ? (not sure how that explains the magic 'powerless leds'
mystery.)
"Although relay is in HIGH state (which the led strip should be completely off), the led strip still on. It is not shining brightly (like when relay is in LOW state), but only dim."
I always thought 'AC' meant Alternating Current.
I'm havin trouble understanding how it can 'alternate' if the circuit loop is OPEN'. Maybe
someone can enlighten me.
Test: Take an AC lamp cord , cut one of the two
wires on the cord and then plug it in and turn on the light , take a photo of the 'dim' light and post it
(try not yo touch the exposed cut wire)
wieb:
DMM measurement result on D1 Mini signal output:
LOW = 0.09V
HIGH = 3.28V
Please let me know, how to make HIGH = 5V (enough voltage to drive 5V relay) without damaging D1 Mini signal pin?
The high voltage level is as expected. The 3.3V is the normal 3.3V Arduino output high voltage. It leaves 5-3.3 = 1.7V across the optocoupler and indicator LEDs, not enough to do anything, so it's properly turned off. Also, if it got pulled up any higher (above 3.3+0.5 = 3.8V) it would wreck the output.
If it's down at ~0.1V, there should be most of 5V across the relay board input, so it should turn hard on, and light the indicator.
0.09V sounds suspiciously low - are you sure you have good connections between the Arduino output and the board input?
Actually, are you measuring with the Arduino output connected to the board input? It doesn't sound like it!
JCA34F:
... 0.4V / 1kΩ = 0.4mA.
Where did you get the 1k? And 0.4mA sounds very low for an LED, outside or inside an optocoupler.
If the opto LED drops 1.1V and the indicator LED drops 1.8V, 3.3V - 2.9V = 0.4V / 1kΩ = 0.4mA.
Put 5V on Vcc, the Wemos output can sink the 2 ~ 3 mA OK.
First of all, the 1k 'dropping resistor is not needed.
Secondly, if the relay board has a 1k series resistor for the opto led, that is double what it needs to be.
A 470 ohm resistor would yield ILED=VIN/RCL=0.0106 A (10.6mA) , which is perfect.
raschemmel:
Secondly, if the relay board has a 1k series resistor ....
Agreed, but the trouble is, we're in the dark about the series resistor. The poxy schematic just calls it "R1". Nowhere in the "documentation" does it give a value for the minimum input current. And those optocouplers with just an LED shining onto a transistor generally have a pretty low CTR (current transfer ratio), so tend to need quite a lot.
Agreed, but the trouble is, we're in the dark about the series resistor. The poxy schematic just calls it "R1". Nowhere in the "documentation" does it give a value for the minimum input current. And those optocouplers with just an LED shining onto a transistor generally have a pretty low CTR (current transfer ratio), so tend to need quite a lot.
I would just say the hell with it and replace the 1k with 220 to 330 ohms and be done with it.
The OP has said the LEDs are lit when the relay is on; so ALL THE REST of the circuit is working as it should.
The issue is that when the relay is OFF the LEDs are still - just - illuminated.
It follows that the resisitor, optocoupler, the code, the WeMOS, the 5V psu - are ALL behaving.
So lets look at what is left. Just to save any confusion here is a simplified schematic.

When the switch (RELAY) contacts are CLOSED the LEDS are lit.
When the contacts are open the LEDS receive current flowing through the stray capacitance.
Its easily tested. Take the +5, GND and SIGNAL off the relay board.
The contacts are N/O so will be open. The LEDs will be dimly lit.
Referring to post #20, if the relay is connected to +5V the 1k pull-up is just adding insult to injury.,and should be removed.
D5 is configured pinMode(LED_RELAY, OUTPUT); so does not need a pull-up. or down. or sideways.

The only problem with that is that the Fritzing posted shows an AC LED STRIP.
There can be no 'stray capacitance' in an AC load with open contacts. (unless it is miswired).
It is an AC LOAD.
When was the last time you saw an AC lamp working with only ONE of the wires connected ?
In my living room, Robert! Come and see them nicely (dimly) lit when the switch is off.
Because its AC you can get a "continuous" flow of current through the stray capacitance.
The "adaptor" is likely just a series cap and MAYBE a bridge rec - or maybe just uses back to back LEDs.
But like I said its easy tested - disconnect the +5 to the relay; LEDS dim - I'm right,
LEDs OFF - YAY! now we look at the rest of the circuit.
Basic fault-finding.
I have the identical Sainsmart relay that the OP linked, R1 is 1k.
Here's some voltages, JD-VCC jumper disconnected:
Vcc = 3,3 Vcc = 5.0
In1 open connected to GND In1 open connected to GND
GND to: GND to:
A = 3.3 A = 3.3 A = 5.0 A = 5.0
B = 3.3 B = 2.82 B = 5.0 B = 3.45
C = 2.65 C = 1.77 C = 4.3 C = 1.93
D = 1.4 D = 0.0 D = 2.9 D = 0.0
I R1 = 0.48mA I R1 = 1.55mA
Sorry John,
I've been working with AC relays and contactors
for forty years and never seen an AC load with power when the contacts are open. Simple physics. No connection, no current flow.
You're obviously talking about something other than open or closed contacts. Stray capacitance doesn't conduct across open contacts. Not now.Not ever.
Brakdown voltage for air is 3000V/mm.
Typical contacts are at least 1 to 10mm apart (depending on the type) . It would take 3000 to
30,000 V to arc across the contacts.
That's a little bit more than 120 or 230V.
If your talking about the new led bulbs with incandescent lamp compatible screw in base
connectors I know they are dimly lit when you
turn a wall dimmer all the way down. I don't know
if that's true for an on/off wall switch.
but that's different. If you remove it from the socket it goes off. It's the proximity to a live circuit that makes it glow dimly. If the ac power to a led string is disconnected by relay contacts are you telling me it will power itself with no connection ?
If you cut one wire of the AC cord is it going to light
dimly when you plug it in ? I don't think so.
Why isn't lit already lit when you open the package the first time after buying it ? I don't think we're on the same page. You're talking about something else.
@JCA34F,
What's DS1 ? (rectifier or led ?)
Why is it there ?
It's the indicator LED on the relay board, didn't notice the "light rays" were missing, would have drawn them in.
What I did find, with this particular relay board, if there is 5V on the JD-VCC pin, the relay pulls in solidly, even with only 3.3V on the VCC pin the Vceo drop across the transistor is about 200mV, so the relay coil is getting 4.8V, 68mA or 95% of the normal 72. So, seems to work fine (THIS relay anyway).
Transistor didn't seem to get too warm (for 10 minutes).