Close
0%
0%

Setup & Update the ESP8266 - Getting Started Guide

Update the ESP8266 and connect it to Arduino IDE. A beginner tutorial for later use with Arduino and OpenHAB in my Home Automation series.

Similar projects worth following
This is a tutorial for beginners looking forward getting in the world of the ESP8266 module. I will show you how to connect, talk and update the ESP8266 01 module for later use in my Home Automation series and how you can upload your own programs to it. As this tutorial goes there will be links on the other more detailed ones by the more educated people so you can better understand how it all works.

For all ESP8266 modules most of this tutorial remains the same, if you have difficulties leave a comment.

I will be updating this project with links to my other Home Automation ones as I make and upload them in the future.

The ESP-01 acts as a small computer. Depending on the version of the ESP8266, it is possible to have up to 9 GPIOs (General Purpose Input Output) but our 01 version has only 2 of them. Thus, we can give a microcontroller internet access like the Wi-Fi shield does to the Arduino, or we can simply program the ESP8266 to not only have access to a Wi-Fi network, but to act as a microcontroller as well so you dont need to use a separate one like Arduino and that is is awesome.

When I first got the ESP8266 which will be the core of my Home Automation project because it will talk to the Raspberry Pi and the other modules via wifi I noticed that I screwed up by buying the oldest model. Watching the old tutorials for the ESP before buying it everyone was talking about the ESP-01 model and that is the oldest of them. So it has limited I/O (Input / Output) pins compared to the new models that come with the same price. Basicly the ESP8266 family consists of about 16 versions at the moment, you can read the specs for each version here:  http://www.esp8266.com/wiki/doku.php?id=esp8266-module-family

I recommend you to buy, if you have not already the ESP-12F version because it is almost the same price like the ESP-01 model but has way more GPIOs and functionality. The tutorial for the 12F version is coming when I get the module.

The UPDATE FIRMWARE part of this tutorial starts on step 6 in the instructions section.


Links for buying everything mentioned in this tutorial are in the PARTS section.

AMS1117 3.3V - Schematic diagram.PNG

The schematics diagram shown in the instructions.

Portable Network Graphics (PNG) - 29.52 kB - 08/09/2017 at 10:42

Preview
Download

ESP8266 - Flash files.zip

ZIP file containing the ESP8266 Flash tool and AT firmware.

x-zip-compressed - 14.04 MB - 08/09/2017 at 10:42

Download

View all 7 components

  • 1
    Making an Adapter and Power source for the ESP-01

    Looking at the 01 version we see that it is not very breadboard friendly so we have to make an adapter for programming. You could buy one on ebay for a few cents but waiting one month just for shipping is silly because you can make one in 5 minutes.

    I made my adapter using male and female headers soldered on a tiny 4x4 square cut out of a prototype PCB. You could also use female to male jumper wires as many people do but I don't have them. As a last resort theoretically you can just solder wires to it (like we will have to do on the 12F version) but it is rather messy and you could short something.

    The ESP8266 runs on 3.3V and consumes anything from 20 to 250 mA so to properly power the module you must get a power supply that can deliver that amount of current or the ESP will be unstable if it works at all. Do not even try to connect it to the 3.3v pin on the Arduino or the FTDI breakout because it can't deliver that amount of current. For example if you have an old PC power supply you can use that or in my example use a voltage regulator, because I will fit these module in my wall switch so it has to be a small one. The AMS1117 3.3V version is the perfect coise, it is small and can deliver up to 1A. I have connected its input to the 5v pin of the Arduino and here is the schematics (capacitors are there for smoothing and decoupling, you don't need to use the exact same values but it's recomended):

    C1 10uF - for stabilizing the input
    C2 0.1uF or 100nF - decoupling, must be placed near the voltage regulator
    C3 100uF - for stabilizing the ESP8266 input
    C4 0.1uF or 100nF - decoupling, must be placed near the ESP8266

  • 2
    Communication Setup

    If you can successful power up the module it's time for the next step, setting up a communication to the PC. The easyest way is to use a FTDI Breakout board (link in the project components list) or using an Arduino Uno as a Serial programmer.

    1. Using a FTDI Breakout board

    Communication on the module is using 3.3V (it is not 5V tolerant, not even the RX pin!) so if you happen to have a FTDI breakout that has an on board jumper for voltage selection (like mine) set it to 3.3V and you can skip the 2 resistor and connect the RX line from the ESP directly to the TX on the FTDI. If your programmer uses 5V for communication connect everything as the picture shows. The resistors form a voltage drop so the 5V signal from the FTDI board gets "converted" to 3.3V.

    2. Using Arduino Uno

    To use an Arduino as a USB to Serial converter you must disable the onboard Atmega chip. There are 3 ways:

    • Connect the RESET pin to GND or
    • Upload a Sketch (The sketch basically stops the Atmel chip to interfere the communication between FTDI chip (on the Arduino board) and your other device)
      void setup(){  
      pinMode(0,INPUT);  
      pinMode(1,INPUT);
      }
      void loop(){
      }

       or

    • Remove the Atmel Chip (If you have the SMD version you can't do this)

    The original post is HERE.

    And now just instead of connecting the TX and RX line to the FTDI board as the picture above shows, you connect it to the Arduino (be sure to conncet the two resistors as on the picture because the Arduino uses 5V serial communication).

    Arduino UNO - Pin 0 goes to the RX of the ESP and pin 1 to the TX of the ESP.

    Pins explanation:

    •     TXD (goes to the 3.3V Rx of the Programmer)
    •     CH_PD (enable/power down, must be pulled to 3.3v directly or via resistor)
    •     REST (reset, must be pulled to 3.3v, not necessary but recommended)
    •     VCC (3.3v power supply)
    •     GND (connect to power ground)
    •     GPIO 2
    •     GPIO 0 (leave open or pull up for normal, pull down to upload new firmware)
    •     RXD (goes to the 3.3V Tx of the Programmer)
  • 3
    Lets do it

    For communication to the module we are using Arduino IDE, it's simple and it has a Serial monitor. We first need to install the ESP board so the software recognizes our board (If you have not already installed Arduino IDE you can go HERE and install it yourself, there are many tutorials online on how to do that.).

    To begin, we’ll need to update the board manager with a custom URL. Open up Arduino IDE, then go to the Preferences (File > Preferences). Then, towards the bottom of the window, copy this URL into the “Additional Board Manager URLs” text box:

    http://arduino.esp8266.com/stable/package_esp8266com_index.json  

    Hit OK. Then navigate to the Board Manager by going to Tools > Boards > Boards Manager. There should be a couple new entries in addition to the standard Arduino boards. Look for esp8266. Click on that entry, then select Install. 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

    Or you can read the full detailed tutorial.

    Select “Generic ESP8266 Module” from the Tools > Boards menu, then select your FTDI’s port number (if you are programming your module with Arduino select the Arduino Uno port number) under the Tools > Port menu (if your FTDI board port isn't listed in most cases you will need to install the appropriate drivers for that particular board and there are plenty tutorials online for that.).

    Everything is setup now, go to Tools > Serial Monitor, set the baud rate to 115200, restart your ESP8266 and there should be a "ready" message. If everything is ok when you type "AT" and press send you should get a "ok" message. With sending these simple AT commands you can control the ESP, HERE is the list.

    If you try setting up the baud rate to 76800, when you power up the module it will list some debug messages, that is not the right baud rate of your board because you must find the one on witch you get the "ready" message.

View all 6 instructions

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates