If you buy one on eBay, chances are it will NOT be flashed with NodeMCU firmware (it speaks Lua). This understandably confused the crap out of me. So, this serves as a guide to those running Manjaro (Arch) Linux:
- Download NodeMCU firmware
"integer" versions will NOT understand floating point arithmetic, but save on system resources. - Install minicom
pacman -Ss minicom
- Install esptool from the AUR:
yaourt esptool-git
- Make sure your Linux box recognizes the device
tail -f /var/log/messages.log
- Plug in the NodeMCU device. You should see:
kernel: usb whatever: ch341-uart converter now attached to ttyUSBX
ch341-uart converter detected
If this didn't happen, you cannot proceed and must troubleshoot. - Flash the firmware. Make sure you have permission to read and write to the device in the command below. When in doubt, run as root:
esptool.py --port /dev/ttyUSBX write_flash 0x00000 nodemcu_whatever.bin
where:
X corresponds to the device from the log file above, and
nodemcu_whatever.bin corresponds to the firmware file in step 1. - Unplug the USB cable after the flash command from the previous step is completed, and plug it back in.
- Fire up minicom, and talk to the board at 9600 baud:
minicom -D /dev/ttyUSBX -b 9600
- Press the "enter" key a few times. In response, you should see:
>
> - Try "hello world":
> print ("hello world")
hello world
>
- Now you can configure wireless:
> wifi.setmode(wifi.STATION)
> wifi.sta.config("SSID", "PASSWORD")
> ip, nm, gw=wifi.sta.getip()
> print (ip, nm, gw)
this is amazing - Do some interesting things!
Hey,
ReplyDeleteThanks for the succinct list of steps to get nodeMCU running, the arch way. The other stuff is all arduinoesque, and it is too 'easy' for my liking.
I also liked your 'click the ads, but you should install an adblocker'. I diabled Privacy Badger just so I could see the ads in all their glory. They were for an Azure dashboard. I don't think I want that :)
ST33V