Basics: Project 133
Project name: How to flash NodeMCU firmware
Tags: How to flash NodeMCU firmware, NodeMCU, firmware, ESP8266, LUA scripting language, LOLIN NodeMCU V3
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):
- NodeMCU development kit (ESP8266 ESP-12E WI FI module) with micro USB cable 1pc
We will learn how to to flash the new nodeMCU firmware into a ESP8266 ESP-12E WI FI module (LoLin NODEMCU V3). This is also useful to get back to the LUA interface if you were uploading C/C++sketches using the Arduino IDE – which overwrites NodeMCU Lua data.
This DIY project allows you to switch between Lua scripting and Arduino IDE programming easily – just by reprogramming the ESP8266. Lua installation on an ESP8266 will allow you to use the LUA scripting language in an interactive terminal. This means code upload is far faster than the Arduino IDE compile-link-upload process. Although scripting languages are slower the processor is fast (which compensates for scripting speed) and you don’t wait around for an upload as you do with the ESP8266 Arduino IDE – and Arduino IDE uploading takes about a minute so making small frequent changes is a very challenging. With scripting – upload is a few seconds and you’re done. The only disadvantage is that its not C so you’re going to have to learn something a bit different. The main difference is that in Lua you use event driven programming.
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)
The board used for experiments here is the Lolin NodeMCU V3 which has a very convenient USB interface that allows you to plug it into a PC – power is supplied from the USB port – but you will need up to 300mA~400mA (depending on the WiFi activity!) so don’t use a hub (unless it has a good power source), use a PC USB port or you might need an external power source. You can add an external power source to the Vin connection on the board with voltage >5V. Also connect ground labelled ‘G’ to complete the circuit. Warning: The AMS1117 absolute maximum input voltage is 15V.
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
Wiring is very simple – just attach micro USB cable to micro USB port of NodeMCU development kit (ESP8266 ESP-12E WI FI module) and plug in the USB cable to your PC/laptop USB port.
To enable ESP8266 firmware flashing GPIO0 pin must be pulled low before the device is reset.
If you have a NodeMCU development kit (ESP8266 ESP-12E WI FI module) then you don’t need to do anything, as the USB connection can pull GPIO0 low by asserting DTR and reset your board by asserting RTS.
If you have an ESP-01 or other device without built-in USB, you will need to enable flashing yourself by pulling GPIO0 low or pressing a “flash” switch, while powering up or resetting the module.
Step by Step instruction
1.Do wiring. Plug your NodeMCU dev kit into your PC/Laptop USB port.
2.Download and install the manufacturer’s driver. 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. If you have CP2102 chip then you need to download the manufacture’s driver for this chip and install it in your PC. Driver for Mac, Windows, Linux or more..
3.You can find out which port your NodeMCU dev kit is attached to by going ot Control panel -> All Control Panel Items->System->Device manager on your Windows OS to find the following screen (we have COM8 occupied by NodeMCU):
4.Download NodeMCU Pyflasher to install NodeMCU firmware here. You need to choose the correct version for your Windows OS – 32bit or 64bit. No installation required, you can just double-click and use this software.
5. Go to the https://nodemcu-build.com/ website and type your email address.
6. Keep the default options and click the Start Your Build button and wait for the binary on your provided email account (for the default settings this takes ~2 minutes). Please note: You can see the functions available for each module by clicking on the book symbols next to each check box. The idea is to include those you need since space is limited on the ESP8266.
7. Go to your email box and check for email with the binary files. Download the float version of your binary – this is recommended even though it uses more memory but is up to you.
8. Open NodeMCU Pyflasher. Required settings. Select serial port your NodeMCU attached to (we have COM8), select NodeMCU firmware which you downloaded from email box(float version, we have nodemcu-release-7-modules-2021-02-16-09-11-15-float.bin), select baud rate – 115200, choose flash mode – Dual I/O (DIO), choose Erase flash – yes, wipes all data. pLEASE NOTE: Flash-mode is Quad I/O (QIO) for most ESP8266 ESP-01/07 (512 kByte modules) and Dual I/O (DIO) for most ESP32 and ESP8266 ESP-12 (>=4 MByte modules). ESP8285 requires Dual Output (DOUT).
9. Click on Flash NodeMCU button.
Please note: When you start the serial terminal this Lua interface uses 115200 baud not the 9600 as the previous version used. The ESP8266 does not start immediately – When you first start it it will format the ESP8266 file system – takes about 40 seconds.
10. Flashing of the new firmware for NodeMCU completed. Let’s test it with ESPlorer. Download the software here and unzip it. Double-click on ESPlorer.bat.
11. Select COM port your NodeMCU attached to (we have COM8), baud rate – 115200 and click on Open button.
11. Press reset(RST) onboard button of your NodeMCU dev kit. You will see the similar message in ESPlorer terminal.
12. Type the command print(‘Hello World’) in the window on the left and click on Send to ESP button. It will respond with: Hello World >
13. Congrats! You did it. You can do any project with Lua now.
You can read more about the flashing here: https://nodemcu.readthedocs.io/en/master/en/flash/
We have learnt how to to flash the new nodeMCU firmware into a ESP8266 ESP-12E WI FI module (LoLin NODEMCU V3).
Thank you for reading and supporting us.
- See attachments on the beginning of this project description.