MoloWorks account

Welcome back.

Sign in to continue where you left off.

Forgot password?

New to MoloWorks?

Shared skills · ML-C11

COURSE PREVIEW

SoftAP Wi-Fi provisioning

Join the ESP32 setup network, submit credentials through a local page, and verify a clean station reconnect.

  • 30 min lesson
  • 6:25 video
  • First-time builders

Check the station connection after submitting the setup form, then verify a fresh restart.

Watch the lessonEnglish · Captions in video

Give the board a Wi-Fi address

Use the board's temporary setup network to send a lab router's details, then prove the board can reconnect after a restart.

ESP32S3N16R8

ESP32-S3-N16R8 board

Hosts setup Wi-Fi, then joins the router.

AC

USB data cable

Carries power, files and console messages.

USB console

Computer + USB terminal

Installs the application and reads results.

Wi-FiSetup

Phone or Wi-Fi laptop

Opens the local setup form.

2.4 GHz

Private lab router

2.4 GHz WPA2-Personal; temporary credentials.

Before you begin: complete ML-C03/C04. Have working MicroPython v1.29.0 for ESP32-S3, a working USB REPL and mpremote on your computer. Use a private 2.4 GHz WPA2-Personal lab router with a temporary passphrase.

You will do

Install three files, open a local form, observe the result and test a restart.

You will prove

The board has a router connection and an IP address, then repeats that join from its saved file.

The phone and computer may be the same laptop. Keep USB available for the setup key, redacted results and recovery. No extra circuit or external supply is needed.

One board, two network roles

Wi-FiSetupESP32S3N16R82.4 GHzPhone / browserESP32-S3Lab router1 · Setup AP2 · STA joinlocal pagetarget Wi-Fi
1 · Browser → setup APWi-FiSetupJoin Molo-Setup-C11. Open the local form on the board.
2 · Board → target router2.4 GHzThe board becomes a station and joins your private lab router.

AP = access point: the board hosts a temporary Wi-Fi network. STA = station: the board joins your router as a client.

Provisioning means giving a device the settings it needs. First your browser reaches the board over its setup AP. Next the board uses the submitted SSID (network name) and passphrase to join the lab router.

Setup link

Browser → board. The local page is stored on the board; internet access is unnecessary.

Router link

Board → target router. A local IP address shows local connectivity; it does not prove internet access.

Keep the two networks separate. Do not enter Molo-Setup-C11 as the target router name. Its key gets your browser to the form; the router's passphrase gets the board onto your lab network.

Install a small, known application

ESP32S3N16R8FRONT VIEWAntenna upUSB → nativeBottom LEFTRST · upperBOOT · lowerCOM · bottom rightOne data cable · no attached circuit
ESP32S3N16R8FRONTAntenna upNative USBbottom LEFTRSTupperBOOTlowerCOM

Place lab_config.py, softap_lab.py and main.py from this course's examples folder in one computer folder. The included example guide repeats these steps. Leave unrelated programs and configuration backed up privately.

  1. Connect the native USB socket. Close other serial tools. Use mpremote connect list to find the runtime port.
  2. If main.py already exists, copy it to a new private backup filename before replacing it. If it is absent, skip that backup command.
  3. Run the commands below from the folder containing the three files. Replace PORT with your actual port, such as COM7.
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

Install main.py last. In the REPL, press Ctrl+C twice, then Ctrl+D to restart and see startup messages. Rediscover the port if USB reappears under a different name.

Join the temporary setup Wi-Fi

TEMPORARY SETUP APTARGET LAB ROUTERWi-FiSetupMolo-Setup-C11Join with USB keyNo internet is normal2.4 GHzClassroom-Lab2.4 GHz · WPA2Board joins hereBrowser → boardBoard → router
TEMPORARY SETUP APTARGET LAB ROUTERWi-FiSetupMolo-Setup-C11Join with USB keyNo internet is normal2.4 GHzClassroom-Lab2.4 GHz · WPA2Board joins hereBrowser → boardBoard → routerTEMPORARY SETUP APTARGET LAB ROUTERWi-FiSetupMolo-Setup-C11Join with USB keyNo internet is normal2.4 GHzClassroom-Lab2.4 GHz · WPA2Board joins hereBrowser → boardBoard → router
  1. Read the computer's USB console. It shows SETUP SSID: Molo-Setup-C11, a fresh SETUP KEY and http://192.168.4.1/.
  2. On your phone or laptop, open Wi-Fi settings and join Molo-Setup-C11 using that temporary key. Keep the key private.
  3. Choose to stay connected if the operating system says “No internet.” Temporarily disable an automatic switch to mobile data or another Wi-Fi network.
  4. Open the exact http://192.168.4.1/ address in the browser's address bar. Use HTTP, not a search box or an assumed HTTPS address.
Expected result: a page headed “Connect the board.” There is no captive-portal detection or internet redirect in this example. Enter the address manually.

The setup window lasts five minutes and accepts one Wi-Fi client at a time. If it expires, press RST alone to start again and read the new temporary key. A successful saved configuration goes straight to the router on later starts.

Submit the router details

http://192.168.4.1/Target router SSIDClassroom-LabTarget router passphrase••••••••••••Submit and try connectionPOST /configureCredentials in bodyNo password in URLSSID ≠ setup nameTemporary lab only
http://192.168.4.1/Target router SSIDClassroom-LabTarget router passphrase••••••••••••Submit and try connectionPOST /configureCredentials in bodyNo password in URLSSID ≠ setup nameTemporary lab only

Enter the target lab router's network name and temporary WPA2 passphrase. Use the exact capitalization and spaces. The example supports a 1–32 byte UTF-8 SSID and an 8–63 character printable ASCII passphrase. It does not handle open networks, enterprise login or a 64-digit raw key.

  1. Check that the name belongs to your 2.4 GHz lab router.
  2. Select Submit and try connection once. The browser sends an HTTP POST body to /configure.
  3. Wait for “Submission received,” then read the USB result. The form never echoes the password.
Use temporary lab credentials. The setup AP uses a fresh WPA2 key, but this simple local page uses HTTP, without TLS. POST keeps values out of the URL; it is not end-to-end encryption. Do not use home, workplace or shared-account secrets.

The server checks its session token and validates the same field limits again. Do not paste credentials into browser URLs, screenshots, prompts, terminal commands or support logs.

A receipt is only the first signal

SUBMISSION RECEIVEDHTTP 202Form acceptedConnection still pendingCONNECTION RESULTisconnected() → Truevalid IP → save fileUSB: connectedFirst send the receipt; then try the router.
SUBMISSION RECEIVEDHTTP 202Form acceptedConnection still pendingCONNECTION RESULTisconnected() → Truevalid IP → save fileUSB: connectedFirst send the receipt; then try the router.SUBMISSION RECEIVEDHTTP 202Form acceptedConnection still pendingCONNECTION RESULTisconnected() → Truevalid IP → save fileUSB: connectedFirst send the receipt; then try the router.

The application sends and closes the HTTP response before it starts the router join. This gives the browser its receipt before the board's radio changes roles.

The station attempt lasts at most 15 seconds. The code checks sta.isconnected() and a nonzero address from sta.ifconfig()[0]. Only then does it save /lab_wifi.json and close the setup AP.

{"state": "connected", "configured": true,
 "ip_assigned": true}
This is the connection result. If setup Wi-Fi disappears, read USB first. AP and STA share a radio; a channel change may interrupt your browser. Rejoin the router on your phone after success. Internet access remains a separate test.

Restart without the form

ESP32S3N16R8/lab_wifi.jsonschema 1 · SSID · passwordRST alone · BOOT releasedUSB: reconnected + IP assignedA restart must work without resubmitting the form.
1 · Save after connection/lab_wifi.json contains schema 1, SSID and password. Keep it private.
2 · RST aloneESP32S3N16R8Leave BOOT released. Restart without the web form.
3 · Read USBreconnected + ip_assigned: true proves the saved-file join.
  1. After a connected result, keep the lab router available. Leave BOOT released.
  2. Press the upper RST button once. If the runtime port disappears, rediscover it and reopen your USB terminal.
  3. If you missed startup output, use Ctrl+C and Ctrl+D in the REPL to make a clean application restart while watching.
  4. Observe the reconnected result below. Do not submit the web form again.
{"state": "reconnected", "configured": true,
 "ip_assigned": true}

Saved file

Exactly schema, ssid and password, with schema value 1. ML-C09 uses this same lab file format.

Keep it private

The file contains readable credentials. Do not print it or add it to Git. Protect backups, and delete lab settings when finished.

At the REPL, print(softap_lab.status()) reports only saved-state, link and IP booleans. A status read alone does not prove that a restart loaded the file.

Retry one layer at a time

JOIN FAILEDRead redacted USB resultRejoin setup APReopen 192.168.4.1Correct target detailsCLEAR / RETRYCtrl+C → REPLsoftap_lab.clear()RST → fresh setup keyRemove lab file only
JOIN FAILEDRead redacted USB resultRejoin setup APReopen 192.168.4.1Correct target detailsCLEAR / RETRYCtrl+C → REPLsoftap_lab.clear()RST → fresh setup keyRemove lab file onlyJOIN FAILEDRead redacted USB resultRejoin setup APReopen 192.168.4.1Correct target detailsCLEAR / RETRYCtrl+C → REPLsoftap_lab.clear()RST → fresh setup keyRemove lab file only
ObservationNext action
No setup networkCheck USB power and the current key. A saved configuration may already have joined the router. Read USB before forcing setup.
No local pageConfirm the phone is still on setup Wi-Fi. Type the HTTP address manually; disable automatic Wi-Fi/mobile-data switching for the lab.
join_failedRejoin setup Wi-Fi and reopen the form. Check the target SSID, temporary key, 2.4 GHz band, WPA2 mode and router availability.
save_failedThe code disconnects STA. Keep USB, back up private files and check free filesystem space before retrying.
setup_expired / setup_errorReturn to the USB REPL. Check installation and supported firmware, then restart the application.

A failed new attempt does not replace a previously saved valid file. On the next restart, the application tries that file first; if it cannot join, it opens setup again.

Share only the layer and state: for example, “form receipt received; USB says join_failed.” Remove the temporary setup key and any network details before sharing a screenshot.

Clear the lab and start fresh

ESP32S3N16R8FRONT VIEWAntenna upUSB → nativeBottom LEFTRST · upperBOOT · lowerCOM · bottom rightOne data cable · no attached circuit
ESP32S3N16R8FRONTAntenna upNative USBbottom LEFTRSTupperBOOTlowerCOM

Clearing is a separate action. It removes this lab's saved settings; it does not erase the firmware or unrelated programs.

  1. In the USB terminal, press Ctrl+C twice to stop an active setup loop and reach >>>.
  2. Run the commands below. The result says cleared and configured: False.
  3. Press RST alone. The board should open a fresh setup AP and print a new key. Rejoin using that new key.
import softap_lab
print(softap_lab.clear())
Exactly what is cleared: /lab_wifi.json and its named temporary save file. The helper also disconnects the station and closes the setup AP. It does not claim to erase credentials belonging to every other firmware or application.

Open setup without deleting the saved file

import softap_lab
softap_lab.run(force_setup=True)

Use this after stopping the application at the REPL. A successful new submission replaces the lab file. An unsuccessful attempt leaves the previous file available.

When the lab ends, clear the device file and remove any private computer backups you no longer need. Restore your previous main.py only from your own checked backup.

Run a complete provisioning check

1 · Receive202 receiptNo success yetTemporary setup AP2 · ConnectLink + valid IPSave configLocal network only3 · RestartSaved-file joinreconnectedNo form resubmission
1 · Receive202 receiptNo success yetTemporary setup AP2 · ConnectLink + valid IPSave configLocal network only3 · RestartSaved-file joinreconnectedNo form resubmission1 · Receive202 receiptNo success yetTemporary setup AP2 · ConnectLink + valid IPSave configLocal network only3 · RestartSaved-file joinreconnectedNo form resubmission1 · Receive202 receiptNo success yetTemporary setup AP2 · ConnectLink + valid IPSave configLocal network only3 · RestartSaved-file joinreconnectedNo form resubmission
  1. Start with no saved lab configuration. Join setup Wi-Fi and open the form.
  2. Use an intentionally wrong temporary lab passphrase. Confirm join_failed after the bounded attempt; rejoin setup if needed.
  3. Submit correct lab details. Confirm connected with ip_assigned: true. The setup AP closes.
  4. Restart with BOOT released. Confirm reconnected without resubmitting.
  5. Clear the configuration and restart. Confirm fresh setup is available again.
Success record: write only the observed state sequence, whether an IP was assigned and whether restart worked. Do not record either passphrase.

Check your understanding

1. Your phone says “No internet” on setup Wi-Fi. Is setup necessarily broken?

2. The browser shows HTTP 202. Has the router join succeeded?

3. What proves that the saved file works?

Answers

1. No. The page is local to the board.

2. No. Read the link and IP result over USB.

3. A clean restart reports reconnected without another form submission.

Keep USB recovery available as you compare SoftAP with BLE and SmartConfig in the next courses.

Files for this lesson

Practice files

Keep the folder names shown below when saving files. Use these files with the matching steps in this lesson.

Keep your reference

Keep the lesson beside your practice.

Download the PDF to keep the diagrams, commands, and checkpoints close at hand. Return to the first missing observation when a step does not match.

Lesson diagram

Scroll across the diagram to inspect each connection.

Contact QR code

Open contact