This is the firmware for a very simplistic ESP8266 based dash-button.
Once powered it’ll connect to WIFI, run a payload and spawn a WIFI Access Point afterwards, exposing the micropython webrepl allowing you to tinker further.
Check out the description at Hackaday – ESP Dash Button for details on how to built the device.
This is the hardest part, hopefully, you only have to do this once.
- If not already done, solder the permanent resistors to select the correct boot mode:
- A 1k Resistor between GND and GPIO15.
- A 1k Resistor between VCC and CHIP_EN.
- Make temporary connections for initial flashing:
- Connect GPIO0 to GND, e.g. using a another 1k Resistor (but don't solder it) or a logic analyzer test clip.
- Connect RX and TX to your USB-to-serial converter.
I acquired some 2.0mm Pin headers and 2.0mm to 2.54mm dupont cables, that make this a piece of cake, but you can also use clips or other wires. The goal is again that you need this only once.
- Attach a stable 3.3V power supply to GND and VCC. A 3.7V coin-cell or your USB-to-Serial converter power output will not suffice and may result in corrupted flash data or even a bricked device! (I drew the power from a NodeMCU board that is able to provide plenty of excess power). Logic analyzer testing clips again come in handy for this. This is the only connection that you’ll need to re-establish if you want to change the software in the future.
- Flash the initial firmware:
- Edit your configuration, in particular
config.py
andwebrepl_cfg.py
- Flash micropython to your ESP board
- After reboot, the device exposes a python shell on its serial console.
Install any dependent modules as needed:
screen /dev/ttyUSB0 115200 import upip upip.install('micropython-urequests')
- You can use this shell to develop your payload, once done, save it to
payload.py
and runmake flash
- Edit your configuration, in particular
The device should under all circumstances run a WIFI access point eventually,
it’s access params are configured in config.py
.
You can then use webrepl to connect
to the device and inspect it or re-upload files.
Note again: The coin cell is not able to provide sufficient current for flash operations, so if you want to upload files, you need to hook up the device to an external power supply as described above!