Easy Basics: Project 021a How to upload sketch - ESP8266 ESP-01 WI FI module

of Acoptex.com in UNO

Basics: Project 021a

Project name: How to upload sketch - ESP8266 ESP-01 WI FI module

Tags: ESP, ESP8266, WI FI module, ESP-01, V090, update firmware, Ai Thinker, AI-Cloud, SOC, GPIO, General Purpose Input Output, System On a Chip, IOT, internet of things, FTDI232, FTDI 232, USB to TTL, how to upload sketch, blink sketch for ESP8266 ESP-01 module

Attachments: BLINKSKETCH

In this project, you need these parts :

1.Arduino Uno R3 (you can also use the other version of Arduino)

2. ESP8266 ESP-01 WI FI module 1pc

3.Arduino IDE ( you can download it from here  )

4.Jumper cables F-M, F-F, M-M

5. Breadboard 1 pc

6. USB to TTL serial converter 1 pc

7. USB mini cable 1 pc (optional)

8. Any voltage regulator LD1117V33, AMS1117 3.3 V or 78R33 (to get 3.3V) or  1 pc

or or 

9. Logical level converter 1 pc (can be resistors - voltage divider)

10. LED 1 pc (can be of different color)

11. Resistor 1 pc (220 Ohm)


We will learn how to upload sketch to ESP8266 ESP-01 WI FI module and use it with Arduino Uno to do your DIY projects.

Understanding the USB to TTL converter

You can read more about them here.

Understanding the ESP8266 WI FI module

The ESP8266 WiFi Module is a self contained SOC (System On a Chip) with integrated TCP/IP protocol stack that can give any microcontroller access to your WiFi network.

The ESP8266 WiFi Module is capable of either hosting an application or offloading all Wi-Fi networking functions from another application processor.

Each ESP8266 WiFi Module comes pre-programmed with an AT command set firmware, meaning, you can simply hook this up to your Arduino board and get about as much WiFi-ability as a WiFi Shield offers.

The ESP8266 WiFi Module is an extremely cost effective board. This module has a powerful enough on-board processing and storage capability that allows it to be integrated with the sensors and other application specific devices through its GPIOs (General Purpose Input Output) with minimal development up-front and minimal loading during runtime. Its high degree of on-chip integration allows for minimal external circuitry, including the front-end module, is designed to occupy minimal PCB area. The ESP8266 supports APSD for VoIP applications and Bluetooth co-existance interfaces, it contains a self-calibrated RF allowing it to work under all operating conditions, and requires no external RF parts.

In short, the ESP8266 module is a TTL "Serial to Wireless Internet" device, a small microprocessor with built in wi-fi. It is faster than most Arduino boards and has more memory than most Arduino boards and has less pins than an Arduino board.

The ESP8266 comes in a wide variety of versions (as shown in the figure below).

See the module list here.
ESP8266 AI THINKER IC (chip)


  • 802.11 b/g/n
  • Built-in Tensilica L106 ultra-low-power 32-bit micro MCU, clocked at 80 MHz and 160 MHz, supporting RTOS
  • Built-in 10bit high precision ADC
  • Built-in TCP/IP stack
  • Built-in TR switch, balun, LNA, power amplifier and matching network
  • Built-in PLL, voltage regulator, and power management components, +20dBm output power in 802.11b mode
  • A-MPDU, A-MSDU aggregation and 0.4s guard interval
  • WiFi @ 2.4GHz, supports WPA/WPA2 security mode
  • Support AT remote upgrade and cloud OTA upgrade
  • Support STA/AP/STA+AP working mode
  • Supports Smart Config features (including Android and iOS devices)
  • HSPI,UART, I2C, I2S,IR Remote Control,PWM,GPIO
  • Deep sleep current is 10uA and shutdown current is less than 5uA
  • Wake up, connect and transfer packets within 2ms
  • Standby power consumption less than 1.0mW (DTIM3)
  • Operating temperature range: -40°C - 125°C


  • create a web server
  • send HTTP requests
  • control outputs
  • read inputs and interrupts
  • send emails
  • post tweets


The ESP8266 WI FI module can be controlled from your local wifi network or from the internet (after port forwarding set on your router). The ESP8266 communicates with the Arduino through a serial interface.  It uses the Arduino’s Rx and Tx pins (digital pins 0 and 1) connected to the ESP8266 ESP-01 module for receiving commands and communicates back. The module features a full TCP/UDP stack support and can be configured as a web server. ESP-01 module powers the onboard ESP8266 through 3.3V. You will have to use a voltage regulator AMS1117 3.3 V or like the 78R33 to step down the 5V from the Arduino to 3.3V or voltage divider (You can find some info here with online calculation sheet) in order to power up the ESP8266.

The ESP8266 does not come with an USB connector on it. You need an additional component for ESP8266 to communicate with the PC or laptop via USB port. It's called USB to TTL serial adapter (for example, USB adapter for ESP8266 ESP-01, FT232RL FTDI USB to TTL Serial Adapter, CP2102 USB to TTL UART converter). So we can either use a USB to TTL serial adapter (converter) or use an Arduino to communicate and upload the code to the ESP8266.

ESP-01 adapters

ESP8266 ESP-01 module

We will use ESP8266 ESP-01 module in this project. It has 2 GPIO pins that can be programmed to turn an LED or a relay ON/OFF through the internet. 

The ESP-01 module contains the ESP8266 MCU and a flash memory chip. There are two LED's: a red one which indicates power is connected to the module, and a blue one which indicates data flow, and can also be controlled by user programming. The Wi-Fi antenna is the PCB trace that covers the top of the module; it's called a Meandered Inverted-F Antenna (MIFA,) is surprisingly efficient, and only mildly directional.

There are eight connection pads near the bottom of the module. Usually, two 4-pin male headers are inserted in the rear of the module and soldered on the front. This makes the I/Os accessible, but is not breadboard friendly, and requires flywires from the ESP-01 to a solderless breadboard. This technique works, but it is messy. 

ESP8266 ESP-01 module has three operational modes: 

1. Access Point (AP) — In AP, the Wi-Fi module acts as a Wi-Fi network, or access point (hence the name). It allows other devices to connect to it. And establishes a two-way communication between the ESP8266 and the device that is connected to it via Wi-Fi. 

2. Station (STA) — In STA mode, the ESP-01 can connect to an AP (access point) such as the Wi-Fi network from your house. This allows any device connected to that network to communicate with the module. 

3. Both — In this mode ESP-01 act as both an AP as well as in STA mode. Refer to the following site for more ESP8266 AT commands. 

ESP8266 ESP-01 module can be set in Flash mode or UART download mode (for uploading new firmware or program) and Boot mode or Flash Boot Mode (normal startup and execution of existing firmware or program).

ESPlorer — Integrated Development Environment (IDE) for ESP8266 developers.
The essential multiplatforms tools for any ESP8266 developer from luatool author’s, including a LUA for NodeMCU and MicroPython. Also, AT commands are supported.
Required JAVA (SE version 7 and above) installed.
You can download it here.
Supported platforms
  • Windows(x86, x86-64)
  • Linux(x86, x86-64, ARM soft & hard float)
  • Solaris(x86, x86-64)
  • Mac OS X(x86, x86-64, PPC, PPC64)
Detailed features list
  • Syntax highlighting LUA and Python code
  • Code editor color themes: default, dark, Eclipse, IDEA, Visual Studio
  • Undo/Redo editors features
  • Code Autocomplete (Ctrl+Space)
  • Smart send data to ESP8266 (without dumb send with fixed line delay), check correct answer from ESP8266 after every lines.
  • Code snippets
  • Detailed logging

Signals and connections of LED

The operating voltage of the LED is 1.8V and the operating current is 10mA-20mA. The Arduino Uno board can supply 5V or 3.3V power. We will use 5V for this project, so the minimum resistance of the current limiting resistor should be (5 V to 1.8 V)/20 = 160 Om. The 220 Om offered in the kit is suitable and you can also choose other resistors that meet the condition. The larger the resistance is, the dimmer the LED will get.

Signals and connections of the ESP8266 ESP-01 WI FI module


TXD (TX, TXO or UTXD) - transmit pin. Connected to Arduino Uno pin 1.

RXD (RX, RXI or URXD) - receive pin. Connected to Arduino Uno pin 0.

VCC (3V3 or 3.3V) - power supply pin (3-3.6V). Connected to 3.3V DC 1A and more external power supply. The current required for the ESP-01 during Wi-Fi operation vary from 250mA to 750mA.

RST (RESET) - reset pin. Keep it on high (3.3V) for normal operation. Put it on 0V to reset the chip.

CH_PD (CHIP_EN or EN) - Chip enable. Keep it on high (3.3V) for normal operation.

GND - Ground. Connected to Arduino board GND pin

GPIO0, GPIO2 (IO0, IO2) - General Purpose Input Output pins. GPIO0 also controls the module mode (programming or normal operation). In our case (normal operation), it shall be connected to 3.3V (high). GPIO2 is not used in this example.

Build the circuit

1. Programming (uploading sketch) using ESP01 programmer UART

It is very easy. Simply insert ESP8266 ESP-01 module to ESP01 programmer UART. However to go to flash mode you need to have GPIO0 pin grounded (attached to GND pin). A small modification on the back of ESP01 programmer UART posible to make the life more easy. You can just shift jumper from GND-GND to GND-GPIO0 position.

2. Programming (uploading sketch) using USB to TTL converter with DTR Pin or without DTR Pin

3. Programming (uploading sketch) using Arduino Uno board

The ESP8266 powered up using a separate 3.3 V power source or a voltage regulator AMS1117 3.3 V or  78R33 or a voltage divider. Note: Do not plug in ESP8266 ESP-01 module directly to 3.3V Arduino Uno board pin as the ESP8266 ESP-01 module may draw more current than the 3.3V regulator on your Arduino can supply so you can damage your Arduino board.

4. Final wiring after sketch uploaded to ESP8266 ESP-01 module

Step by Step instruction

1. Adding ESP8266 platform to Arduino IDE

the Arduino environment has to be set up to make it compatible with the 
ESP-01 module. It is required to have Arduino version 1.6.4 or higher in order to install the ESP8266’s platform packages.

The Arduino environment has to be set up to make it compatible with the ESP8266 ESP-01 module. It is required to have Arduino IDE version 1.6.4 or higher in order to install the ESP8266’s platform packages.

  1. Open Arduino IDE. 
  2. Open the Preferences window from the Arduino IDE. Go to File -> Preferences.
  3. Enter http://arduino.esp8266.com/stable/package_esp8266com_index.json into Additional Board Manager URLs field and click the “OK” button. If you already have a URL in there, and want to keep it, you can separate multiple URLs by placing a comma between them. (Arduino 1.6.5 added an expanded text box, separate links in here by line.)

  4. Open Boards manager. Go to Tools -> Board -> Boards Manager…

  5. There should be a couple new entries in addition to the standard Arduino boards. Look for esp8266. or scroll down to the ESP8266 entry (usually at the bottom). Select the ESP8266 entry. When you click it an install option will appear. Select the latest version and click install
  6. The board definitions and tools for the ESP8266 include a whole new set of gcc, g++, and other reasonably large, compiled binaries, so it may take a few minutes to download and install (the archived file is ~110MB). Once the installation has completed, an Arduino-blue “INSTALLED” will appear next to the entry.
  7. Choose your ESP8266 board. Go to Tools -> Board -> Generic ESP8266 Module
  8. You will see Generic ESP8266 Module on the bottom of the Serial Monitor window.

2. Uploading sketch to ESP8266 ESP-01 module using USB to TTL converter with DTR Pin or without DTR Pin or Using ESP01 programmer UART

  1. Do wiring.
  2. Open Arduino IDE.
  3. Plug your USB to TTL converter with DTR Pin or without DTR Pin or ESP01 programmer UAR into your PC USB port.
  4. Choose your ESP8266 board. Go to Tools -> Board -> Generic ESP8266 Module
  5. Select the correct com port.
  6. Verify and upload the blinksketch to your ESP8266 ESP-01 module. AT commands will not work after that. You need to Flash the firmware to enable them again.

3. Uploading sketch to ESP8266 ESP-01 module using Arduino Uno board

  1. Do wiring.
  2. Open Arduino IDE.
  3. Plug your Adruino Uno board into your PC USB port.
  4. Choose your ESP8266 board. Go to Tools -> Board -> Generic ESP8266 Module
  5. Select the correct com port.
  6. Verify and upload the blinksketch to your ESP8266 ESP-01 module. AT commands will not work after that. You need to Flash the firmware to enable them again.


This is the modified blink sketch. Change the pin number to 2 from 13, since there are only two GPIO pins for the ESP8266 ESP-01 module (GPIO0 and GPIO2). NOTE: Make sure that GPIO0 is grounded while uploading the code.


We have learnt how to upload sketch to ESP8266 ESP-01 WI FI module and use it with Arduino Uno to do your DIY projects.


  • No libraries required for this project.


  • You can find it on the begining of this project

Other projects of Acoptex.com
Easy CBASIC Lesson 9 Compiling and debugging in Visual Studio of Acoptex.com in Csharp 10-04-2019
Easy Basics: Project 081d ESP8266 ESP-12E module and Nextion HMI display of Acoptex.com in ESP8266 ESP-12 24-03-2019

« Go back to category
Is this project fake? Report it!   
Recommend to a friend
Published at 23-03-2018
Viewed: 2952 times