Introduction
Components
Circuit
Setup new ESP8266 or Nodemcu
Follows these steps to setup your first ESP module
1. First you need to add ESP boards to Arduino IDE for this you have to copy the link given below ESP8266 Library - https://arduino.esp8266.com/stable/package_esp8266com_index.json
3. Now go to boards and select your ESP8266 Generic Module and you are done with ESP board configuration.
4. Now we have to add blynk library to Arduino IDE for this download the library.
Blynk library(Click the link and download, extract the zip file paste to arduino library)
Blynk IOT Setup
1. To setup your blynk iot first you need to create account and login with gmail and password.
4. After creating all datastreams go to Web Dashboard now add push button to control the output, I have configured total of 8 outputs pins also choose the datastream in button settings.
5. After this click on save and go to my devices and click on new devices, choose the tamplate and create the device. After this you need to copy the auth token and tamplate ID and paste it to arduino code given below, make sure entre your WiFi hotspot(wifi router) name and entre the password of your wifi, after this when you power the ESP8266 it automatically connect with wifi because your ESP8266 acts as wifi device.
How To Upload Code in ESP8266
To program your ESP module you need press boot button then plug to computer and then release boot button to set ESP in boot mode simply click upload button in arduino ide, after uploading code to ESP press reset button to go in running mode that the simple and cheap method otherwise you have to buy premade development boards like Nodemcu.
Code
#define BLYNK_PRINT Serial
#define BLYNK_TEMPLATE_ID "TMPL3lkduRc-B"
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = "R5xXov-4RDlBcDcr9PdRS2A7Y0fhwKU-";
char ssid[] = "your wifi name";
char pass[] = "wifi password";
void setup()
{
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
}
void loop()
{
Blynk.run();
}
After code uploaded press reset button on esp8266, when your ESP8266 will connect to your hotspot then its onboard Blue LED will glow(GPIO 2). After that you are done with whole things now just go to your blynk iot and control upto 8 devices.
Circuit Diagram
good
ReplyDelete