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! 🙂
Related postingsPlaystation 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"
Unity 2D Platformer - Level Generator
For some time now I have been experimenting here and there with the 2D and 3D engine Unity. Especially the programming of a 2D-Platformers has been very interesting for me. However, programming a 2D game (if you are a programmer) is not the biggest problem, but in my opinion the look, because I am not … Continue reading "Unity 2D Platformer - Level Generator"
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"
Smart Home V1 - Do it yourself
I've been planning my smart home for some time now. Besides the cost factor for all the great things I imagine, I often lack the necessary time for detailed planning and implementation. So I decided to start somewhere and write down this DIY project in parallel...let's see where it leads...I ask for your indulgence if … Continue reading "Smart Home V1 - Do it yourself"
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"