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 , 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
- How to flash the ESP8266-ESP01 - Preparation
- How to flash the ESP8266-ESP01 - Wiring Diagram
- Flashing ESP8266-ESP01 - Arduino IDE Setup
Flashing firmware of ESP8266-WiFi-Module
There are several ways to operate the ESP8266. You can address it via a serial interface, for example via 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 )
- 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 and a power supply
- Plug-in board and jumpers / cable (Male-Female and Male-Male)
- 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:
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.
If you use the ESP01 parallel with e.g. a 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! 🙂
This might also be interesting for you3D Printers: Models, Software and Options
Not just since yesterday 3D printers are a great way of printing on the market, which is constantly evolving. Here it is possible to print whole objects using software or scanned originals. This process has proven to be extremely useful both in private use and in numerous professions. In this article I have collected some … Continue reading "3D Printers: Models, Software and Options"
Training equipment: Makiwara 2.0
A Makiwara is a piece of sports equipment originating from Japan, which in karate is known mainly as a wooden hitting post. In the past (and partly still today) a makiwara is made of a flexible and non-splintering wooden board. One end of the board is driven vertically into the ground, and the other end … Continue reading "Training equipment: Makiwara 2.0"
Ikea Upcycling idea: LED lamp with WiFi remote control
Inspired by some of my last lighting projects for bedrooms and children's rooms, I had some motivation and above all time to tinker on the weekend. As with the Ikea Upcycling lamp for the children's room from the 3D printer, I wanted to turn something old into something new. This time, however, the lamp was … Continue reading "Ikea Upcycling idea: LED lamp with WiFi remote control"
Programming: PHP image captcha code
Playstation 4 / PS4 Pro Mods from the 3D Printer
The Playstation 4 was introduced in 2013 and has since been sold by Sony well over 94 million (as of January 2019) times. The slightly more powerful PS4 (Playstation 4 Pro, resolution: 3840 × 2160 and higher graphics and CPU clock rate) was launched at the end of 2016 and is still the flagship of … Continue reading "Playstation 4 / PS4 Pro Mods from the 3D Printer"