ML-C11 SoftAP lab

Read the illustrated lesson first. Use MicroPython v1.29.0 ESP32-S3 SPIRAM_OCT firmware, a working USB REPL and mpremote. Use only a temporary private 2.4 GHz WPA2-Personal router. Keep other circuits and external supplies disconnected.

Install

Download all three files into one computer folder: lab_config.py, softap_lab.py, main.py. In that folder, find the runtime port with mpremote connect list. Replace PORT below. If main.py exists, back it up to a new private filename first; skip that first command if it is absent.

mpremote connect PORT fs cp :main.py ./main-before-c11.py
mpremote connect PORT fs cp lab_config.py :lab_config.py
mpremote connect PORT fs cp softap_lab.py :softap_lab.py
mpremote connect PORT fs cp main.py :main.py
mpremote connect PORT repl

In the REPL use Ctrl+C twice, then Ctrl+D. The application tries a saved file first, otherwise it opens setup for five minutes. Native USB is front bottom left with antenna up. Upper RST restarts; leave lower BOOT released.

Provision

  1. Read the setup SSID, fresh temporary AP key and local HTTP address from private USB.
  2. Join Molo-Setup-C11 on your phone/laptop. Stay on it despite “No internet.”
  3. Open http://192.168.4.1/ manually. Enter the target lab router SSID and passphrase.
  4. The form sends POST /configure with an expiring per-run token. It never places credentials in the URL. HTTP has no TLS; do not use sensitive credentials.
  5. After the receipt, observe USB: connected with ip_assigned true. A receipt alone is not a connection.
  6. AP may drop or change channel during STA join. A failed attempt disconnects STA; rejoin setup and retry. A successful attempt saves and closes setup.
  7. Press RST alone. Observe reconnected from the saved file, without a new form.

File and recovery

/lab_wifi.json contains exactly {"schema":1,"ssid":string,"password":string}. SSID is 1–32 UTF-8 bytes; passphrase is 8–63 printable ASCII characters. It is plaintext; protect backups and keep it out of Git. This is this lab's explicit file format, compatible with ML-C09.

import softap_lab
print(softap_lab.status())
# Clear this lab's config and disconnect:
print(softap_lab.clear())
# Or keep saved config but open a fresh setup window:
softap_lab.run(force_setup=True)

Stop any running loop with Ctrl+C twice first. clear removes only the named lab JSON and its temporary save file. It leaves firmware and unrelated files intact. On timeout, the code returns to REPL; restart for a fresh setup key. A failed new join leaves an earlier saved file unchanged. Save failure disconnects and reports a redacted state. No code prints the target SSID or password.

After the lab, clear device settings, remove private backups you no longer need and restore an earlier application only from your own checked backup.