Wi-Fi Configuration

mPython IoT connects to the network via 2.4 GHz Wi-Fi, which is the prerequisite for IoT communication. This page describes how to configure the Wi-Fi connection and how to determine the connection status via the indicator LED.

Wi-Fi Operating Mode

mPython IoT uses STA (Station) mode to connect to a wireless router, meaning the device acts as a client joining an existing Wi-Fi network.

Attention

mPython IoT only supports 2.4 GHz Wi-Fi (IEEE 802.11b/g/n) and does not support the 5 GHz band. Please ensure you are connecting to a 2.4 GHz wireless network.

Configuring Wi-Fi Credentials

Configure the Wi-Fi SSID and password in code to allow the device to connect to the network automatically. Example code:

import network
import time

sta = network.WLAN(network.STA_IF)   # Create STA interface object
sta.active(True)                      # Activate Wi-Fi
sta.connect('your_ssid', 'your_password')   # Connect to the specified hotspot

while not sta.isconnected():          # Wait for connection
    time.sleep(0.5)

print('Wi-Fi connected, IP address: ', sta.ifconfig()[0])

Replace your_ssid and your_password with your actual Wi-Fi network name and password.

Indicator LED Status

The Wi-Fi status LED provides a visual indication of the current connection state:

LED Status

Meaning

Blinking

Connecting to Wi-Fi network

Solid on

Wi-Fi successfully connected

Off

Not connected or Wi-Fi not activated

Hint

If the LED keeps blinking without turning solid, check whether the Wi-Fi name and password are correct, whether the router is on the 2.4 GHz band, and whether the signal strength is sufficient.