Getting NodeMCU running on an ESP-01 module in 2016

Introduction

I tried to install NodeMCU on an ESP8266 with the help of my article from January 2015 but I had some problems to do so. So I write a new article with a new approach, which works today.

Connection

For the connection, we need a serial interface. I use an FTDI UM232R module for this. To define the numbers on the ESP-01 module I use this drawing I created:

esp-01 pin numbers
Pin numbers for ESP-01
  1. GND
  2. UTXD
  3. GPIO2
  4. CH_PD
  5. GPIO0
  6. RST/GPIO16
  7. URXD
  8. VCC

You need at least three signals from your serial interface to the ESP-01 module. The signals are ground, RxD and TxD. The 3.3 V supply voltage comes from my programmable power supply. The updated connection list is shown above.

VCC   -> 3V3
GND   -> GND
RST   -> 3V3
CH_PD -> 3V3
URXD  -> DB0 (UM232R)
UTXD  -> DB1 (UM232R)
GPIO0 -> GND
GPIO2 -> floating

The jumper JP1 on my UM232R module is set between Pins 1 and 2 which defines 3.3 V for the IOs.

Preparations for flashing NodeMCU on an ESP8266

First, we need the NodeMCU firmware. In the previous article, you could download a pre-built binary from the GIT repository. I didn’t found a pre-built firmware on the repository today, so we have to build our own. Luckily there is an easy online firmware builder: nodemcu-build.com.

You have to enter a real email address because you get your firmware download link via mail. I choose the master branch for my build and leave the default modules checked for a quick test. Then you have to click the “Start your build” button on the bottom of the page and wait until you got mail. I got two versions in the mail. One is labeled as an integer version and one as a float version. For this article, I’m using the integer one.

Flashing NodeMCU on an ESP8266

To flash the actual firmware I used a tool called nodemcu-flasher. I downloaded the 64bit version.

Use the following procedure:

  • Connect your ESP-01 module to your serial interface
  • Connect your module to a 3.3 V supply
  • Set your GPIO0 to GND on power-up
  • Set CH_PD to VCC for enabling the module
  • Check that your serial interface is recognized by your OS

Now you can start the nodemcu-flasher. The tool will flash an integrated NodeMCU firmware by default, which can be outdated. Go to the “Config”-tab to select the new firmware you just created in the step before.

nodemcu firmware config default
Default configuration settings
Own configuration
Own configuration

Go to the “Operation”-tab and press the “Flash (F)” button to start the flash operation. The AP MAC and STA MAC should display correct values. If not and the progress bar doesn’t move, turn your module off and on again to enable flash mode. You should wait until the progress bar is fully filled during the flash operation.

NodeMCU flashing in process
NodeMCU flashing in process
NodeMCU flashing done
NodeMCU flashing done

Check your firmware

After flashing we need to check if the firmware is working. First of all, turn off your ESP-01 module. Furthermore, remove GPIO0 from the ground so we can start the normal operational mode. Finally, power the module on again. Connect with your terminal software to the serial interface which connects to your module. The baud rate has to be 9600.

For testing purposes, I connected a red LED and a 470Ohm resistor in series to ground on GPIO2. In your terminal software, you set GPIO2 to an output. The GPIO2 has the IO pin defined to 4! Your terminal should show something like this:

NodeMCU custom build by frightanic.com
branch: master
commit: c8037568571edb5c568c2f8231e4f8ce0683b883
SSL: false
modules: node,file,gpio,wifi,net,tmr,uart
build built on: 2016-01-24 10:52
powered by Lua 5.1.4 on SDK 1.4.0
lua: cannot open init.lua
>

So, now enter the following line to set the IO pin to an output:

gpio.mode(4, gpio.OUTPUT)

The following command will write a 1 to our GPIO, as a result, we get a HIGH level on the GPIO:

gpio.write(4, 1)

If you write a 0 to the write function, you get a LOW level on the GPIO:

gpio.write(4, 0)

If you can control the LED with this commands, congratulations, your NodeMCU firmware works.

Here you can find other NodeMCU related posts.

2 thoughts on “Getting NodeMCU running on an ESP-01 module in 2016”

Leave a Comment