Raspberry + relay help

Hello,

I am using blynk on raspberry. + ywrobot 4 ports relay

I have created 4 buttons widgets on android app and on ios the result is the same.
when pressing those buttons relay switch on but pressing again don’t switch off.
The relay can be switch off / on with python commands.

Could you help me ?

regards

Hello. Sorry, read it twice, but didn’t understand your issue.

hello,
my probleme is that the relay can be switched on but cannot be switched off when pressing on widget “button”
when pressing on the button again nothing happen

Your results will depend on multiple factors; Are you using the button in momentary or switch mode, and is your code correct for each type of mode.

More details needed, such as the answer to the above question; How are you using Blynk on the RPi - WiringPi or Node.js? And show uas the code you have written so far.

Please format it as per this example…

hello,
using the button in momentary or switch mode, has the same behaviour.

Blynk is running on the RPI and this is the result of ps command

node /usr/local/bin/blynk-client a4c21391xxxxxxe3395e1b50fxxxxxxxx

i didn’t write any code.

regards

OK, sounds like you are running with just the Blynk direct control via ONOFF and picking the GPIO pins in the app for your button widgets.

I don’t know if it really matters, but what GPIO pins are you using?

Also, is this the relay board you have?

If so, are you using the Low in or High in pins and are you powering the relay coils from a separate 5v power source or directly off of the RPi 5v pin?

One issue I can guess at is that since this module probably expects a 5v signal and the RPi GPIO only puts out 3.3v there may be issues with reliably switching… but you say you can properly switch the relays via Python commands?

Hello,

i’m using pin 7, 8, 9, 10.

this is my relay

the relay is powerd directly by the RPi 5v pin.

The relay is working correctly while using python commands.

regards

I don’t have a lot of RPi experience, and I can’t be sure if the Blynk (or any other library you may be using) may be compromising the pins you are currently using, but as a guess can you try using the BCM pins that do not have other purposes besides basic GPIO (any of the green pins that don’t support PWM should work)

And even though you have used the relay with python, as you run other programs the RPi’s power usage will increase and may not support the current needed to drive all 4 relay coils… you should use external power for VCC (but share the GND with both the external power and the RPi).

Another thought… what does your console show when you start your client? It should show something like this

OnOff mode  <--- This is the important one if you wish to use direct pin control
Connecting to: blynk-cloud.com 8441
SSL authorization...
Connected
Authorized

And what does it show when you press and release the buttons in the app?