BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Blink w/google assistant and a physical switch


#1

Hi, so, im new at this, and i need help with my project. So, my project is to control en electrical lamp, with a relay and the nodemcu 8266. But, I also want to put a physical button to control the light, when I dont have internet or battery on my phone. How do I connect that and program it?Thanks!


#2
  • initially connect the mcu to a relay and the relay to the lamp
  • by setting the pin low you set the relay ON and pin HIGH you set it OFF
  • how to operate the pin with the app: read the docs and search this forum
    next:
  • you can setup the mcu such that it also runs without blynk connected (search forum)
  • this way you can add a push button button to the mcu to use (google that)
  • and then read the button state on a timer (search this forum)
  • when the button state changes from ON to OFF (its a pushbutton) you swtich the relay state (else you have to keep the button pressed). Many examples on this forum and on the interweb.

If you get stuck, lets us know where and we can help you!

Good luck!


#3

The basic code has already been written for you in Sketch Builder:
https://examples.blynk.cc/?board=ESP8266&shield=ESP8266%20WiFi&example=More%2FSync%2FSyncPhysicalButton

This won’t work when your internet is down (but will work if it’s just your phone battery that’s died).
Take a look at @Gunner’s tutorial here for the rest:

Pete.


#4

Hi,
I am using wireless Private area network with zigbee module , I suggest you can use this network whenever internet connection will not be there, I am using these modules with general purpose relay controller https://store.ncd.io/product/long-range-wireless-relay-controller/ which is connected with arduino uno and further using ESP8266 was able to connect the relay with internet also.
Hope this module will be helpful for you also.