Dr. Kayarvizhy N Dr. Kayarvizhy N

Internet of Things

ESP8266 With Blynk

August 11, 2016All posts

Blynk Setup

Download ‘Blynk’ in Playstore or App Store, install it and create a project
Find the auth token of the project and mail it to yourself.

IMG_6035IMG_6036

Insert a button, change it to switch and map it to Pin D9.

IMG_6037IMG_6038IMG_6039IMG_6040

Run the project and click on play button

You should not receive any “Arduino Uno is offline” message like below (if your arduino uno is running fine with the same auth token. See below)

IMG_6043

Now use the button to on/off and see that the LED in Arduino board switches on and off

IMG_6041 IMG_6042

 

Connections

Refer the pin diagram below. Attach LED in Pin D9.

IMG_6034

Library

Download the blynk library from here and unzip it in Documents/Arduino/Library

Code
In Arduino IDE, use the code below.
This was modified version of (File->Examples->Blynk->Boards & Shields->ESP8266_Shield_HardSer)

//#define BLYNK_DEBUG
#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
#include <ESP8266_HardSer.h>
#include <BlynkSimpleShieldEsp8266_HardSer.h>

// Set ESP8266 Serial object
#define EspSerial Serial

ESP8266 wifi(EspSerial);

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "3e53e86250884b5c83a9124f1c57b553";

void setup()
{
 // Set console baud rate
 Serial.begin(9600);
 delay(10);
 // Set ESP8266 baud rate
 EspSerial.begin(115200);
 delay(10);

 Blynk.begin(auth, wifi, "SKS Cottage", "kayar123");
}

void loop()
{
 Blynk.run();
}

 

0 0 votes
Article Rating
0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Oldest
Newest Most Voted