Micropython on Adafruit Huzzah esp8266: Difference between revisions

From UNamur InfoSec
Jump to navigation Jump to search
(Created page with "== Installation == *Download micropython firmware for esp8266 Go to http://micropython.org/download#esp8266 and download the stable firmware file of the board (for example: e...")
 
Line 25: Line 25:
*#Change the Serial Speed to 115200. It is the default speed for micropython REPL
*#Change the Serial Speed to 115200. It is the default speed for micropython REPL
*#Click Open
*#Click Open
[[File: putty_com_example_sc.png|400px]]
[[File: putty_com_example_sc.png]]


[[FIle: micropython_repl_example_sc.png|400px]]
[[FIle: micropython_repl_example_sc.png]]


Note: to see which com port the device is on in windows. We can:  
Note: to see which com port the device is on in windows. We can:  
Line 34: Line 34:
#Click on Ports (COM & LPT)
#Click on Ports (COM & LPT)
#The Device will be list with Name and port number  
#The Device will be list with Name and port number  
[[File: com_port_device_manager_sc.png|400px]]
[[File: com_port_device_manager_sc.png]]


== Control GPIO ==
== Control GPIO ==

Revision as of 10:59, 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

Micropython REPL

Putty com example sc.png

Micropython repl example sc.png

Note: to see which com port the device is on in windows. We can:

  1. Connect the device via usb cable
  2. Open device manager.
  3. Click on Ports (COM & LPT)
  4. The Device will be list with Name and port number

Com port device manager sc.png

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