Micropython on Adafruit Huzzah esp8266: Difference between revisions
Line 16: | Line 16: | ||
Or for Windows with ''com'' serial port: com + port number | Or for Windows with ''com'' serial port: com + port number | ||
esptool.py --port com4 erase_flash | esptool.py --port com4 erase_flash | ||
*Flashing the firmware | |||
Open command line terminal. Change to directory that we store the downloaded firmware. Execute the following: | |||
esptool.py --port /dev/ttyUSB0 --baud 460800 write_flash --flash_size=detect 0 esp8266-20171101-v1.9.3.bin | |||
Or on Windows using com serial port: | |||
esptool.py --port com4 --baud 460800 write_flash --flash_size=detect 0 esp8266-20171101-v1.9.3.bin | |||
== Micropython REPL == | == Micropython REPL == |
Revision as of 11:02, 18 December 2017
Installation
- Download micropython firmware for esp8266
Go to http://micropython.org/download#esp8266 and download the stable firmware file of the board (for example: esp8266-20171101-v1.9.3.bin).
- Install esptool
We need to install esptool to flash the firmware from the computer to the esp8266 board. We use the python pip to install the esptool with the following command:
pip install esptool
Or
python -m pip install esptool
- Using esptool to erase the flash on device
Once we install the esptool, we can use the esptool.py to erase the flash with the command:
esptool.py --port /dev/ttyUSB0 erase_flash
Or for Windows with com serial port: com + port number
esptool.py --port com4 erase_flash
- Flashing the firmware
Open command line terminal. Change to directory that we store the downloaded firmware. Execute the following:
esptool.py --port /dev/ttyUSB0 --baud 460800 write_flash --flash_size=detect 0 esp8266-20171101-v1.9.3.bin
Or on Windows using com serial port:
esptool.py --port com4 --baud 460800 write_flash --flash_size=detect 0 esp8266-20171101-v1.9.3.bin
Micropython REPL
- Using Putty on Windows
- Download and install Putty from: https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
- Open putty.exe to start the program
- Click on Serial
- Enter Serial Line port (for example COM4)
- Change the Serial Speed to 115200. It is the default speed for micropython REPL
- Click Open
Note: to see which com port the device is on in windows. We can:
- Connect the device via usb cable
- Open device manager.
- Click on Ports (COM & LPT)
- The Device will be list with Name and port number
Control GPIO
Connect to WiFi
MQTT
DHT Sensor
References
Getting started with MicroPython on the ESP8266: https://docs.micropython.org/en/latest/esp8266/esp8266/tutorial/intro.html