Project tutorial
Connect to Blynk using ESP8266 as Arduino Uno wifi shield

Connect to Blynk using ESP8266 as Arduino Uno wifi shield

This is a tutorial to show you how to connect to Blynk using an ESP8266 - 01 as an Arduino Uno wifi shield.

  • 73,974 views
  • 11 comments
  • 56 respects

Components and supplies

Apps and online services

About this project

This is a tutorial to show you how to connect to Blynk using an ESP8266 - 01 as an Arduino Uno wifi shield. This tutorial is very detailed to help out those who are very new to this stuff.


Hardware needed:

  • Arduino Uno
  • Jumper cables
  • Solderless breadboard
  • USB 2.0 cable type A/B to connect the Arduino Uno to your Mac
  • ESP8266-01

Optional, but recommended:

Breadboard adapter (not required but it does make connecting the ESP8266 to the breadboard much easier. Link to purchase: https://www.tindie.com/products/rajbex/esp8266-bre...


Software needed:

For easy access, move or download the following software to the desktop of your Mac. It can be moved later.


Step 1: Download Arduino IDE

Click the link provided in the intro and click what is in the red box. Make sure you move it to your desktop.


Step 2: Download most recent Blynk library

Click the link provided in the intro and click what is in the red box. Make sure you move it to your desktop.


Step 3: Download the Blynk-ESP8266 library

Click the link provided in the intro and click what is in the red box. Make sure you move it to your desktop.


Step 4: Download pySerial

Click the link provided in the intro and click what is in the red box. Make sure you move it to your desktop. Once it's there, double click the "pyserial-2.7.tar.gz" file and it will create a pyserial-2.7 folder.


Step 5: Download esptool

Click the link provided in the intro and click what is in the red box. Make sure you move it to your desktop.


Step 6: Download Sdk1.0.0 v0.22 ESP8266 firmware

This will download just by clicking the link in the intro page. Make sure you move it to your desktop.


Step 7: Prepare esptool for flashing


Open the "esptool-master" folder and move the "AT22SDK100-2015-03-20-boot1.2.bin" file into it. Then, rename it to "AT22SDK10020150320boot12.bin". This step is very important. If you don't rename the file, you will get an error later on.


Step 8: Installing pySerial

Step1: Open your Mac Terminal (you can find Terminal in a spotlight search), then type "cd". Next, drag the "pyserial-2.7" folder into the terminal window and hit enter. The window should look something like:

~ Home$ cd/Users/Home/Desktop/pyserial-2.7

:pyserial-2.7 Home$

Step 2: Copy this text, "sudo python setup.py install" into Terminal and hit enter. It will ask you for your password. The window should now look something like:

~ Home$ cd/Users/Home/Desktop/pyserial-2.7 :pyserial-2.7 Home$ sudo python setup.py install Password: /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'use_2to3' warnings.warn(msg) running install running build running build_py running build_scripts running install_lib running install_scripts changing mode of /usr/local/bin/miniterm.py to 755 running install_egg_info Removing /Library/Python/2.7/site-packages/pyserial-2.7-py2.7.egg-info Writing /Library/Python/2.7/site-packages/pyserial-2.7-py2.7.egg-info :pyserial-2.7 Home$

Congrats! You just installed pySerial!

Step 9: Add the Blynk library and the Blynk-ESP8266 library to your Arduino IDE

Right click on the Arduino IDE software in your Finder, not the shortcut. Next, click "Show Package Contents". Then click "Contents", then "Java", then "libraries". Then, drag the "blynk-library-master" and "ITEADLIB_Arduino_WeeESP8266-master" folders into that folder as shown in the picture above. Keep this "libraries" window open. We will be going back to it in the next step.


Step 10: Prepare the code for the Arduino

Step 1: Go to the Arduino IDE "libraries" folder.

Step 2: Open the "blynk-library-master" folder. Then, open the "examples" folder. Then, open the "BoardsAndShields" folder. Then, open the "ESP8266_Shield" folder and open "ESP8266_Shield.ino" This should open in your Arduino software.

Step 3: Replace the existing code with the code below and save. Leave this window open. We will come back to it later.

//#define BLYNK_DEBUG

#define BLYNK_PRINT Serial // Comment this out to disable prints and save space

#include <ESP8266.h>

#include <BlynkSimpleShieldEsp8266.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[] = "???";

void setup()

{

Serial.begin(115200); // Set console baud rate

delay(10);

EspSerial.begin(115200); // Set ESP8266 baud rate

delay(10);

Blynk.begin(auth, wifi, "???", "???");

}

void loop()

{

Blynk.run();

}

Step 11: Wiring the Arduino and ESP8266

The above wiring scheme shows how to wire the Arduino and ESP8266. If you do not have a breadboard adapter, then you can use male to female jumper cables to connect to pinouts from the ESP8266 shown above.

**Make you power the ESP8266 with 3.3V. 5V kills it, be careful!

-

-

Overview of connections:

ESP8266:____________ Arduino:

GND -------------------------- GND

GP2 -------------------------- Not connected (open)

GP0 -------------------------- GND

RXD -------------------------- RX

TXD -------------------------- TX

CHPD ------------------------ 3.3V

RST -------------------------- Not connected (open)

VCC -------------------------- 3.3V


Step 12: Connecting your Arduino to your Mac

Step 1: Connect your Arduino to your Mac using your USB 2.0 cable.

Step 2: Copy this text, "sudo ./esptool.py --port /dev/tty.??? write_flash 0x00000 AT22SDK10020150320boot12.bin" into Terminal. Replace the ??? with your device address you found in the previous step. You only replace the ??? with the characters after "cu." and before (Arduino Uno). For example, mine is /dev/cu.usbmodemfd121 (Arduino Uno), so I replaced the ??? with "usbmodemfd121". Make sure the device address is copied exactly. When I first did this, I was off by one letter and it took me a while to figure it out. Now, hit enter. It will ask you for your password. The window should now look something like:

~ Home$ cd /Users/Home/Desktop/esptool-master

:esptool-master Home$ sudo ./esptool.py --port /dev/tty.usbmodemfd121 write_flash 0x00000AT22SDK10020150320boot12.bin Password: Connecting... Erasing flash... Wrote 520192 bytes at 0x00000000 in 49.8 seconds (83.5 kbit/s)... Leaving... :esptool-master Home$

Step 3: Go to the tools tab, then go to port. Next, select your device address. It should be the bottom one. Your device address will be different.


Step 13: Flashing the ESP8266

Step 1: Upload a blank sketch to your Arduino.

Step 2: Open your Mac Terminal (you can find Terminal in a spotlight search), then type "cd". Next, drag the "esptool-master" folder into the terminal window and hit enter. The window should look something like:

~ Home$ cd /Users/Home/Desktop/esptool-master

:esptool-master Home$


Step 14: Upload your code to the Arduino

Step 1: Disconnect the ESP8266 GP0 pin from ground.

Step 2: Open your Blynk app on your phone.

Step 3: First, create an account, create a new project, and hit the gear button. Next, press the auth (long array of characters) and email it to yourself. Go to the "char auth[ ] = "???";" line of your code. Replace the ??? with your new auth characters.

Step 4: Go to the "Blynk.begin(auth, wifi, "???", "???");" line of your code. Replace the first ??? with your wifi name. Replace the second ??? with your wifi password.

Step 5: Click the upload button.

Step 6: Disconnect and reverse the RX and TX Arduino pins (so that the RXD pin of the ESP8266 is connected to the TX pin of the Arduino and the TXD pin of the ESP8266 is connected to the RX pin of the Arduino).


Step 15: Check your connection

Step 1: Open the serial monitor.

Step 2: Change the baud rate to 115200 if it is not that already (at bottom right corner of the serial monitor, there is a drop down menu to change it). You should get something similar to the response below.

[19] Blynk v0.2.5-beta [20] Connecting to Courtyards-Wireless
ATE0
AT+CWMODE?
AT+CWJAP="Courtyards-Wireless",""
AT+CIFSR
[3088] IP: +CIFSR:STAIP,"100.65.10.162"
+CIFSR:STAMAC,"18:fe:34:a3:a3:01" OK
AT+CIPMUX=0
[3110] Connected to WiFi
AT+CIPCLOSE
AT+CIPSTART="TCP","cloud.blynk.cc",8442
AT+CIPSEND=5
 AT+CIPSEND=32
15e942483a7141d5acceb9c657274d17[10176] Ready (ping: 11ms).

Now, you can go back to the Blynk app, press the dotted background, add a button, and connect it to digital pin: D13. Then, press the play button.

The LED next to pin 13 on your Arduino should turn on when you press the button.

If it does, CONGRATS! You have now connected to Blynk and can create your own projects.

Happy Blynking!!


Code

CodePlain text
~ Home$ cd/Users/Home/Desktop/pyserial-2.7 :pyserial-2.7 Home$ sudo python setup.py install
Password:
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:267:
UserWarning: Unknown distribution option: 'use_2to3'
 
warnings.warn(msg)
running install
running build
running build_py
running build_scripts
running install_lib
running install_scripts
changing mode of
/usr/local/bin/miniterm.py to 755
running install_egg_info
Removing /Library/Python/2.7/site-packages/pyserial-2.7-py2.7.egg-info
Writing
/Library/Python/2.7/site-packages/pyserial-2.7-py2.7.egg-info
:pyserial-2.7 Home$
CodePlain text
~ Home$ cd /Users/Home/Desktop/esptool-master :esptool-master Home$ sudo ./esptool.py --port /dev/tty.usbmodemfd121 write_flash 0x00000AT22SDK10020150320boot12.bin
Password:
Connecting...
Erasing flash...
Wrote 520192 bytes at 0x00000000 in
49.8 seconds (83.5 kbit/s)...
Leaving...
:esptool-master Home$
CodePlain text
[19] Blynk v0.2.5-beta [20] Connecting to Courtyards-Wireless
ATE0
AT+CWMODE?
AT+CWJAP="Courtyards-Wireless",""
AT+CIFSR
[3088] IP: +CIFSR:STAIP,"100.65.10.162"
+CIFSR:STAMAC,"18:fe:34:a3:a3:01" OK
AT+CIPMUX=0
[3110] Connected to WiFi
AT+CIPCLOSE
AT+CIPSTART="TCP","cloud.blynk.cc",8442
AT+CIPSEND=5
 AT+CIPSEND=32
15e942483a7141d5acceb9c657274d17[10176] Ready (ping: 11ms).
Github
https://github.com/blynkkk/blynk-library
Github
https://github.com/vshymanskyy/ITEADLIB_Arduino_WeeESP8266
Github
https://github.com/themadinventor/esptool

Schematics

FFDHA9RIE4ZMVE9.LARGE.jpg
Ffdha9rie4zmve9.large

Comments

Created by

Nolan Mathews

Are you Nolan Mathews? Claim this project and add it to your profile.

This is mine

Posted by

20cc1ea
Pavel
  • 0 projects
  • 7 followers

Additional contributors

Published on

September 14, 2015

Members who respect this project

12278792 1225491704144475 2521946915381291926 n48950.jpgMe honeymoon v8iaitcopxDefaultDefaultAvatarAndrewpmillerDefault

and 48 others

Project replicated by

Default
See similar projects
you might like

Similar projects you might like

Control Arduino Uno Using ESP8266 WiFi Module and Blynk App

Project tutorial by Adithya TG

  • 5,253 views
  • 10 comments
  • 18 respects

Add WiFi to Arduino UNO

by Jefferson Paredes

  • 145,148 views
  • 58 comments
  • 93 respects
Add projectSign up / Login