I have installed a sain stamrt 5V relay module outside in the garden to control lamps.
I connected it to my PI with an approximately 40m long UTP cable. 5V and GRD to the relay is supported from an external DIN rail mounted transformator (3A). GPIO is connected via transistors https://www.raspberrypi.org/forums/viewtopic.php?t=36225
When I turn on the item the samll led on the relay board gets light but the relay doesn’t “click”.
Do you have any idea why? I think long cable cause low voltage or amperage, I don’t know. Could you please suggest how to solve it?
The relay is a 5V one. A raspberry pi is a 3.3V devices. In general, 3.3V is enough to trigger the 5V relay, but it seems that it is not the case here, probably because you get too much voltage drop in your cable.
To check that, could you mesure the output of the RPI at the end of the cable, both when it is connected to the relay and when it isn’t ?
If I understand you correctly, you have a good 5V source available where the relay is ? You might try to use a logic level converter to up the voltage from 3.1V or whatever it is at the end of the cable up to 5V (using a logic level converter also means you’ll be drawing much less current on the RPi, so less voltage drop.)
@nattila1 you need to connect the transistor and GND from the RPI to the relay. So you need two wires from rpi to the relay. And then also your rail supply to VCC and GND. See my drawing.
The relay is active low and the rpi 3.3V are not used to supply the relay. The 5V from the rail are put to ground to switch the relay on.
As you may see there you do not need the transistor circuit, but the on off behaviour will be inverted. To use an external power supply you need to feed supply from the rpi, the pins you toggle will be either ground switch goes on or high switch is off.
With a good cable the distance is no problem with a bad it is, was wrong. Had wrong numbers for the dc resistance. The expected current is up to 20mA, with a good UTP cat 5 cable the dc lopp resistance is 0.188Ohm/m. With 40m you got 7,5Ohm which will added twice one for the supply line and one for the signal line. So you end at 0.3V voltage drop above your cable, which is to much.
To solve, that its a bit of a hack, i would change the resistance on the board to a smaller one. As you can see in my drawing there is o resistance above the optocoupler, near VCC, this is usually used to limit the current. I would desolder and meausure it, measure my cable resistance and solder a new resistor in which is the old one minus 2 times my cable resistance. This Resistances are R1 and R4 for your board, see the manual.
Oops, I’ve completely missed the transistor part.
Please ignore my previous post !
(You might still want to mesure the voltage loss across the cable.)
Did you connect the ground from both your relay power supply and the Pi to the board?
It needs the power supply ground to complete the circuit feeding the relay could and the Pi ground to complete the logic circuit that triggers the relay board input.
40 m is quite long. If the LED lights but the relay doesnt click it just doesnt get enough juice (provided your relay is OK). Good suggestion to measure the voltage drop, but i think one can predict what you find there.
I’d suggest keeping the relay close to your RASPI and just use a longer cable on the secondary side
Hi Guys, You are great! I really appreciate your support.
Last week I tried to solve this issue, but I couldn’t. To be honest I am just a hobby electrician.
Finally I think it will be better to switch to Z-wave or something similar wireless solution.