Programmar and configure NodeMCU using firmware Tasmota

8 minutes of reading
  • Proload a device NodeMCU with firmware Sonoff-Tasmota in order to check the interfaces (therefore the functionalities) through commands and features of this firmware
  • Difficulty level: medio
Concepts dealt with:
  • flash firmware
Software components used:
Physical devices used:
GUIDE more indicated for:

All environments

Notes and disclaimer
  • qualsiasi modifica all'impianto elettrico dev'essere progettata ed effettuata da personale qualificato;
  • any changes implemented in probefore is a propersonal responsibility as well as a profirst risk and danger (the contents of the present page are purely educational);
  • any changes implemented in proprior to a device it voids the guarantee, quality approvals and certifications.
Driving review: 1.2

ATTENTION: this guide it is more than enough for the purpose of reprocalculate the component; in the event of proproblems, refer to the broader and more structured MasterGuide dedicated to the reprogrammation of devices based on ESP8266, in which many more concepts and techniques are explained.


Each electronic device contains broad lines a small piece of softwareCalled firmware, which determines its functions and behavior. Our car is equipped with firmware; it has one, the washing machine, our remote control, even a modern clock radio.

Il NodeMCU it makes no difference: designed to be a useful economic device to the realization of prototipi e proreal jets propri, it welcomes - with the only limitation linked to its available memory - any firmware conceived for its type of architecture. More information on the device is available on his card present on inDomus.

Objective of this guide and the programmation of NodeMCU via firmware Sonoff-Tasmota, one of many proOpen Source jets available online, from us (and many) preferred to others in terms of functionality, support from the community and breadth of supported devices.

To do this it is necessary a computer, a connection device between the computer and the NodeMCU (Called USB / TTL adapter) and a software on the computer (in this case we will use "ATOM") to perform the procedura of proprogramming.

Use Sonoff-Tasmota (which, as suggested by the name, would be born for the reprogrammation of family members ITEAD Sonoff Smart Home) For programmare a NodeMCU it's a good idea since the adoption of this firmware allows easy controlalmost elementary, of the physical interfaces of the NodeMCU, making it so easy to use even for procomplex jets (and can be integrated into home automation via HUB personal).


  1. Description prosubsidence
  2. Installation and configuration ATOM & PlatformIO
  3. Checking the COM port assigned by the computer
  4. Firmware download and configuration on PlatformIO Tasmota
  5. Connection of NodeMCU in flash mode
  6. Upload the firmware to the device NodeMCU
  7. How to update OTA (over the air) a Sonoff

Description prosubsidence

For programmare a NodeMCU it is necessary, first of all, to install and configure ATOM, after which:

  • download the firmware Tasmota;
  • connect (not in flash mode) the Sonoff toUSB / TTL adapter and, opening the "Serial Monitor" find out which COM port is automatically assigned, then disconnect the NodeMCU;
  • configuration the two configuration files, "platformio.ini" and "user_config.h";
  • carry out compiling or performing the "Build" (in case of errors, correct and re-compile themprovare);
  • connect il NodeMCU to the USB / TTL adapter in flash mode;
  • carry out the Update Searchnamento, or "Upload".

Let us now go into detail.

ATOM installation and configuration

Download and install the software ATOM at this link: This software is available free of charge for all major platforms (Apple, Windows and Linux). Once installed, it must be configured by installing the additional package called "platformhyoid"
To do this, go to:

  • Mac OS X, Menu : To Tom > Preferences > install
  • Windows, Menu : File > Settings > install
  • Linux, Menu : Edit > Preferences > install

and in the search hole search, appanointed, "platformhyoid". Once you have found the package, click on Install.

scroll to thank
Nb The installation of Atom + platform-io may include the installation of additional add-on packages, such as Python. Should the installer ask for these additions, prov to meet your request (under penalty of failure to functionnamenext part of the tool).

After installation, close and reopen ATOM, which at this point will start the PlatformIO package by default, necessary for riprocalculate NoceMCU. The software prowill be able to install a series of additional packages completely automatically.

At the end, PlatformIO will ask to restart for one last time ATOM.
(Ed. From here on we will refer directly to PlatformIO, meaning it as ATOM + PlatformIO.)

Checking the COM port assigned by the computer

An adapter USB / TTL (FTDI) is a simple device that allows us to put in communication our computer and the heart of the device NodeMCU. The adapter, which can vary in shape and color, has a USB port as a base and four contacts, which they go contacted with those present on the board of NodeMCU using gods Dupont connection cables.

The contacts to be used on the board NodeMCU they are the first four in the lower right corner in the following figure (which rappresents the NodeMCU seen from above with the microUSB port facing down and the antenna Wi-Fi towards the other):

NodeMCU - Connection scheme - 4 pin

How to connect NodeMCU and USB / TTL adapter:

  • connect the pin that supplies the output voltage (VCC) of the USB / TTL adapter on the first pin of the NodeMCU ("3.3V"), Making sure that (if present) the voltage selector of the USB / TTL adapter is set to 3.3V and not on 5V. If the adapter can deliver at the outlet alone 5V, use the first pin on the left of the image ("Vin");
  • connect the neutral in output (GRN) from the USB / TTL adapter to the second pin of the NodeMCU ( "GND");
  • connect the "TX" pin of the USB / TTL adapter to the "RX" pin of the NodeMCU ("GPIO 03");
  • connect the "RX" pin of the USB / TTL adapter to the "TX" pin of the NodeMCU ("GPIO 01");

Connect therefore the module NodeMCU to the USB / TTL adapter and it, in turn, to a USB port on the computer via the cable.
Then select the menu item "PlatformIO> Serial Monitor"

A fi will opennestlike the following:

After a moment, in the entry "Port (The Harbour District)”Will indicate which COM port the computer has assigned to the USB / TTL module.
Take note of it.
Now disconnect the module from the USB port.

NOTE for users Apple: Atom, su macOS, could identify a different port from the classic COMx. To understand how to configure the door in this series, refer to to this thread (valid for the modules Sonoff but similarly also for NodeMCU). Beyond what is expressed in the link, always remember to install the correct driver for Mac by the profirst USB / TLL adapter.

After installing the correct driver, in the system report of the Mac, under USB, you will need to (by connecting the USB / TTL adapter) a voice as follows:

FT232R on Mac

Firmware download and configuration on PlatformIO Tasmota

At this point it should be downloaded the latest firmware version Tasmota.
Once downloaded, unzip the .zip file where you prefer.

Now, in the PlatformIO menu, select "Fillet > add Project Folder"And then select the folder where the zip file mentioned above has previously been unzipped.

By doing so, PlatformIO will open the projet Tasmota.

At this point it is necessary to "configure" the software package. In fact it is provided "basic", without customizations, which are necessary so that, at the end of the programmation, the NoceMCU can operate correctly.

Specifically, the proprocess is the following:

  • choose as a firmware component Tasmota fill in ("sonoff"Is the basic package that interests us;
  • indicate the name and password of the Wifi in which the NodeMCU will have to "enter" automatically once programmato and lit;
  • indicate the COM port to be used for data transmission (identified to the previous step of the guide);
  • fill in the firmware;
  • write on the device.

To choose which part of the firmware to compile, open the file on PlatformIOplatformio.ini"And make sure it is configured only"default_envs = tasmota”As in the image:

To Tom -

The items commented below identify the alternatives, namely the compilation or a minimal part of the firmware (“default_envs = tasmota-minimal") Or full language versions ("default_envs = tasmota-E"Is the Italian one), or the standard one (appanointed, as suggested above, "default_envs = tasmota“).

Search for the item "upload_port =") And enter the previously identified COM as a value to the previous step.

Once completed, save and close the file.

Now you need to configure name and password of our Wifi.

Open the file "tasmota/my_user_config.h"And find the variables:"#define STA_SSID1" is "#define STA_PASS1"

Atom - user_config.h

Enter the name there was originally the proman Wi-fi and the related password. Save and close the file.

Now we are proto "compile" our firmware package. Click on the menu "PlatformIO> Build"
If the procedura will be successful, you should get a screen similar to this:

scroll to zoom

The package is completed e proto be sent to the device.

Nb. the action of compiling ("Build") the firmware Tasmota translates into the creation of a file ("firmware.bin") At the route"% directorycontenentetasmota/.pioenvs/tasmota". This information is useful when you want to do the next onenamento OTA (Over-The-Air), which asks to indicate the file "firmware.bin" of the new version of the signature that has been previously compiled.

A dedicated guide is available here all'aggiornameof the devices equipped with firmware Sonoff-Tasmota through a single centralized operation, via TasmoAdmin.

Connection of NodeMCU in flash mode

To make sure that the NodeMCU accept "in input" a new firmware it is necessary set it in "flash" mode.
To set a NodeMCU in this mode, the sequence is as follows

  • connect the NoceMCU to the USB / TTL module (as explained before);
  • hold down the "FLASH" button on the NodeMCU
  • connect the cable to the computer's USB port;
  • release the "FLASH" button.

At this point (e alone at this point, if you have done everything right), the NodeMCU Sara proto receive our firmware package Tasmota previously configured and compiled.

If the upload (prossimo paragraph) failed, riprovate this procedura again.

Firmware upload on NodeMCU

At this point it will be sufficient to select on the menu “PlatformIO> Upload”To start the phase programmation e proere. If at the end of procedura read "SUCCESS" (similarly to the firmware compilation screen), then good, you will have done correctly the first custom configuration of yours NodeMCU. In the case instead the procedura fail, repeat the steps above, taking care to carefully check the configuration of the COM, of the connections and all operational sequences.

Now that the procedura has been successful, it is necessary to verify that everything works properly. Disconnect the USB cable and then reconnect it immediately, this time WITHOUT hold down the "FLASH" button: this will cause the NodeMCU is powered up and starts functioning normally without going into the mode proprogramming.

At this point the NodeMCU it will be on and should access the Wi-Fi, as already informed of the access coordinates (see point 2 of the guide). To cling to it, however, it is necessary to find out which IP our router has assigned to it, something we cannot know in advance.

To do this, click on "PlatformIO> Serial Monitor”And, in the following screen:

select "Baudrate" to set "115200", while the "Port" field should automatically configure.
By clicking on "Start" dovrebbe appenter a screen as follows:

scroll to zoom

which should indicate the IP obtained from NodeMCU when it entered the Wifi network, in this case "". Now, opening up any browser on the proyour computer, enter the address the IP just obtained and press enter.

If all went well, dovrebbe appenter a screen as follows:Compliments!
Il NodeMcu is correctly reprogrammato with the firmware Sonoff-Tasmota.

As can be seen from the image, the model is shown aboveSonoff Basic", As the firmware Tasmota is still configured in default mode. You will then need to enter the menu "Configuration" > "Module Configuration" and choose the most suitable model based on the device in use.

In this case, as this is NOT an ITEAD component, the configuration relative to the configuration will be "Generic", as shown in the following figure:

Sonoff-Tasmosta - Generic Module

As you will notice, after setting the module in "Generic" mode appa list of 11 configurable elements will appear which logically depict the equivalence of physical pins (GPIO) present on NodeMCU.

NodeMCU - Connection scheme - Usable pins from Sonoff-Tasmota

Based on the use you will make of NodeMCU, these entries will be useful for logically configuring what - on the physical plane - we will connect and want to check means NodeMCU and firmware Sonoff-Tasmota.

How to update OTA (Over The Air) a NodeMCU

To update un NodeMCU previously proprogrammed Tasmota it's enough fill in the updated version of the firmware Sonoff-Tasmota (or this passage of this guide) and recover the file "firmware.bin"(See the item" take note "at the end of the indicated passage).

Indeed you must first compile the "minimal" firmware ("default_envs = tasmota-minimal" In the file plaformio.ini), set the file aside "firmware.bin”Resulting, recompile the“ complete ”firmware (“default_envs = tasmota”- or distribution language - In the file plaformio.ini) and set the second file aside "firmware.bin"

Next, connect via web browser to Sonoff e select "Sign Upgrade".

Under the heading "Upgrade by file upload", Select the file"firmware.bin"Above concerning the" minimal "version, then click the" Start "button upgrade"And simply wait for the transaction to finish. At the end, reconnect to the web interface and redo the procedura, this time passing it the file "firmware.bin”Of the“ complete ”firmware.

A dedicated guide is available here all'aggiornameof the devices equipped with firmware Sonoff-Tasmota with one centralized operation, via TasmoAdmin.


Stay up to date through ours Telegram channel!