SUPPLIES AND COMPONENTS
Arduino UNO
Espressif ESP8266 ESP-01
ONLINE SERVICES AND APPLICATIONS
Blynk
Hardware requirements:
Arduino Uno
Jumper cables
Solderless breadboard
USB 2.0 cable type A/B to connect the Arduino Uno to your Mac
ESP8266-01
Required software:
Arduino IDE:
Most recent BLYNK library
ESP8266 blynk library
pySerial
esptool
Sdk1.0.0 v0.22 ESP8266 firmware
Blynk app on iphone or android
Step 1: Get the Arduino IDE.
Step 2: Get the most up-to-date Blynk library.
Step 3: Get the Blynk-ESP8266 library on your computer.
Step 4: Get pySerial from the pySerial website.
Step 5: Get esptool on your computer.
Step 6: Download the ESP8266 firmware Sdk1.0.0 v0.22.
Step 7: Get esptool ready for flashing.
Step 8: Setup pySerial
Step 1: Open your Mac Terminal and put “cd” into it (you can locate Terminal in a spotlight search). Then, in the terminal window, drag the “pyserial-2.7” folder and press enter. The window should resemble the following:
cd/Users/Home/Desktop/pyserial-2.7 Home$ cd/Users/Home/Desktop/pyserial-2.7
Home$ :pyserial-2.7
Step 2: In Terminal, type “sudo python setup.py install” and press Enter. You will be prompted to enter your password. The window should now appear as follows:
~ 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$
Step 9: Install the Blynk and Blynk-ESP8266 libraries in your Arduino IDE.
In your Finder, right-click the Arduino IDE programme, not the shortcut. Then select “Show Package Contents.” Then choose “Contents,” “Java,” and “Libraries.” Then, as indicated in the image above, drag the “blynk-library-master” and “ITEADLIB Arduino WeeESP8266-master” folders into that folder. This “libraries” window should remain open. We’ll return to it in the following phase.
Step 10: Get the Arduino code ready.
Step 1: Navigate to the “library” folder in the Arduino IDE.
Step 2: Double-click the “blynk-library-master” folder to open it. Then, go to the “examples” folder and open it. Then go to the “BoardsAndShields” folder and open it. Then open “ESP8266 Shield.ino” in the “ESP8266 Shield” folder. This should launch your Arduino programme.
Step 3: Save the old code and replace it with the code below. Allow this window to remain open. We’ll return to it at a later time.
//#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: Connecting the ESP8266 to the Arduino
The wiring diagram above demonstrates how to connect the Arduino and the ESP8266. If you don’t have a breadboard adapter, male to female jumper wires can be used to connect to the ESP8266 pinouts listed above.
**Ensure that the ESP8266 is powered at 3.3V. It’ll be killed by 5V, so be cautious!
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: Use your USB 2.0 cable to connect your Arduino to your Mac.
Step 2: Substitute “sudo./esptool.py —port /dev/tty.??? write flash 0x00000 AT22SDK10020150320boot12.bin” for “sudo./esptool.py —port /dev/tty.??? write flash 0x00000 AT22SDK10020150320boot12.bin” in Terminal. Change the??? to the device address you discovered in the last step. You simply need to replace the??? with the letters before and after “cu” (Arduino Uno). For example, my Arduino Uno’s device is /dev/cu.usbmodemfd121, therefore I changed the??? with “usbmodemfd121.” Make sure you’ve copied the device address correctly. I was wrong by one letter the first time I performed this, and it took me a while to figure it out. Now press the enter key. You will be prompted to enter your password. The window should now appear as follows:
~ 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: Select the tools tab, then select the port option. After that, choose your device’s address. It should be the one on the bottom. The address of your device will be different.
Step 13: ESP8266 Flashing
Step 1: Connect your Arduino to a computer and upload a blank sketch.
Step 2: Open your Mac Terminal and put “cd” into it (you can locate Terminal in a spotlight search). Then, in the terminal window, drag the “esptool-master” folder and press enter. The window should resemble the following:
~ Home$ cd /Users/Home/Desktop/esptool-master
:esptool-master Home$
Step 14: Program the Arduino using your code.
Step 1: Disconnect the GP0 pin on the ESP8266 from the ground.
Step 2: On your phone, open the Blynk app.
Step 3: First, make an account, then start a new project and click the gear icon. Then, press the auth (a long string of characters) and send it to yourself through email. Go to your code’s “char auth[ ] = “???”;” line. Change the??? to your new authentication characters.
Step 4: Go to the line in your code that says “Blynk.begin(auth, wifi, “???”, “???”);”. Replace the first??? with the name of your wifi network. The second??? should be replaced with your wireless password.
Step 5: Select “Upload” from the drop-down menu.
Step 6: Disconnect the RX and TX Arduino pins and reverse them (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: Double-check your internet connection
Step 1: Switch on your serial monitor.
Step 2: If it isn’t already, set the baud rate to 115200. (at bottom right corner of the serial monitor, there is a drop down menu to change it). You should receive something similar to the following response.
[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).
Return to the Blynk app, tap the dotted background, create a button, and attach it to the D13 digital pin. After that, hit the play button.
When you click the button, the LED adjacent to pin 13 on your Arduino should light up.
CONGRATS if it does! You’ve successfully connected to Blynk and may now start working on your own projects.
“Sharing is Caring” – KP
Helping Hands.