User Tools

Site Tools


elec:esp8266:nodemcu

NodeMCU

Overview

So, I got a cheap NodeMCU board from eBay. Here are some notes to get started with the ESP8266 !

Basic use

ESPTool

Grab the python script esptool from github: https://github.com/themadinventor/esptool

git clone https://github.com/themadinventor/esptool
cd esptool
./esptool --port /dev/ttyUSB0 flash_id

Output should be something like:

Connecting...
Manufacturer: e0
Device: 4016

Which means your board is working ! It's also included in the NodeMCU firmware repository

NodeMCU release

Download the last NodeMCU release from github: https://github.com/nodemcu/nodemcu-firmware/releases

Check the image

  ./esptool.py --port /dev/ttyUSB0 image_info ./nodemcu_float_0.9.6-dev_20150704.bin

Should output something like

  Entry point: 40100008
  3 segments
  
  Segment 1: 31900 bytes at 40100000
  Segment 2:  3064 bytes at 3ffe8000
  Segment 3:     8 bytes at 3ffe8bf8
  
  Checksum: 12 (valid)

If it looks okay, proceeed to the next step, Flash !

  ./esptool.py --port /dev/ttyUSB0 write_flash 0x00 ./nodemcu_float_0.9.6-dev_20150704.bin

Wait until completion…

Connecting...
Erasing flash...
Writing at 0x00070c00... (100 %)

Leaving...

Reset your board (powercycle). Connect using a serial app, like picocom

picocom /dev/ttyUSB0

And you should be ready to go ! More info on NodeMCU usage, on the github page: https://github.com/nodemcu/nodemcu-firmware

Connect to your AP

In the serial terminal:

wifi.setmode(wifi.STATION)
wifi.sta.config("SSID","password")
ip = wifi.sta.getip()
print(ip)

Output is the current IP of your board. Open a new terminal and try to ping it =)

This setting is kept in flash I guess, since it still works after powercycling the board…

Build from source

Grab the firmware from github: https://github.com/nodemcu/nodemcu-firmware

git clone https://github.com/nodemcu/nodemcu-firmware
cd nodemcu-firmware/

FIXME Todo

/home/share/www/redox.ws/wiki/data/pages/elec/esp8266/nodemcu.txt · Last modified: 2019/12/25 15:40 (external edit)