yahboom
HomeLearn
Solution
Blog
Online Store
About Us
EN/中文
ESP32 Core Board📖
1. ESP32 Introduction
  • 1. ESP32S3 Overview
  • 2. Environment Setup Introduction
  • 3. Dev Board Introduction
2. ESP-IDF Development Tutorial
1. Before Development
  • 1. Environment Setup (Windows)
  • 2. Environment Setup (Linux)
  • 3. Build and Flash
2. Basic Peripherals
  • 1. LED Control
  • 2. Button Detection
  • 3. Peripheral Interrupts
  • 4. ESP_TIMER
  • 5. GPTIMER
  • 6. Watchdog Timer
  • 7. DMA
  • 8. ADC
  • 9. PWM Breathing LED
  • 10. RGB LED Effects
3. Serial Communication and Storage System
  • 1. Serial UART Communication Experiment
  • 2. I2C_OLED Display Experiment
  • 3. SPI Bus Communication Experiment
  • 4. PSRAM External Memory Experiment
  • 5. Flash Read and Write Experiment
  • 6. USB Emulated Mass Storage Experiment
4. FreeRTOS operating system
  • 1.FreeRTOS Core Concepts Theory
  • 2.Task Creation and Management
  • 3.Queue
  • 4.Binary Semaphore
  • 5.Mutex
  • 6.Event Groups
  • 7.Software Timer
  • 8.Task Scheduler
  • 9.Low Power Mode
  • 10.Deadlock
  • 11.Priority Inversion
5. Network Protocols and Wireless Communication
  • 1. WIFI Network Basics
  • 2. WIFI STA Mode
  • 3. WIFI AP Mode
  • 4. UDP Client Experiment
  • 5. UDP Server Experiment
  • 6. TCP Client Experiment
  • 7. TCP Server Experiment
  • 8. Socket Programming Basics
  • 9. HTTP Client Experiment
  • 10. HTTP Server Experiment
  • 11. MQTT IoT Communication Protocol
  • 12. WIFI OTA Upgrade
  • 13. Bluetooth Fundamentals
  • 14. Bluetooth Slave Mode
  • 15. Bluetooth Master Mode
6. Audio Applications
  • 1.I2S Microphone Recording and U-Disk Playback
  • 2.I2S Audio Playback Experiment
  • 3.Repeater Experiment
7. Xiaozhi AI Voice
  • 1. Burn Xiaozhi Firmware
  • 2. Network and Configuration
  • 3. AI Agent Settings
  • 4. Program Analysis
  • 5. Free Chat
3. Arduino Development Course
1. Before Development
  • 1. Environment Setup
  • 2. Build and Flash
2. Basic Peripherals
  • 1. LED Control
  • 2. Button Detection
  • 3. Peripheral Interrupts
  • 4. ESP_TIMER
  • 5. GPTIMER
  • 6. Watchdog Timer
  • 7. ADC
  • 8. PWM Breathing LED
  • 9. RGB LED Effects
3. Serial Communication and Storage System
  • 1. Serial UART Communication
  • 2. I2C OLED Display
  • 3. SPI Bus Communication
  • 4. Flash Read and Write
  • 5. USB Emulated Mass Storage
4. Network Protocols and Wireless Communication
  • 1. WIFI Network Basics
  • 2. WIFI STA Mode
  • 3. WIFI AP Mode
  • 4. UDP Server Experiment
  • 5. UDP Client Experiment
  • 6. TCP Client Experiment
  • 7. TCP Server Experiment
  • 8. HTTP Client Experiment
  • 9. HTTP Server Experiment
  • 10. MQTT IoT Communication Protocol
  • 11. WIFI OTA Upgrade
  • 12. Bluetooth Fundamentals
  • 13. Bluetooth Slave Mode
  • 14. Bluetooth Master Mode
5. Audio Applications
  • 1.I2S Microphone Recording and U-Disk Playback
  • 2.I2S Audio Playback Experiment
  • 3.Repeater Experiment
4. MicroPython Development Course
1. Before Development
  • 1. Environment Setup
  • 2. Build and Flash
  • 3. Thonny IDE
2. Basic Peripherals
  • 1. LED Control
  • 2. Button Detection
  • 3. Peripheral Interrupts
  • 4. TIMER_IT
  • 5. Watchdog Timer
  • 6. ADC
  • 7. PWM Breathing LED
  • 8. RGB LED Effects
3. Serial Communication and Storage System
  • 1. Serial UART Communication Experiment
  • 2. I2C_OLED Display Experiment
  • 3. SPI Bus Communication Experiment
  • 4. Flash Read and Write Experiment
  • 5. Print Storage
4. Network Protocols and Wireless Communication
  • 1. WIFI Network Basics
  • 2. WIFI STA Mode
  • 3. WIFI AP Mode
  • 4. UDP Client Experiment
  • 5. UDP Server Experiment
  • 6. TCP Client Experiment
  • 7. TCP Server Experiment
  • 8. HTTP Client Experiment
  • 9. HTTP Server Experiment
  • 10. MQTT
  • 11. Bluetooth Fundamentals
  • 12. Bluetooth Slave Mode
  • 13. Bluetooth Master Mode
5. Audio Applications
  • 1. I2S Audio Playback Experiment
  • 2. Repeater Experiment
Download
  • Code
  • Hardware_Info
  • 3D_Model_File
  • Software_Tools
  • VMware
  • VM_File
Download ZIP

Welcome to ESP32 Core Board repository

3. WIFI AP Mode

WIFI AP Mode Experiment


WIFI AP Mode Experiment1. WIFI AP Mode Overview2. Core Concepts2.1 How AP Mode Works2.2 Configuration Parameters2.3 Core API3. Hardware Dependencies4. Project Architecture and Flow5. Source Code Explained5.1 Configuration and Activation5.2 Client Connection Monitoring6. Operating Procedures6.1 Flashing and Running6.2 Expected Results6.3 Serial Output Example6.4 Verification Methods7. Common Problems


1. WIFI AP Mode Overview

WiFi AP (Access Point, hotspot mode) lets the ESP32-S3 turn itself into a wireless router/hotspot; other devices (phones, computers, another ESP32) can search for and connect to this hotspot to achieve LAN communication.

AP mode has irreplaceable application value in the IoT field. First, it is the foundation of provisioning technology — when a device is first deployed and no WiFi network is available, the device first runs in AP mode, the user connects their phone to the hotspot and sends the router password to the device through a web page or App, and the device then switches to STA mode to go online (this is the first step of the SmartConfig / Web provisioning process). Second, in no-router scenarios (field work, site inspections, temporary exhibitions), AP mode lets users directly connect to devices point-to-point for parameter configuration, status viewing, and firmware upgrades without depending on any network infrastructure. In addition, AP mode is also widely used in LAN multi-user collaboration scenarios — multiple phones or computers connect to the same ESP32-S3 hotspot for local chat, file sharing, multiplayer games, and other LAN applications.

This experiment configures the ESP32-S3 in AP mode; a phone or computer can view the connection status after connecting.

Typical application scenarios:

Application TypeExample
Device provisioningPhone connects to ESP32 hotspot -> enter home WiFi on web page -> ESP32 switches to STA
Offline LANMultiple ESP32s form an ad-hoc network (no router needed)
DebuggingConnect directly for debugging when there is no WiFi in the field
File transferPhone connects to ESP32 hotspot and uploads/downloads files

In AP mode the ESP32-S3 supports about 4~8 devices connecting simultaneously at most.


2. Core Concepts

2.1 How AP Mode Works

              ┌──────────┐
Phone  ─────→ |          |
PC  ────────→ | ESP32-S3 |  (no Internet, pure LAN)
Tablet  ────→ | (AP)     |
              └──────────┘

The ESP32-S3 creates its own hotspot and broadcasts the SSID; other devices scan and connect. The ESP32-S3 acts as a DHCP server to assign IPs to clients. In AP mode, the ESP32-S3's default IP is usually 192.168.4.1.

2.2 Configuration Parameters

ParameterDescriptionValue Used in This Experiment
AP_SSIDHotspot name"ESP32_AP"
AP_PASSWORDHotspot password"12345678" (at least 8 characters)
authmodeEncryption methodWPA_WPA2_PSK
Max connectionsNumber of simultaneously connected devices4~8 (depends on firmware configuration)

2.3 Core API

​x
import network
​
ap = network.WLAN(network.AP_IF)           # create AP interface
ap.active(True)                             # activate
ap.config(essid="ESP32-AP",                # set SSID + password
          password="12345678",
          authmode=network.AUTH_WPA_WPA2_PSK)
ip, _, _, _ = ap.ifconfig()                # get AP's own IP
ap.status('stations')                       # get connected clients
ap.active(False)                            # deactivate

3. Hardware Dependencies

The ESP32-S3 has a built-in 2.4 GHz WiFi module, no external hardware needed.


4. Project Architecture and Flow

xxxxxxxxxx
Script execution (single-file .py)
  |
  |- create AP interface -> set SSID/password/encryption
  |- wait for AP activation -> print IP
  |
  |- while True:
       |- poll the list of connected clients
       |- detect new connection -> print MAC address
       |- detect disconnect -> print MAC address
       |- sleep(1s)

5. Source Code Explained

Full source code: Source Code -> MicroPython -> 4.Network Protocols -> WiFi_AP -> WiFi_AP.py

5.1 Configuration and Activation

AP_IF interface -> active(True) -> config(ssid, password, authmode) sets the hotspot parameters -> wait for activation to complete.

xxxxxxxxxx
AP_SSID     = 'ESP32_AP'                # AP SSID
AP_PASSWORD = '12345678'                    # AP password (min 8 chars)
​
def main():
    ap = network.WLAN(network.AP_IF)        # create AP interface
    ap.active(True)                          # activate
    ap.config(essid=AP_SSID, password=AP_PASSWORD,
              authmode=network.AUTH_WPA_WPA2_PSK)  # WPA2 encryption
​
    while not ap.active():
        time.sleep_ms(100)                   # wait for activation
​
    ip, _, _, _ = ap.ifconfig()
    print('WiFi AP ready')
    print('  SSID     :', AP_SSID)
    print('  IP       :', ip)

5.2 Client Connection Monitoring

status('stations') gets the MAC list of connected devices; comparing two consecutive snapshots implements connect/disconnect detection.

xxxxxxxxxx
def mac_str(mac):
    """bytearray -> readable string"""
    return '%02x:%02x:%02x:%02x:%02x:%02x' % (mac[0], mac[1], mac[2],
                                                mac[3], mac[4], mac[5])
​
prev = []
while True:
    cur = [t[0] for t in ap.status('stations')]  # current clients
​
    for mac in cur:                                # new connections
        if mac not in prev:
            print('Connected   :', mac_str(mac))
​
    for mac in prev:                               # disconnected
        if mac not in cur:
            print('Disconnected:', mac_str(mac))
​
    prev = cur
    time.sleep(1)                                  # 1s polling interval

status('stations') returns a list of (MAC, ...) tuples of connected devices; connect/disconnect detection is implemented by comparing two consecutive snapshots.


6. Operating Procedures

6.1 Flashing and Running

Thonny IDE steps: See MicroPython -> 1. Before Development -> 3.Thonny IDE.

Thonny IDE flashing steps: See the MicroPython -> 1. Before Development -> 3.Thonny IDE

  1. Open WiFi_AP.py in Thonny IDE and click Run
  2. Open the WiFi settings on your phone and search for ESP32_AP
  3. Enter the password 12345678 to connect

6.2 Expected Results

After the ESP32-S3 creates the hotspot, the phone can find and connect to it. The serial port prints client connect/disconnect logs.

6.3 Serial Output Example

xxxxxxxxxx
WiFi AP ready
  SSID     : ESP32_AP
  IP       : 192.168.4.1
Connected   : aa:bb:cc:dd:ee:ff
Disconnected: aa:bb:cc:dd:ee:ff

Hotspot is on, phone connects successfully

连接成功

Phone disconnects

用户断联

6.4 Verification Methods

OperationExpected Result
Phone searches for WiFiSees ESP32_AP
Phone enters the password and connectsSerial prints Connected: <MAC>
Phone disconnects from WiFiSerial prints Disconnected: <MAC>

7. Common Problems

SymptomCauseSolution
Phone cannot find the hotspotAP not activated or 5 GHz band incompatibleThe ESP32-S3 only supports 2.4 GHz; confirm the phone is searching in the 2.4G band
Prompts "wrong password" when connectingPassword shorter than 8 charactersWPA2 requires a password of at least 8 characters
Cannot access the Internet after connectingAP mode has no InternetAP mode only provides a LAN and does not forward Internet traffic
WIFI STA Mode
UDP Client Experiment

COMPANY

  • About us
  • Team Style
  • Blog

LEARNING & EXPLORATION

  • Tutorials
  • Edge AI hardware
  • Educational robots
  • Embedded intelligent hardware

WHERE TO BUY

  • Yahboom Online Store
  • Amazon
  • Alibaba
  • AliExpress
  • Mercado

TECHNOLOGY SUPPORT

  • Email: support@yahboom.com

BE A DISTRIBUTOR

  • Email: sales@yahboom.com
QR Code

Copyright © 2017-2026 Yahboom. All Rights Reserved.

EN/中文