Skip to content

ESP32 project template

License

Notifications You must be signed in to change notification settings

cachuperia/template-esp32

Repository files navigation

freenove-esp32

checks release

Table of contents

About

ESP32 configuration and scripts.

Setup

Prerequisites

Hardware - Freenove ESP32-WROVER dev board. Check espressif documentation if you have a different board and modify MICROPYTHON_BINARY environment variable(.env file will be created as part of the make init target) accordingly.

Ubuntu 20.04 as host OS, check documentation for CH340 installation instructions for your system.

CLI tools: direnv, git, poetry and pre-commit.

You can use this playbook for automated tools installation.

Local environment

git clone [email protected]:cachuperia/freenove-esp32.git
cd freenove-esp32
make init
direnv allow

ESP32 board(MicroPython, Wi-Fi connection and WebREPL)

  1. Connect dev board to the USB port, find port name with the help of make find-port command and replace ESP32_PORT value in the .env file.
  2. Open src/freenove_esp32/chip/cfg.py file and configure variables.
  3. Write MicroPython binary and code(src/freenove_esp32/chip folder) to the chip with the help of make esp32-init command. Logs can be downloaded with the help of make get-logs command.

Execute make help for list of all available commands.

Usage

Serial shell

Connect

poetry shell  # activate venv
mpremote  # connect to the serial terminal
# When you see the blank screen, hit Enter and you should be able to get the REPL prompt.
# Press `Ctrl-D` to initiate a soft reboot or `Ctrl-]` for disconnect

Execute string

poetry shell  # activate venv
mpremote exec "import network; wlan = network.WLAN(network.STA_IF); wlan.active(True); print(wlan.scan())"

For more options, check mpremote documentation. Shortcut for upload all files from the src/freenove_esp32/chip folder to the MicroPython root folder - make write-code

WebREPL client

You can start local WebREPL client this way:

git clone https://github.com/micropython/webrepl.git
cd webrepl
firefox webrepl.html

Contribute

Use Conventional Commits message style.

Release can be triggered by commit with feat or fix prefix. Check GitHub workflow for details.