Flashing firmware - ESP8266-WiFi-Module

Arduino - Flashing Firmware Esp8266

Since I recently started to deal more intensively with the topics "Smart Home" and "Home automation" I decided to publish some of my construction sites, stumbling blocks and solutions here. As already mentioned in the article about my Smart-Home-Project V1 I use the WLAN module ESP8266 ESP01 ESP8266 ESP01, because it is small, reliable and cheap.

In this article I want to show how to put the ESP01 into flash mode and build a circuit to feed this small WLAN module with the Arduino IDE with its own code.

IMPORTANT: Please read on only if you know what you are doing! When flashing, some things can go wrong, for damages etc. I assume no liability! Use the manual, circuit diagrams, code etc. only at your own risk!

Table of contents:

Flashing firmware of ESP8266-WiFi-Module

kraken.jpgThere are several ways to operate the ESP8266. You can address it via a serial interface, for example via Arduino Arduino. Alternatively, the ESP8266-ESP01 offers 1MB flash memory and 2 additional GPIO pins, so you can use it alone (standalone mode) and don't have to use another microcontroller.

I decided to use a mix of the two operating modes to control the living room via app, because the 2 pins on the ESP01 are not enough for me and on the other side of the Arduino UNO has relatively little memory and resources.

The ESP8266 was flashed with my own code and now controls all communication with the app and e.g. the Horizon recorder. The chip only forwards the actual control command for LED lighting and e.g. infrared (TV, HiFi) via serial interface to the Arduino, which then only switches the corresponding pins.

How to flash the ESP8266-ESP01 - Preparation

To flash the ESP8266 you need some hardware and software components:

  • USB to TTL converter module FT232RL 3,3V/5V - (FTDI Serial Adapter FTDI Serial Adapter)
  • 2K Ohm Resistor
  • 1K Ohm Resistor
  • Push-Button (must be pressed and held down later when switching on the ESP8266 to start the ESP8266-ESP01 in flash mode; the push button connects GPIO 0 of the chip to Ground)
  • Power Supply Module 3,3v/5v Power Supply Module 3,3v/5v and a power supply
  • Plug-in board and jumpers / cable (Male-Female and Male-Male)
  • ESP8266 ESP01 ESP8266 ESP01
  • Arduino IDE (ich nutze 1.8.5; Stand: Januar 2018)
  • Virtual COM Port Driver (i use Win10 for flashing, because MacOS only causes problems for me)

How to flash the ESP8266-ESP01 - Wiring Diagram

The circuit to flash the ESP8266-ESP01 looks like this:

ESP8266 flash circuit - wiring diagram

When put together, the whole thing looks something like this:
arduino esp8266 flash prototype

Arduino - Flashing Firmware Esp8266If you often have to flash an ESP8266, I recommend to solder this construct and to make a small case if necessary.

Such a flash station is practical because then nothing can come loose unintentionally and you can simply put the part somewhere in the cabinet when you don't need it.

If necessary, just take it out, put the USB cable and power in, put the chip on top of the docking station and everything is ready to flash.

Flashing ESP8266-ESP01 - Arduino IDE Setup

As described above I use the official Arduino IDE to flash the ESP01 chip. First you have to prepare the Arduino IDE for flashing, so that the environment knows and can handle the chip.

To do this, click on "Settings" in the main menu and enter the following in the field "Additional board administrator URLs":

Then select the menu point Tools -> Board -> Board administrator. Enter "esp8266" into the search field and install the appropriate package. Then you can select "Generic ESP8266 Module" under the menu item Board.

Since I had some problems with flashing at the beginning, I also list my configuration here. On the internet I found several different Configs, but I stayed with this one which works stable and error free. First I flash only under Windows 10 with installed Virtual COM Port Driver, because as already mentioned above Mac here made some problems since the update to HighSierra.

If you have now selected the board "Generic ESP8266 Module" you can now see several settings under this menu item. The main points in my config are as follows. Among other things I had to reduce the upload speed a little bit to be able to complete the write process into the SPI flash memory successfully:

  • Flash Mode: DIO
  • Flash Size: 512K (64K SPIFFS)
  • Reset Method: ck
  • Upload Speed: 57600
  • Port: COM4

Now you can program your Sketch (*.ino) within the Arduino IDE and write or flash the chip with it.

kraken.jpgIf you use the ESP01 parallel with e.g. a Arduino UNO R3 Arduino UNO R3, and if you want the two to communicate via a serial interface (TX/RX), I recommend a baud rate of only 9600, which is sufficient for smaller amounts of data or commands and you can confidently use SoftwareSerial (or AltSoftSerial), because they do not create a stable higher data throughput.

This is because the Arduino UNO, for example, only has a hardware interface for serial transmission (Pin 0 and 1 -> TX/RX). Especially when debugging and uploading, it is used on the Arduino for the USB connection to the PC, so that in my opinion it's better to directly use SoftwareSerial (or another library like AltSoftSerial) and let the ESP8266 talk about it with the Arduino.

That's it - send me feedback and suggestions by mail or leave a comment here at the website. Have fun progging your own smart home solutions! 🙂


Author: Sascha from Tinkering-Sascha.com

Author: Sascha

Some words about myself. My name is Sascha - i'm a software developer and martial artist from germany. Besides programming and martial arts some of my interests and hobbies are cooking, fitness and hearing loud heavy metal music. :D

This might also be interesting for you

3D Printing - 27 Inch iMac Stand Repair

As already known for a long time, the stand of the iMacs (27 inch) from 2012 to mid-2014 is often broken. With these models it happens (not all of them) that the hinge is worn out and the screen position can't be changed anymore or, as in my case, the screen constantly tilts forward. 3D … Continue reading "3D Printing - 27 Inch iMac Stand Repair"

Experiment: Hacking Ethereum Wallets - Bruteforce

Some time ago I came across a YouTube video by chance with the title: "Eth Wallet Bruteforce Hack". A programmer showed a simple Python script which could generate a random private key (64 characters / 32 bytes / 256 bits). This was used to calculate the public-key and address and pass it to a blockchain … Continue reading "Experiment: Hacking Ethereum Wallets - Bruteforce"

Program your own Screen Recorder / Capture Software

While searching for an easy to use screen recorder tool, I stumbled across all kinds of free and paid software solutions. From my point of view, pretty much all of them were either completely overloaded, difficult or complicated to use. Others were just expensive in relation to the functionality. My conclusion: Program yourself! Table of … Continue reading "Program your own Screen Recorder / Capture Software"

self-construction - DynDNS-Alternative

If you already have your own webserver/webspace on the Internet and some programming knowledge, you can save yourself a service like DynDNS.org & Co. without much effort if you want to access parts of your home network from the road. Such services provide a host name/URL (e.g. my-home-network.dyndns.org) which is then forwarded to the IP … Continue reading "self-construction - DynDNS-Alternative"

Telegram Messenger and the Bot API

Telegram is basically a messenger similar to Whatsapp or Threema , free and easy to use. I don't want to say that it is better or worse than other messengers, but I like the Telegram Bot API so much that I want to write a little tutorial here. Table of contents:Using Telegram Messenger and the … Continue reading "Telegram Messenger and the Bot API"

Leave a Reply

Your email address will not be published. Required fields are marked *

I have read and accepted the privacy policy!