Introduction: Arduino Connected to Wifi Using ESP8266 Controlled by BLYNK (using a Mac OS X)

Though there are many tutorials on how to set up a new ESP8266 to connect to wifi, it still took me DAYS and a lot of hours talking to the technology department at the college to actually get my project up and running. Hoping this helps give you set by step instructions to bypass the frustrations and get linked into the IoT

Step 1: Parts List (HARDWARE)

The only hardware used in this instructable is the ESP8266 (-01) which is currently $7.

the Arduino Uno - R3 which is $25

the cord to upload (IS NOT INCLUDED WITH UNO).

and handful of male-to-male and female-to-male jumper wires.


I would recommend ordering

A. breadboard to make the temporary connections before soldering

B. some form of output (LED Lights, gear motor, servo…) to control

C. A wall adapter to power your uno after uploading the code

Step 2: All the Downloads:

Arduino IDE

(currently version 1.6.5)

BLYNK library

v0.3.4 is the version used in this tutorial

(This installs all the libraries that blynk uses)

ESP8266 Library for Blynk:

(this installs the libraries that ESP needs to communicate with the Blynk Cloud/app)

Version 1.0.0

Gui Tar (Mac Update):

(so that your mac can open the next download)

Python Serial Port Extension:

(for serial communication between devices)

used version 3.0.1

Platform for ESP8266:

(gives ESP8266 its main functions)


(to flash the device)

*****MUST USE VERSION 2.2!!!!!!


for those of you who find the wording of the instructable hard to follow fear not:)

as long as you follow the step by step you won't get lost!


We are technically using an outdated firmware to flash the device. If you get an updated one this instructable WILL NOT WORK. We need version 2.5beta

Step 3: Using What We've Just Downloaded

connect your uno to your mac os x via the usb cable.

Open up your Arduino IDE.

Click on the tab labeled "tools"

scroll down to "boards"

and make sure you select "Arduino/Genuino Uno"

then click the tab below it ("Ports") and select the correct port.

For me its /dev/cu.usbmodemfd121

sooo my PORTNAME would be "usbmodemfd121"

This port name will be important later on but for now we just need it to selected. Note yours may be a little different that mine that's ok!

now click on the blank sketch that was opened when you installed Arduino IDE and click upload. This should verify that you connected everything properly and are able to give your UNO your commands.

if you need additional help in this step look through:

Step 4: Using What We've Downloaded

Open your downloads

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.

Go back to downloads folder.

install Gui.tar download.

Open Py.Serial in the Gui.tar app.

move all the folders that we've downloaded into your desktop

Step 5: Adding the Libraries

open your finder.

Open documents.

Locate the FOLDER that is named "arduino"

within that folder open the libraries.

drag the two libraries that we downloaded into this folder.

(The downloaded libraries we moved to your desktop in the last step…

they are the folders that are named ""blynk-library-master" and "ITEADLIB_Arduino_WeeESP8266-master")

Step 6: Using Your Terminal

Open your macs terminal

(do so by clicking the magnifying glass in the upper right corner of your screen right next to your laptop's clock in the magnifying glass search terminal. select it to open)

in the terminal window:

Type "cd Desktop"

hit enter.

type "cd "** notice the space?

don't hit enter yet!

drag Py.Serial folder from downloads into terminal.
hit enter.

type "sudo python install"


/Library/Python/3.1/site-packages/pyserial-3.1-py3.1.egg-info :pyserial-3.1 "YOURLAPTOPNAME"

this means that the py.serial is installed on your computer.

don't shut the terminal just yet!

*** if at any point you goofed up or hit the wrong button on this step it's ok to just start from the beginning of this step.

*** if your getting an error on this step

1. make sure that the computer is recognizing the path. if it's saying folder not found or directory not found try giving it another path to find it.

2. try looking up different versions of py.serial

3. comment below with the specific error or google it!

Step 7: Wiring Up Your Esp

connect ARDUINO to ESP (respectively) ((using the wires))

ground to ground

nothing to GP2

ground to GP0

nothing to RX

nothing to TX

3.3V to CHPD

3.3V to VCC

nothing to RST

*** notice you have to connect two pins from ESP to 3.3 v but theres only one open on the uno… This is where the breadboard comes in handy. (wire 3.3 to one of the "+" columns on the breadboard and connect CHPD and VCC to the SAME column)

Step 8: Flashing Your Esp

now that it's all wired up, upload another blank sketch.

open up your terminal again.

type "cd Desktop" hit enter.

type "cd "…again notice the space and don't hit enter.

drag the esptool-master folder from your desktop onto the terminal THEN hit enter.

type "cd sudo ./ --port /dev/tty.PORTNAME write_flash 0x00000 AT22SDK10020150320boot12.bin"

where PORTNAME is what we found in step 4. don't put in any quotation marks just put in your port name.

now hit enter again.

Your terminal should return some lines ending in

:esptool-master YOURLAPTOPNAME'

this essentially gives your ESP it's heartbeat or lifeline or brain or however you want to think of it.

If you ran into errors on this step:

1. make sure the wiring is correct.

2. make sure that your laptop understands the path to the esp folder

3. try flashing with another version of ESPtool-master

4. Google your error or put it in the comments

Step 9: Getting Online

now we need to disconnect the gp0 of the esp that is connected to ground. LEAVE THIS DISCONNECTED FROM NOW ON.

go to your "arduino" folder in your documents.

open the "library" folder in it

open the "blink-library-master" folder in it

open the "examples" folder in it

open the "BoardsAndSheilds" folder in it

open the "ESP8266_Sheilds_HardSer" folder in it

open the .ino in that

This should open up a sketch.

in that sketch go to the void setup()

find the "Blynk.begin(auth, wifi, "SSID", "PASSWORD");" line.

enter your personal SSID and Password in those quotes like so:

Blynk.begin(auth, wifi, "uno", "wifiwifi"); where uno is my internet name and wifiwifi is my password

Step 10: Getting Connected

install the blink app on your phone.

"create a new Project"

Make a note of your "Auth Token" and hit "create".

back in your sketch right above setup() is a line

"char auth[] = "YourAuthToken";"

put the Auth Token in the quotation marks instead of what's there.

upload the code to your adrunio.

NOW CONNECT RX to TX and TX to RX between arduino and esp8266

click on the serial monitor (the magnifying glass in the upper right of your sketch).

should report back

"[19] Blynk v0.3.5-beta

[520] Connecting to uno





[3582] IP: +CIFSR:STAIP,""



If you are having troubles on this step:

1. you may need to flash the device with another version of the esptool-master from step 8

2. make sure the TX and RX pins are not connected until you are done uploading

3. make sure your GP0 pin is not still connected to ground (again in step 8)

4. comment/google your specific error.

Step 11: So Far...

Up until this point most of this information has been setup according to another instructable i've used


Just pointing out the major errors and obstacles i've ran into.

the rest of the tutorial shows how to start blinking and using virtual pins.

Step 12: The Code:


* Blynk is a platform with iOS and Android apps to control * Arduino, Raspberry Pi and the likes over the Internet. * You can easily build graphic interfaces for all your * projects by simply dragging and dropping widgets. * * Downloads, docs, tutorials: * Blynk community: * Social networks: * * * Blynk library is licensed under MIT license * This example code is in public domain. * ************************************************************** * * This example shows how to use ESP8266 Shield via Hardware Serial * (on Mega, Leonardo, Micro...) to connect your project to Blynk. * * Note: Ensure a stable serial connection to ESP8266! * Firmware version 1.0.0 (AT v0.22) or later is needed. * You can change ESP baud rate. Connect to AT console and call: * AT+UART_DEF=115200,8,1,0,0 * * Change WiFi ssid, pass, and Blynk auth token to run :) * Feel free to apply it to any other example. It's simple! * **************************************************************/ /*************************************************************** * global variables: * This is where we name our widgets and libraries and whatever else * it's like giving your code a birth certificate ****************************************************************/ #define BLYNK_DEBUG // Comment this out to disable prints and save space #define BLYNK_PRINT Serial // Comment this out to disable prints and save space #include //library for esp #include //library for blynk cloud "App" #include //library to help the hardware syncchronize /*this gets rid of disconnection errors i've ran into. it uses a timer to send commands instead of sendinf thousands of commands a second and "flooding" the device */

int LED = 4;// the led is connected to digital pin 4 on the arduino int sensorpin = 5;//the potentiometer is connected to digital pin 5 on the arduino // Set ESP8266 as Serial object #define EspSerial Serial

ESP8266 wifi(EspSerial);// connect to wifi and allow serial communicaitons

int SLIDER; // a global variable for the "slider Widget" in this tutorial (on the next step)

SimpleTimer timer;// just to name the library functions

// You should get Auth Token in the Blynk App. // Go to the Project Settings (nut icon) if you need to look at it again. char auth[] = "88f9a324018f4c6e8164d2798a5871ca";

/*************************************************************** think of the next lines as global functions ***************************************************************/ BLYNK_WRITE(V1)// this is saying look for the value that can be adjusted by slider on your phone. //V1 designates "virtual pin 1" which is a widget we got from the app on our phones. { SLIDER= param.asInt(); //defining what we want "SLIDER" to mean //it takes the slider value from the widget and gives it a name in our code }

void sendUptime()// another function to syncronize things

{ int sensorvalue = analogRead(sensorpin); //this says take the potentiometer resistance reading and give it a name that we can call on if (sensorvalue > SLIDER) //if the potentiometer reading is higher than the value that we put the slider on... { digitalWrite(LED, HIGH); //turn the LED light on } else { digitalWrite(LED, LOW); //if the potentiometer reading isnt higher than where we have the slider value set to turn the LED light off } }

void setup() {//initialize all the variables pinMode(LED, OUTPUT); //the LED light is an output. Serial.begin(115200);//set the serial monitor's baud rate to the esp's rate delay(10);//pause .0010 second to avoid any confusion EspSerial.begin(115200);//this is the ESP's communication rate. //this rate is found in the ESP's spec sheet. delay(10);//pause again to aviod chaos.

Blynk.begin(auth, wifi, "uno","wifiwifi");// ssid and password //start listening for the app timer.setInterval(500L, sendUptime); //get the input from the potentiometer synchronized with the app Blynk.syncVirtual(V1); //synchronize the virtual pin with the app }

void loop()//what the microprossessor (ARUDINO) will do for the rest of its life //....unless you upload a new code or kill the power. { );//run the app and communications.;//keep everything synchronized }

Step 13: The Last Step:)

copy and paste the code and upload to arduino.

Keep in mind you have to disconnect rx and tx until upload is complete then reconnect afterwards.

wire up according to frizzing guide above

and begin experimenting