Home automation raspberry pi 3 model b

hi, can someone help me? I am doing a home automation unsing raspberry pi 3 model b and a 12v 16 channel optocoupler relay module. I am using Raspbian OS. I have created my blynk app with token and already download blynk library in my raspberry. I have already connected it and I can already switch the lights on with my app but the problem is when i turn it off the lights dont turn off??? please help. thank you in advance.

Can you show us what you have for your script… assuming you are using virtual pins and code… otherwise basic direct pin control in the App can only go so far.

I am a newbie in using blynk. I just watch some tutorials from youtube on how to make home automation using blynk by installing blynk library. that is why i am not using any script just running the blynk library with my token. just like th image attach.

@leomaralmonte by default Blynk buttons are in PUSH mode so if you haven’t set them to SWITCH mode a button press would go HIGH then LOW. Many relays are active LOW so a button press in PUSH mode would turn on your lights.

Try SWITCH mode if you haven’t already.

1 Like

Well, your image (and we do prefer copy/paste of your CLI and/or Serial monitor output) doesn’t show whether ON/OFF is loaded and working. You say pressing a button linked directly to a GPIO will activate, but NOT deactivate a relay? I don’t see how you can have one without the other, so I don’t know what more I can suggest?

http://help.blynk.cc/hardware-and-libraries/node-js/how-to-install-nodejs-library-on-linux


@Dmitriy I don’t know what other Blynkers think but for me the default for a button should be SWITCH not PUSH. I noticed it watching the Anna LED video over and over again and then “using” her published App.

this script is new to me. ill try to install the onoff.

I have already set it on the switch mode. the problem i have is that after connecting to blynk and the app says the device is online. as as soon as i switch the lights on it turna on but the problem is when i switch it off the lights do not turn off.

It is a bit hard to tell from the picture, what with the flash, but I am wondering if you are using the wiringPI C++ method, and not the NodeJS… in which case there may not be a message about ON/OF being loaded?

sorry but im new with those terms… but yes i am using the wiringpi.

I follow this tutorial from youtube. https://m.youtube.com/watch?v=ZJcYiSFiMY8

OK, I had a thought (it occasionally happens, no apologies ;P)… if your relays are wired to activate the light when the coil is de-energised (using the Normally Closed connection), perhaps you do not have enough current to fully energise them, thus turning OFF the lights, when activated via Blynk?

Are there any LED indicators on the relays? do they change state when pushing and releasing the buttons?

yes they have led. when i switch it on the light on the led turnned on but when i switch it off it do not turn off.

What is the make/model of the relay board… does it have a latching option?

Can you test a single GPIO with an LED and resistor, instead of the relay signal… and see if the LED also stays on once switched on then off?

yes it does have led on the relay. when i switch the app to on the led of the relay turns on but when i turn the switch off the it does not turn off.

i am using aukey 12v 16channel optocoupler relay module.

I ment completely replace the relay on at least one GPIO with a basic LED & Resistor wired to ground, so we know that it (the relay) is not in any way the issue (there is the optocoupler and possibly other minor circuitry involved in the relay triggering.on the board).

That relay is a 5v coil, and each one needs 50-60mA Driver Current… how are you powering all 16? I hope not off the RPi 5v pin :wink:

I still think you are having low current issues on the coil, but I am still unsure if I am understanding you correctly whether the indicator LED on the relay WILL or WILL NOT change state when toggling the widget button.

i am using 2 5v pin from the RPi plus a 12v adapter.

i have a 4 channel relay module. I tried to attach it and run the same process and it works. the on and off process.

Find a separate 5v - 1 amp min adaptor and use it instead… remember to share it’s ground with with the RPi power source (or just to a GND pin on the RPi).

Because the relay / light power (assuming thats the 12 you mentioned) is supposed to be isolated anyhow, you do not need to share it’s ground.

@Pavlo what do you think?