MicroPython is a great way to get the most of your ESP8266 board, and, the ESP8266 chip is a great platform for using MicroPython!

This article is for accomodated users with the board, and also can be a quick guide for beginers. First of all, download the firmware for the ESP8266 from

https://micropython.org/download/esp8266/

Install Python on your desktop, mine is a Windows10, then proceed to verify or install the required tools:

C:\Users\MY_USER>python --version
Python 3.8.2

C:\Users\MY_USER>python -m ensurepip --default-pip
Looking in links: c:\Users\MY_USER\AppData\Local\Temp\tmpepn5zlys
Requirement already satisfied: setuptools in c:\users\MY_USER\appdata\local\programs\python\python38-32\lib\site-packages (41.2.0)
Requirement already satisfied: pip in c:\users\MY_USER\appdata\local\programs\python\python38-32\lib\site-packages (20.2.3)

C:\Users\MY_USER>pip --version
pip 20.2.3 from c:\users\MY_USER\appdata\local\programs\python\python38-32\lib\site-packages\pip (python 3.8)

C:\Users\MY_USER>

PIP is a package manager for Python and likely to be included already in your Python installation.

Install the esptool and run the commands to erase and burn the image on the chip:

pip install esptool
>esptool.py --port COM3 erase_flash
esptool.py v2.8
Serial port COM3
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: 5c:cf:7f:15:b5:a8
Uploading stub...
Running stub...
Stub running...
Erasing flash (this may take a while)...
Chip erase completed successfully in 10.3s
Hard resetting via RTS pin...

>esptool.py --port COM3 --baud 460800 write_flash --flash_size=detect -fm dio 0 esp8266-20200911-v1.13.bin
esptool.py v2.8
Serial port COM3
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: 5c:cf:7f:15:b5:a8
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Auto-detected Flash size: 4MB
Flash params set to 0x0240
Compressed 638928 bytes to 419659...
Wrote 638928 bytes (419659 compressed) at 0x00000000 in 9.4 seconds (effective 544.3 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...

 

In my case, the ESP bord is at COM3 serial port.

To connect to your ESP, you can use uPyCraft IDE from uPyCraft IDE (see the links below). For Mac, you can use ThonnyIDE.

Now, let’s see some blinking leds action:

Create main.py file and then hit the button “Download and Run”

from machine import Pin
from time import sleep

led = Pin(2, Pin.OUT)

while True:
led.value(not led.value())
sleep(0.5)

 

From now on, with this setup, we will set the wifi connection, add some temperature sensors, pressure – and then the plan is to use the blynk app!

 

Happy blinking!

 


Where to buy:


Links:

https://docs.micropython.org/en/latest/esp8266/tutorial/intro.html

Install uPyCraft IDE – Windows PC Instructions

Getting Started with Thonny MicroPython (Python) IDE for ESP32 and ESP8266

MicroPython on ESP8266
Tagged on:                 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.