Flashing SONOFF Firmware on NodeMCU
Sonoff is a WiFi controlled switch which is embedded with ESP8266 IC and has relays to control the device via the Internet. This IC can be flashed and reprogrammed by Arduino IDE. The makers of Sonoff published the libraries and Arduino files on their GitHub page. Initially, it has only for Sonoff made boards only, after that it supports many ESP8266 boards and Development boards like NodeMCU. In this tutorial, we will see how to flash the Sonoff Tasmota Firmware into the NodeMCU development boards. In the new updated firmware, you can easily choose the different ESP8266 Boards easily.
- NodeMCU Development Board
- microUSB Cable
- Sonoff Tasmota Firmware – GitHub Link
- Advanced IP Scanner
- Arduino IDE
Download the Sonoff Tasmota Firmware from this link.
If you are not installed the ESP8266 on boards manager follow this step to install it. In case you have previously installed then skip this step and continue to Cloning GitHub repository part.
Step 1: Open Arduino IDE and open Preferences. Add this URL at Additional Boards Manager URLs field – http://arduino.esp8266.com/versions/2.4.1/package_esp8266com_index.json
And click OK.
Step 2: Now navigate to Boards Manager (Tools>Boards>Boards Manager).
Step 3: Now search for esp8266 on the search bar and Install it. As I have already installed it shows in grey. You can go ahead and install.
Step 4: Now open the Sonoff Tasmota folder that we downloaded from GitHub Page. Navigate to ‘lib’ folder from extracted files and copy all the contents, then paste it into Arduino ‘libraries’ folder on your computer.
Step 5: Now Open the sonoff.ino file and then open the userconfig.h
Now edit the SSID and Password fields with your WiFi network SSID and Password. Also, give a unique name by your choice in #define PROJECT “sonoff”.
Eg. #define PROJECT “nodefactory”
Step 5: Now connect your NodeMCU and choose the correct COM Port and Board Version. Make sure the settings are like this for NodeMCU 1.0 Board.
Board: NodeMCU 1.0 (ESP12-E Module)
Flash Size: “4M(1M SPIFFS)
CPU Frequency: 80 MHZ
Upload Speed: “115200”
Then Flash the Firmware by clicking Upload.
Step 6: Once Flashing is done Open Advanced IP Scanner. And search for the IP address inside your network IP. In my case, My IP will range from 192.168.255.0-255 (Means the IP will be range from 0-255). Click scan and you can see the project name you given in the userconfig.h file as device name here.
Step 7: Note down the IP Address and paste it into your browser URL and click enter. It will show the Sonoff Tasmota page to configure your module.
Step 8: By default, it will be in Sonoff Basic. So you need to change it to ‘Generic’ in ‘Configuration’ menu. Click ‘Configuration’ and inside that choose ‘Configure Module’.
Step 9: Select the board as Generic and Save. The device will restart. This option is for all ESP8266 boards.
Step 10: Now if you click the configuration, then you can able to see more GPIO options. Using that you can select the GPIO Functions.
Depending on the GPIO setting the option will appear on the Homepage like DHT, Relay, Switch and Many more.
Other NodeMCU Tutorials: