Most of the times when we go out of home for some days, we think of having some device that could switch ON/OFF (let's say) Refrigerator (or any other important appliance) for some hours during the day.
Today, we are going to make such time scheduled electric switch which switches ON/OFF at times which we set the in our Blynk app. Woah!
Let's begin!
It's circuit is same as we have created for our Smart Switch. So, if you already have that circuit set up, go ahead with Blynk app set up and Start playing.
Connections:
We have completed the circuit and set up our BLYNK. Let's do some coding.
#define BLYNK_PRINT Serial
#include <Esp8266WiFi.h> #include <BlynkSimpleEsp8266.h> // You should get Auth Token in the Blynk App. // Go to the Project Settings (nut icon). char auth[] = "YOUR_AUTH_ID"; // Your WiFi credentials. // Set password to "" for open networks. char ssid[] = "WIFI_SSID"; char pass[] = "WIFI_PASSWORD"; void setup() { // Debug console Serial.begin(115200); Blynk.begin(auth, ssid, pass); // You can also specify server: //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 8442); //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8442); } void loop() { Blynk.run(); // You can inject your own code or combine it with other sketches. // Check other examples on how to communicate with Blynk. Remember // to avoid delay() function! }
Make sure to change the AUTH_KEY, SSID and PASSWORD before uploading the code to NodeMCU.
Connect NodeMCU using the MicroUSB cable and upload the code using Arduino IDE.
Once uploaded, click Play button on the BLYNK app and we can now close the app. The app will do rest.
We can now schedule our appliances to turn ON/OFF whenever we want. That's what we call some good use of technology.
Follow knowshipp.com for more projects.