Setup a D1 mini with micropython

D1 mini v1.0.0

D1 mini (from wemos) is a dev board with an ESP82666 chip providing WIFI.

https://docs.wemos.cc/en/latest/tutorials/d1/get_started_with_micropython_d1.html

I tried to work with micropython as hopefully is a bit easier than C.

Install firmware

It require esptool CLI and the micropython firmware here
https://micropython.org/download#esp8266

Once the firmware is installed there is an handy guide to get started.

Open the console

First let’s setup a terminal with picocom /dev/ttyUSB0 -b115200

To exit, CTRL-A + X

To connect to an AP see
https://docs.micropython.org/en/latest/esp8266/quickref.html#networking

Accessing the WebRPL

Micropython creates a Wifi AP (with password micropythonN) that can be used to access the webrepl (http://micropython.org/webrepl) once connected.

If the connection does not work, access the REPL from cable and enable the webrpl with import webrepl_setup.

Using the WebRPL CLI

The WebRPL repository offer a CLI to easily copy files from / to the ESP8266 over the WebRPL websocket interface

1
2
3
git clone https://github.com/micropython/webrepl.git
cd webrpl
./webrepl_cli.py -p <password> boot.py 192.168.4.1:/boot.py

if connected over cable

./pyboard --device /dev/ttyUSB0 -f cp source_file :

A more detailed guide can be found at
http://www.srccodes.com/p/article/58/setup-web-repl-esp8266-12e-connect-micro-python-prompt-repl-wifi-access-point-ap-hello-world

A nice project that handle the firmaware build with docker is https://github.com/enqack/docker-esp8266-micropython

I also published a repo with some tools and experiments
https://github.com/muka/d1mini