Introduction: Using ESP8266 With Arduino and Blynk

Connect your Arduino Mega to blynk app using espp8266 shield.

Step 1: Materials Needed.

Step 2: Configuring the ESP - 1

To configure the ESP Wi-Fi module it have to be connected to an Arduino Uno as shown in the table. The receive pin and transfer pin (RXD and TXD) are used to interchange data with the microcontroller. The GP100 and GP102 pins do not need to be connected.

ESP and Arduino Pin-out

RXD - RX(0)

TXD - TX(1)

GRD - GND

CH_PD - 5V

Step 3: Configuring Esp - 2

To send command directly onto the ESP module the GND pin of the Arduino is connected to its Reset pin.

Once the Arduino has been wired to the ESP and the Arduino connected to the computer the module needs to be programmed through the serial monitor of the Arduino by using AT commands. To be able to communicate to the shield the baud rate is set to 115200 as this is the speed at which the ESP communicates and the setting “BOTH NL AND CR” is chosen.

AT– upon sending this, an OK message appears. This means that the ESP is working correctly.

AT+CWJAP=”WIFI_NAME”,”WIFI_PASSWORD”- this command the ESP to connect to the Wi-Fi router.

Step 4: Connecting to the Arduino Mega

After this step the GND and RESET that was connected on the UNO can be removed. Since the ESP will be used with an Arduino Mega, another set of code needs to be uploaded onto the Arduino Mega and the ESP has to be wired to the Arduino Mega.

#define BLYNK_PRINT Serial

#include "ESP8266_Lib.h"

#include "BlynkSimpleShieldEsp8266.h"

char auth[] = " input blynk token ";

//Your WiFi credentials.

char ssid[] = "ssid";

char pass[] = "password";

#define EspSerial Serial1

// Your ESP8266 baud rate:

#define ESP8266_BAUD 9600

ESP8266 wifi(&EspSerial);

void setup(){

// Debug console

Serial.begin(9600);

delay(10);

// Set ESP8266 baud rate

EspSerial.begin(ESP8266_BAUD); delay(10);

Blynk.begin(auth, wifi, ssid, pass); delay(10);

}

These setting allows the microcontroller to use the Wi- Fi network of the ESP to connect to the Blynk application. Upon uploading the program the board is set to send and receive data to the blink app and be programmed through the app.