The GPIO can't control my relay switch



Were you able to follow my short description?

Have you got your relay to work?




I notice from the images posted, you’re using a cell phone app. Have you tried using a web browser and the Cayenne webpage?
Something that seems to be missing from the phone app image is the OUT/IN button controls that are in the webpage version.
Go to the webpage with a browser and try and change the OUT/IN status of a GPIO by clicking on the gray OUT/IN box. See if Cayenne will let you change the state. If yes, then try and set the GPIO high and low.

On a separate matter, I’ve used, both 5vdc and 3.3vdc for VDD with no difference.
I have an eight channel relay card. On the one I’m using, there is a jumper to alter the power supply system. Some users suggest using the 3,3vdc for the relay input circuit and the 5vdc for the relay output circuit. Input and output circuits are separated by the optoisolators on the relay coils. This allows separate supplies to be used in case something on the relay contacts side (output circuit) blows. No damage will be done to the Pi. If the Pi is used to supply 5vdc and 3.3vdc for the card, there will be no protection in that case. A separate 5vdc supply would be necessary.
WebIOPi sets the default states on power up. The OUT/IN state of a pin has to be changed before the GPIO state (On/Off) can be changed.

Hope this helps.


On the Pi3, Pi2, B+ and Zero-
Pin 17 is POWER OUT pin, 3.3 volts.
It is NOT a GPIO “controlled” pin.
It cannot be switched.
Try using pin 15, GPIO 22


Hello everyone,

I’m experiencing the same issue where the GPIOs connected to the 8 port relay-module is always on/high.
@stefanspanberg provided a work-around with using a resistor and diode but this no a solution; my same Pi B+ works fine with the same wiring and relay-module but it doesn’t with Cayenne.
Isn’t there a solution in software available?

Now I would like very much to make use of Cayenne because of the awesome interface and app.


btw: connecting it to the 3.3V does not work at all


Can you post some pictures of your wiring and a screenshot of your dashboard for us to review?


Hello Adam,

Thank you for replying to my call for help :wink:

Below the requested pictures, like I stated above; the same setup works with a normal Raspbian build, simple Python scripts and a cronjob but I wanted to make use of the awesome GUI Cayenne offers.

RaspberryPi Model B, PiHeader and a prefabricated rainbow cable connecting to the 8-port SRD-05VDC-SL-C relay module. It’s currently powered by the 5V PIN, when I tried connecting to the 3.3V PIN the relay LEDs were very fade and IN8 was flashing contineouslty. Currently only 6 relays (IN1 to IN6) are connected.

Next, screenshots from the Dashboard as requested. Note that currently the Relay is set up as a General actuator but I tried the available relay widget before.

I’m available to provide more info if requested, I would really like to get this working.



I have the same relay board and I removed the jumper and everything worked fine even at 3.3v input. Power the relay board from 5v at the Rpi and ground or an external 5v power supply ensuring that ground is tied also to Rpi ground and relay board(common ground).

The jumper gave me the same symptoms as I see in yours.



Along the same lines of @wmontg5988 I too have used similar relays and don’t use the jumper. This video does a good job explaining what all the pins do and why he hooked up everything the way he did. It’s weird to me that it works without Cayenne. I would think it either works or it doesn’t…


Looks like this topic has still not been resolved. I too can get my 5v relay to work through a python script, however, in cayenne it switches on and will not switch off. I have not tried the resistor setup yet, was hoping not too and it does seem to me a software thing.
Any more thoughts on this?
Would be very grateful
total rasp pi noob.


Which connection method are you using, the Pi agent? And which relay?


installed cayenne on pc and mobile, then searched for the pi and went through the install pi method. The pi started reporting back to the desktop and mobile app with CPU temps etc. Then did the add relay function on cayenne, as shown in the help files.
The relay is SRD-05VDC-SL-C 10A 240VAC
Like I said I can get cayenne to turn the relay on but not off.
Sorry total noob to this stuff, thanks for helping


every things works fine at my end. can you try connecting a led with resistor to the same pin and check whether you can turn ON/OFF the led.
Also run this command in pi terminaltail -f /var/log/myDevices/cayenne.log | grep 'Relay Switch'. then turn ON/OFF he widget and see if you receive commands in log file.


@tonk It just occurred to me that you may not be sending a response and the dashboard is waiting for it until you can do anything else. Do you get a spinning circle on the button? Can you post your code?