Skip to content

Latest commit

 

History

History
79 lines (60 loc) · 2.42 KB

2016-06-02-NodeMcu-Setup.md

File metadata and controls

79 lines (60 loc) · 2.42 KB
layout title excerpt categories comments
post
NodeMcu Set Up on Mac OS
How to start a project with NodeMcu in Mac Environment
Lua NodeMcu Mac
true

Install Linux Flasher Tool

 pip install esptool

More info.

Download the Latest Version of NodeMcu

Get a custom build from here

Install CH340G Driver for Flashing the board

The driver can be downloaded from this link

Once the driver is properly installed, you can connect the board to a USB port on mac. Then find out the serial port name by running cmd ls -l /dev/tty.*

The connected port showed up as /dev/tty.wchusbserial1420

Flash the Downloaded NodeMcu Image to the Board

Use esptool.py to flash the binary onto the board.

# Command is written in this format
esptool.py --port <USB SERIAL PORT NAME> write_flash -fm dio -fs 32m 0x00000 <image_name>.bin

# For example
esptool.py --port /dev/tty.wchusbserial1420 write_flash -fm dio -fs 32m 0x00000 nodemcu-master-7-modules-2016-06-03-01-44-33-float.bin

Communicate to the Broad through Serial Communication

screen /dev/tty.wchusbserial1420 9600

You should see the NodeMcu's lua prompt upon successful connection. Adafruit has a good tutorial for setting up the connection with local wifi.

To scan the local wifi networks:

-- print ap list
function listap(t)
      for k,v in pairs(t) do
        print(k.." : "..v)
      end
end
wifi.sta.getap(listap)

To establish connection:

wifi.sta.config("accesspointname","yourpassword")
wifi.sta.connect()
tmr.delay(1000000)   -- wait 1,000,000 us = 1 second
print(wifi.sta.status())
print(wifi.sta.getip())

exit screen by typing ctrl + a then ctrl + /

Upload Files Using ESPlorer

ESPlorer is the first IDE listed on NodeMcu's official document. Once you downloaded the binary, you can start the IDE by first cd into the ESPlorer folder, then run java -jar "ESPlorer.jar"

Conclusion

After playing around with Lua commands for 30min or so, I realized that before I can implement real IoT applications, I have to getting through a steep learning curve.