Strange thing is that I can make the relay board work by using a python script. So its physically possible but nodered can't seem to get to the pins.
When you attempt to set the output using the dashboard does the status value shown against the gpio node change between 0 and 1?
If not show use what the debug node displays.
seems to work on the debug screen, but nothing is happening in real world.
You say it is ok on the debug, but you haven't said what you see as the status on the node as in the image I pasted. The 0 should change to a 1 and back again.
Yes it changes from 1 to 0 and back on command.
OK, in that case I don't know what might be causing it not to work. However there is the outstanding problem of the install not going right so I suggest we sort that out first.
In the debug node I see string "1" or "0", must this not number 1 or 0 ?
The gpio node should be able to handle both.
Going to burn a new sd with clean install and installing a fresh node red install on that. If that doesnât work I donât know what will.
Could it be that there is a locking issue on the gpio pins, because you other python script is running in background?
When I started with Node-RED a few years ago, my gpio nodes also didn't work. At the end it appeared that the gpio library of the johnny-five nodes (which I had installed before) was locking the pins. After removing that library, everything was working fine.
It is just an idea...
Clean install PI done.
Installed Node Red via script. No failures or comments. everything went smoothly.
Started node red. Built the same switch.
No responce on the GPIO. Im stumped. Im going to try making a switch for the other 3 relays maybe they work now.
Again, I recomment an ULN2803.
Its cheaper than Raspi.
I have no clue how to wire a chip yet, let alone controle it.
No go on the other relays. I dont get why this does not work.
Hey @dceejay,
Do you think if is useful if he would uncomment the logging lines in the nrgpio.py file on his raspberry:
Or perhaps to add some extra print
lines to get an idea whether the python script is doing what we expect?
pin 1 -> raspi pin
pin 18 -> relay input
same for other pins
gnd pin 9 to raspi gnd and relay gnd
Relay boards need 5V on Vcc pin.
ULN2803 need only 1mA for switch.
An Raspi can drive max 50mA output current.
More current damage the Raspi gpio !!!
Relay modules needs 15mA per channel on 4 relay this is 60mA.
On Raspi input and output more then 3.3v damage the gpio.
Don't have experience with python, so not clear to me whether exceptions will ever be reported in Node-RED (log)?
Could it be useful to add a print
statement at that point?
Hopefully the startup console log is clean this time ? How exactly are the relays wired up ? No other apps are trying to talk to them ?
just as a sanity check I downloaded a test python script to check if that would work.
It in fact worked perfectly. this was the script.
# getting the main GPIO libraly
import RPi.GPIO as GPIO
# getting the time libraly
import time
# setting a current mode
GPIO.setmode(GPIO.BCM)
#removing the warings
GPIO.setwarnings(False)
#creating a list (array) with the number of GPIO's that we use
pins = [18,17,15,14]
#setting the mode for all pins so all will be switched on
GPIO.setup(pins, GPIO.OUT)
#for loop where pin = 18 next 17 ,15, 14
for pin in pins :
#setting the GPIO to HIGH or 1 or true
GPIO.output(pin, GPIO.HIGH)
#wait 0,5 second
time.sleep(0.5)
#setting the GPIO to LOW or 0 or false
GPIO.output(pin, GPIO.LOW)
#wait 0,5 second
time.sleep(0.5)
#Checking if the current relay is running and printing it
if not GPIO.input(pin) :
print("Pin "+str(pin)+" is working" )
#same but the difference is that we have
#for loop where pin = 14 next 15,17,18
# backwards
for pin in reversed(pins) :
GPIO.output(pin, GPIO.HIGH)
time.sleep(0.5)
GPIO.output(pin, GPIO.LOW)
time.sleep(0.5)
#cleaning all GPIO's
GPIO.cleanup()
print "Shutdown All relays"
I tried several more times with node red without succes.
Can you try modding that to use GPIO.BOARD mode for the pins and then use the physical pin numbers to match the ones the relays are attached to ?