ESP8266 – The IoT platform (WiFi) (Part 1)


There are several WiFi-modules out there that allow for a range of projects to be connected to the internet. However, there are few that cost less than $2 and contain functionality similar to that of an Arduino. The ESP8266 is a connectivity platform, meaning it’s a self-contained module containing CPU, WiFi-capabilities, GPIOs, timers and more. This makes the platform ideal for all kinds of IoT-projects.

This article is the first of several articles covering the ESP8266. The focus will be to cover its functionality in a clear and simple way and hopefully make you realize why the ESP8266 is a true game changer.

  • Part 1: The IoT platform
  • Part 2: A simple IoT-application
Figure 1: The ESP8266 on an ESP-01 breakout board

There are three key parts to this set up.

  • A connection from a computer(Arduino IDE) to the ESP8266. This is accomplished by using the usb-to-serial part of an Arduino UNO.
  • A logic level shifter. Shifting 5V logical signals from the computer to 3.3V signals required by the ESP8266
  • Software for ESP8266 support in Arduino IDE

Set up – Connections

All required components are listed in table 2. All descriptions and figures in this article assume that the ESP-01 module is used (figure 2). If you want to connect a different module please visit the community driven page for the complete module family.

Figure 2: Pinout for ESP8266 ESP01 breakout board
Table 2: Components used
Component Quantity Comment
Arduino (only as USB-to-Serial converter) 1 Used to load programs to the ESP8266 from PC.
ESP-01 : ESP8266 1 Other modules should also work, but you need to locate the correct pins
Resistor – 10kΩ 3 Pull-up resistors for GPIO0, GPIO2, and CH_PD
Resistor – 330Ω 1 Used for limiting current to toggled LED
LED 1 For blink-example
Logic level shifter 1 For communicating between Arduino(5V) and ESP(3.3V)
Button (optional) 2 For pulling RST and GPIO0 to GND

Using the Arduino Uno as an usb-to-serial converter

Disconnect the Atmega328 from the Arduino board either by removing the IC completely or by connecting a cable between GND and RESET. When RESET is pulled to GND the Atmega will never boot. Continue with connecting level shifter and ESP8266 according to figure 3 and table 3.

Figure 3: Programming set up
Table 3: Pin connections
Pinname To Note
TXD TX of Arduino Has to be connected via a level shifter
CH_PD 3.3V via 10KΩ Always pulled HIGH
RST 3.3V via 10KΩ Resets esp8266 when pulled to GND
VCC 3.3V At least 300 mA from a power supply(PSU)
GPIO2 Connected to LED and 3.3V via 10KΩ General purpose input/output pin
GPIO0 3.3V via 10KΩ If pulled to GND – will access mode for loading firmware
RXD RX of Arduino Has to be connected via a level shifter

The buttons in figure 3 are used for pulling RST and GPIO0 to GND when programming the ESP8266. The buttons can be replaced by a cable that is connected/disconnected to GND when required. The pull up resistors on CH_PD, GPIO0 and GPIO2 are required for stable operations.


Make sure that GND from the Arduino board and GND from the 3.3V power supply are connected in order to establish a common reference for the logic level shifter.

Also, make sure that you use an external power supply capable of delivering at least 300mA @ 3.3V. The 3.3V pin from the Arduino can’t supply enough current!

Set up – Programming

Begin with downloading the latest Arduino IDE. Then follow the latest instructions at: Arduino ESP8266 GIT

Next. At the top menu of the Arduino IDE click “Tools”-> “Board” -> select “Generic ESP8266 Module”. This will activate more options under “tools”. The most important option will be the “upload speed”, the rest can be left as default. The default baudrate for the ESP8266 can vary, but most modules run either 9600 or 115200. Try these first.

When powered, the ESP8266 will boot in “operation mode” if GPIO0 is HIGH or to “firmware load mode” if GPIO0 is pulled to GND. The two buttons included in figure 3 are used to put the ESP8266 in these two different modes.

Do the following in order to load new firmware from the Arduino IDE to the ESP8266:

  • Power the ESP8266 and connect the Arduino uno to the PC using an USB-cable
  • Press Btn 2 (GPIO0 to GND) and Btn 1(RST to GND) and hold them pressed down
  • Let go of Btn 1 and wait at least 1 sec
  • Let go of Btn 2 (ESP8266 is now in firmware mode)
  • Press the “upload button” in the Arduino IDE to program the chip
  • The upload process can take several minutes depending on what speed that is used. Keep an eye on the console output from the IDE


Successful set up with the ESP8266 will generate the following message when uploading a sketch.

Uploading xxxxxxx bytes from /tmp/buildxxxxx.tmp/Blink.cpp.bin to flash at 0x00000000 ….

Unsuccessful set up will generate the following message:

warning: espcomm_sync failed error: espcomm_open failed

Some common reasons for an unsuccessfull set up are: mixed up TX and RX, using the wrong “upload speed”, or not properly putting the chip in “firmware mode”

A simple blinky example

The benefit of programming the ESP8266 using the Arduino IDE is that many examples from the IDE, e.g. “blink”, work directly on the ESP8266.

For this example to work, connect a LED and a resistor(330Ω) in series from GPIO2 to GND.

Next part

In the next part of this series a simple IoT-application will be created. It will measure air temperature and send the data over WiFi using GET requests.