Skip to content

Instantly share code, notes, and snippets.

@quietcricket
Last active May 31, 2018 06:43
Show Gist options
  • Save quietcricket/93bd4ea9320d800c21d299ad1bbc822a to your computer and use it in GitHub Desktop.
Save quietcricket/93bd4ea9320d800c21d299ad1bbc822a to your computer and use it in GitHub Desktop.
ESP8266 with MicroPython

Playing around with ESP8266 and MicroPython

ESP8266

The ESP8266 is a low-cost Wi-Fi microchip with full TCP/IP stack and microcontroller capabilities. ![](https://images-na.ssl-images-amazon.com/images/I/51XTrgJ-HLL._SL500_AC_SS350_.jpg | width=300x) ![](https://cdn3.volusion.com/btfzd.umflq/v/vspfiles/photos/AD247-2.jpg?1456512809 | width=300)

  1. CPU: 80 MHz
  2. Memory: 32 KiB instruction, 80 KiB user data
  3. Input: 16 GPIO pins
  4. Power: 3.3V DC

Micropython

MicroPython is a lean and efficient implementation of the Python 3 programming language that includes a small subset of the Python standard library and is optimised to run on microcontrollers and in constrained environments. Differences from CPython (normal Python)


Flash ESP8266 with micropython firmware

  1. Install ch340 USB driver. For OSX Serria, install this driver
  2. Download firmware
  3. Install esptool: pip install esptool
  4. For OSX, the device port will be something like /dev/tty.wchusbserial1410, /dev/tty.wchusbserial1420
  5. For Windows, the port is COM4
  6. For Linux, the port is /dev/ttyUSBO
  7. Earase current firmware: esptool.py --port YOUR-PORT erase_flash
  8. Upload microphython firmware: esptool.py --port YOUR-PORT --baud 115200 write_flash -fm dio --flash_size=detect 0 esp8266-20180511-v1.9.4.bin
  9. Test new firmware: screen [YOUR-PORT] 115200

Fun time

  1. LED
  2. LED Ring
  3. Push Button
  4. Network
  5. Webserver
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment