Basics: Project 109a
Project name: ESP8266 ESP-12E module – Flashing SONOFF Tasmota Firmware with Arduino IDE
Tags: Arduino IDE, ESP8266 ESP-12E module, Nodemcu v3, Lolin, SONOFF Tasmota Firmware
In this project, you needed these parts (Dear visitors. You can support our project buy clicking on the links of parts and buying them or donate us to keep this website alive. Thank you):
1. Arduino IDE ( you can download it from here )
2. Micro USB cable 1 pc
3. ESP8266 ESP-12E module 1pc
We will learn how to install Tasmota firmware on the ESP8266 ESP-12E module using the Arduino IDE and configure Tasmota to toggle the onboard LED.
Understanding the Tasmota
Tasmota is an alternative firmware for ESP8266 based devices with easy configuration using webUI, OTA updates, automation using timers or rules, expandability and entirely local control over MQTT, HTTP, Serial or KNX. Written for Arduino IDE and PlatformIO.
It was initially written for Sonoff devices, but it supports devices from many other brands like Electrodragon, MagicHome, AriLux, Blitzwolf, and Allterco. You can also install it on development boards like the Wemos D1 mini and the ESP8266 NodeMCU.
You can read more about it here.
Understanding the ESP8266 ESP-12E WI FI module (LoLin NODEMCU V3)
You can read more about it here.
Signals and connections of the ESP8266 ESP-12E WI FI module (LoLin NODEMCU V3)
TX – transmit pin. GPIO pin
RX – receive pin. GPIO pin
3V3 (or 3V or 3.3V)- power supply pin (3-3.6V).
GND ( or G) – ground pin.
RST – reset pin. Keep it on high (3.3V) for normal operation. Put it on 0V to reset the chip.
EN – Chip enable. Keep it on high (3.3V) for normal operation.
Vin – External power supply 5VDC.
D0-D8 – GPIO (General Purpose Input Output) pins
D5-D8 – SPI interface
D1-D2– I²C/TWI Interface
SC (or CMD) – (Chip Select) – the pin that the master can use to enable and disable specific devices. GPIO pin
SO (or SDO) – Master In Slave Out (MISO) – SPI communication. The Slave line for sending data to the master. GPIO pin
SK (or CLK) – SCK (Serial Clock) – SPI communication.The clock pulses which synchronize data transmission generated by the master. GPIO pin
S1 (or SD1) – Master Out/Slave In (MOSI). SPI communication. The Master line for sending data to the peripherals. GPIO pin
S2 (or SD2) – GPIO pin
S3 (or SD3) – GPIO pin
VU (or VUSB) – external power 5VDC.
A0 – ADC output.
RSV – reserved
Connect your ESP8266 ESP-12E module with micro USB cable to your PC USB port.
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 ESP8266 ESP-12E module. We are using PC with Windows 7 64 bit OS.
1.Download and install the Arduino IDE. You can download it here
2.Open Arduino IDE.
3.Open the Preferences window from the Arduino IDE. Go to File -> Preferences.
4.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.)
5.Open Boards manager. Go to Tools -> Board -> Boards Manager…
6.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.
7.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.
2. Preparing the Tasmota
1.Download the Tasmota-development.zip file from the Tasmota GitHub page. Extract it somewhere on your PC.
2.Download, install and open Arduino IDE.
3. Copy the contents of the lib folder from Tasmota-development folder to your C:\Program Files (x86)\Arduino\libraries\ folder.
4.Replace file platform.txt in Arduino IDE folder – C:\Users\Alex Bestman\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.x.x\ with file platform.txt from the Tasmota-development\arduino\version 2.6.1\.
5. Open tasmota.ino file in the tasmota folder (ex sonoff folder) from Tasmota-development. It will open all the necessary files in next tabs in Arduino IDE.
6.Open the tab my_user_config.h (ex user_config.h) and change the settings for network and WiFi. Enter the IP address or set it to “0.0.0.0” if you’re using DHCP. You can give your device a unique project name, so it will be easier to recognize between the other devices in your network.
8.Change the CFG_HOLDER parameter to a new (random) value every time you change and upload the settings to the board.If you do not change the parameter, the new settings will not take effect. The CFG_HOLDER can be found under Master parameter control.
3. Uploading sketch to ESP8266 ESP-12E development board
If you’re using an ESP-12E NodeMCU Kit, uploading the sketch is very simple, since it has built-in programmer.
Before use ESP8266 ESP-12E WI FI module (LoLin NODEMCU V3), you need to download the manufacture’s driver (CH340) for this chip and install it in your PC. Here is the link. See the description of driver installation package below: CH340 / CH341 USB to serial WINDOWS driver installation package that supports 32/64 bit Windows 10 / 8.1 / 8/7 / VISTA / XP, SERVER 2016/2012/2008/2003, 2000 / ME / 98, through Microsoft digital signature authentication, support USB to 3-wire and 9-wire serial port, with the product release To the end user. Applicable scope: CH340G, CH340C, CH340B, CH340E, CH340T, CH340R, CH341A, CH341T, CH341H chips.
2.Open Arduino IDE.
3.Plug your ESP8266 ESP-12E module into your PC USB port.
4.Choose board. Go to Tools -> Board -> Generic ESP8266 Module. Before you compile and upload the firmware first check the following board settings under the Tools menu in the Arduino IDE: Flash Size: “1M (FS:none OTA:~502KB)” , Flash Mode: ” DOUT (compatible) “, lwIP Variant: “v2 Higher Bandwidth (no features)”, VTables: “Flash”, Exceptions: “Disabled”, Erase Flash: “Only Sketch”, Espressif FW: “nonos-sdk-2.2.1+100 (190703)”.
5.Select the correct com port.
6.Select tasmota tab and click on upload button.
7. Press onboard reset (RST) button of your Nodemcu board.
8.Go to advanced-ip-scanner.com, download and install the Advanced IP scanner.
9. Open Advanced IP scanner. Click on Scan button. You will see your ESP8266 ESP-12E module IP address (we have 192.168.1.168).
10.Enter the IP address of the ESP8266 ESP-12E module in any Web browser (we have http://192.168.1.168). The Tasmota main menu will appear.
11. Once the Tasmota web interface appears, we need to change the module type from the default “Sonoff Basic” to “Generic”. Go to Configuration and choose Configure Module. Select Generic for Module Type and Save.
The module will restart. Next, we will configure the GPIOs of the ESP8266 board.
12. To test Tasmota, we will first configure the built-in LED on the ESP8266 ESP-12E module to be turned on and off by using the web interface. On this version of the board, the LED is on GPIO2 (D4). In the Tasmota interface, go to Configuration and then Configure Module. Make sure all the GPIOs are set to “None”. Then set GPIO2 to “Relay1i“. Click on Save button and return to the Main Menu. The module will restart. Please note this is valid for Nodemcu Lolin v3 module.
13.At the top of the Main Menu, you will see a button labeled Toggle. Pressing the button will now toggle the built-in LED on the NodeMCU board. This confirms that Tasmota is installed correctly and working as intended.
We have learnt how to install Tasmota firmware on the ESP8266 ESP-12E module using the Arduino IDE and configure Tasmota to toggle the onboard LED.
Thank you for reading and supporting us.
- See attachments on the beginning of this project description