Guides · 10 min read

Raspberry Pi Pico W MQTT: Sensor and LED Control with umqtt

How do you use MQTT with the Raspberry Pi Pico W? Install MicroPython umqtt, use a free broker, publish temperature, subscribe to an LED and connect Home Assistant.

MQTT on the Raspberry Pi Pico W is the lightest and most common way to put your board online, send sensor data and receive remote commands. With the umqtt.simple library in MicroPython, the Pico W connects to an MQTT broker in a few lines of code, publishes the temperature it measures to a topic, and subscribes to another topic so that incoming "ON" or "OFF" messages switch an LED. You don't need to set up a web server, open a port on your router or memorise the board's IP address; your phone, computer and Home Assistant all talk to your board through the same broker.

In this guide you'll first learn the logic and basic concepts of MQTT. Then you'll install the umqtt library, connect to a free public broker, publish the value read from the Pico W's onboard temperature sensor every ten seconds and control the onboard LED remotely. Finally, you'll make the code recover on its own when the Wi-Fi or broker connection drops, and add the board to Home Assistant with MQTT Discovery without writing a single line of YAML.

Raspberry Pi Pico microcontroller board
Raspberry Pi Pico board. For MQTT you need the W version with the wireless chip (Pico W or Pico 2 W); no extra Wi-Fi module is required.

What is MQTT and how does it work?

MQTT (Message Queuing Telemetry Transport) is a publish/subscribe messaging protocol designed for devices with low bandwidth and limited processing power. A server called the broker sits in the middle. Devices don't connect to each other directly; each one opens a TCP connection to the broker (port 1883 unencrypted, 8883 with TLS). When a device publishes a message to a topic such as "bluegrays/picow/temperature", the broker forwards it to everyone subscribed to that topic. So the Pico W never has to know who will read the message; a phone app, a data logger and Home Assistant can all receive the same data at once. The fixed header of an MQTT packet is only 2 bytes, so it uses far less data and energy than HTTP requests.

ConceptMeaningExample
BrokerThe server that receives messages and distributes them to subscribersMosquitto, HiveMQ, EMQX
ClientAny device or app that connects to the brokerPico W, phone, Home Assistant
TopicThe address a message is sent to, separated by /bluegrays/picow/sicaklik
PublishSending a message to a topicSend the value "23.4"
SubscribeListening to messages arriving on a topicbluegrays/picow/led
QoSDelivery guarantee: 0 at most once, 1 at least once, 2 exactly onceumqtt.simple supports 0 and 1
RetainThe broker stores the last message and sends it immediately to new subscribersLast state of the LED
Last Will (LWT)A message the broker publishes if the device drops unexpectedly"offline"
KeepaliveThe longest interval in seconds between packets from the client60

Topics work like folder paths and are case-sensitive. When subscribing you can use two wildcards: + replaces a single level ("home/+/temperature" catches both "home/livingroom/temperature" and "home/kitchen/temperature"), while # covers all remaining levels and can only be used at the very end ("home/#"). You can't use wildcards when publishing. Avoiding spaces and non-ASCII characters in topic names reduces the chance of problems between different clients.

What you need and Pico W connections

  • Raspberry Pi Pico W or Pico 2 W: you can't use MQTT with a plain Pico that has no wireless chip.
  • MicroPython firmware: the .uf2 file built for the W version. The installation steps are explained in What Is the Raspberry Pi Pico?.
  • Thonny or another MicroPython editor, and a micro USB cable that can carry data.
  • A 2.4 GHz Wi-Fi network: the Pico W can't connect to 5 GHz networks.
  • An MQTT client: MQTT Explorer on your computer or an MQTT panel app on your phone for testing.
  • Optional: an external LED and 220 Ω resistor, an external sensor such as a DHT22 or BME280, a relay module.
ComponentPico W connectionNote
Onboard LEDPin("LED")Driven through the wireless chip, not GP25
Onboard temperature sensorADC(4)No wiring needed; it measures the chip's own temperature
External LEDGP15 → 220 Ω → LED anode, cathode → GNDPin(15, Pin.OUT) in code
DHT22 data pinGP16 (VCC → 3V3, GND → GND)Read with MicroPython's dht module
Relay module INGP14Choose a module that can be triggered with 3.3 V
Pins reserved for the wireless chipGPIO23, 24, 25, 29Not brought out of the board, can't be used for anything else
On the plain Pico the onboard LED is connected to GP25, but on the Pico W, GP25 is used for the wireless chip's communication line. If you write Pin(25) on this board the LED won't light, and you might even disturb Wi-Fi communication. Always use Pin("LED", Pin.OUT) for the onboard LED. If you connect an external LED, pick the resistor value for 3.3 V with the LED resistor calculator.

Installing the umqtt library

  1. Hold the BOOTSEL button while connecting the board to your computer and copy the MicroPython .uf2 file for the W version to the RPI-RP2 drive that appears.
  2. In Thonny, choose MicroPython (Raspberry Pi Pico) as the interpreter at the bottom right and type from umqtt.simple import MQTTClient in the shell. If you get no error, the library came with the firmware and you don't need to install anything.
  3. If you get an ImportError, connect the board to your Wi-Fi network with the code below and download the library straight from the internet with mip.
  4. Alternatively, in Thonny open Tools > Manage packages, search for micropython-umqtt.simple and install it.
  5. After installation you should see the file /lib/umqtt/simple.py in the Pico's file system.
Python
1import network
2import time
3import mip
4
5wlan = network.WLAN(network.STA_IF)
6wlan.active(True)
7wlan.connect("WIFI_ADIN", "WIFI_SIFREN")   # kendi ağ bilgilerin / your network credentials
8
9while not wlan.isconnected():
10    print("Baglaniyor... / Connecting...")
11    time.sleep(1)
12
13print("IP:", wlan.ifconfig()[0])
14mip.install("umqtt.simple")                 # /lib/umqtt/simple.py olarak kurulur / installed as /lib/umqtt/simple.py
15mip.install("umqtt.robust")                 # isteğe bağlı / optional
umqtt.robust is a small layer built on top of umqtt.simple: if the connection drops while publishing or waiting for messages, it tries to reconnect automatically. However, with a clean session it doesn't renew your subscriptions by itself. In this guide we write the reconnection ourselves; that way we can also handle cases where the Wi-Fi connection drops and re-establish the subscriptions every time.

Choosing a free MQTT broker

You don't need to set up your own server to get started. Many companies run public brokers for testing; they ask for no username or password, so you can connect the board and send your first message within minutes. For a permanent project, installing Mosquitto on a Raspberry Pi at home, an old computer or Home Assistant is the most reliable route: your data stays inside your home, and devices on the local network keep messaging each other even if the internet goes down.

BrokerAddressPortNote
HiveMQ public brokerbroker.hivemq.com1883 (TCP)No sign-up, open to everyone
Eclipse Mosquitto test servertest.mosquitto.org1883 (unencrypted), 8883 (TLS)No sign-up, open to everyone
EMQX public brokerbroker.emqx.io1883 (TCP), 8883 (TLS)No sign-up, open to everyone
Home Assistant Mosquitto add-onHome Assistant's local IP address1883Username and password required
Your own Mosquitto serverIP address of your Raspberry Pi or computer1883Full control, works on the local network
Public brokers are open to everyone: someone else can subscribe to your topic or send messages to it. Add a unique prefix to your topic names (for example your initials and a few random digits), don't send passwords or personal information, and don't control real devices such as door locks or sockets through a public broker.

Step by step: publish temperature, subscribe to the LED

The program below does four jobs at once: it connects to your Wi-Fi network, connects to the broker with a unique client ID, subscribes to the bluegrays/picow/led topic and publishes the onboard temperature sensor value to the bluegrays/picow/sicaklik topic every ten seconds. If "ON" arrives on the LED topic the LED turns on, if "OFF" arrives it turns off, and the new state is reported to a separate topic with the retain flag. If you save the file to the Pico as main.py in Thonny, the program starts by itself every time the board powers up.

MicroPython
1import network
2import time
3import machine
4import binascii
5from machine import Pin, ADC
6from umqtt.simple import MQTTClient
7
8SSID = "WIFI_ADIN"                 # Wi-Fi ağ adın / your Wi-Fi name
9PASSWORD = "WIFI_SIFREN"           # Wi-Fi şifren / your Wi-Fi password
10BROKER = "broker.hivemq.com"       # ücretsiz genel broker / free public broker
11PORT = 1883
12MQTT_USER = None                   # Home Assistant için kullanıcı / user for Home Assistant
13MQTT_PASS = None                   # Home Assistant için şifre / password for Home Assistant
14
15CLIENT_ID = b"picow-" + binascii.hexlify(machine.unique_id())   # benzersiz kimlik / unique client id
16TOPIC_TEMP = b"bluegrays/picow/sicaklik"
17TOPIC_LED = b"bluegrays/picow/led"
18TOPIC_LED_STATE = b"bluegrays/picow/led/durum"
19TOPIC_STATUS = b"bluegrays/picow/durum"
20PUBLISH_MS = 10000                 # 10 saniyede bir yayınla / publish every 10 s
21
22led = Pin("LED", Pin.OUT)          # Pico W dahili LED / Pico W onboard LED
23sensor = ADC(4)                    # dahili sıcaklık sensörü / internal temperature sensor
24wlan = network.WLAN(network.STA_IF)
25client = None
26pending_state = None               # bildirilecek LED durumu / LED state to report
27
28
29def read_temp():
30    voltage = sensor.read_u16() * 3.3 / 65535
31    return 27 - (voltage - 0.706) / 0.001721
32
33
34def wifi_connect():
35    wlan.active(True)
36    if wlan.isconnected():
37        return
38    wlan.connect(SSID, PASSWORD)
39    for _ in range(20):            # en fazla 20 saniye bekle / wait up to 20 s
40        if wlan.isconnected():
41            print("IP:", wlan.ifconfig()[0])
42            return
43        time.sleep(1)
44    raise OSError("Wi-Fi baglanamadi / Wi-Fi failed")
45
46
47def on_message(topic, msg):
48    global pending_state
49    print("Mesaj / Message:", topic, msg)
50    if topic == TOPIC_LED:
51        if msg == b"ON":
52            led.on()
53            pending_state = b"ON"
54        elif msg == b"OFF":
55            led.off()
56            pending_state = b"OFF"
57
58
59def mqtt_connect():
60    c = MQTTClient(CLIENT_ID, BROKER, port=PORT, user=MQTT_USER,
61                   password=MQTT_PASS, keepalive=60)
62    c.set_callback(on_message)
63    c.set_last_will(TOPIC_STATUS, b"offline", retain=True)   # koparsa broker yayınlar / broker sends it on drop
64    try:
65        c.connect()
66    except Exception:
67        try:
68            c.sock.close()         # yarım kalan soketi kapat / close the half-open socket
69        except Exception:
70            pass
71        raise
72    c.subscribe(TOPIC_LED)
73    c.publish(TOPIC_STATUS, b"online", retain=True)
74    return c
75
76
77def reconnect():
78    global client
79    delay = 2
80    while True:
81        if client:
82            try:
83                client.sock.close()
84            except Exception:
85                pass
86        try:
87            wifi_connect()
88            client = mqtt_connect()
89            print("MQTT bagli / connected")
90            return
91        except Exception as e:
92            print("Tekrar denenecek / retrying:", e)
93            time.sleep(delay)
94            delay = min(delay * 2, 60)     # üstel bekleme / exponential backoff
95
96
97reconnect()
98last_pub = time.ticks_add(time.ticks_ms(), -PUBLISH_MS)   # ilk yayın hemen / first publish right away
99
100while True:
101    try:
102        client.check_msg()                 # gelen mesaj var mı? / any incoming message?
103        if pending_state:
104            client.publish(TOPIC_LED_STATE, pending_state, retain=True)
105            pending_state = None
106        if time.ticks_diff(time.ticks_ms(), last_pub) >= PUBLISH_MS:
107            last_pub = time.ticks_ms()
108            temp = "{:.1f}".format(read_temp())
109            client.publish(TOPIC_TEMP, temp.encode())
110            print("Yayinlandi / Published:", temp)
111    except Exception as e:
112        print("Baglanti koptu / Connection lost:", e)
113        reconnect()
114    time.sleep_ms(100)
Code partWhat it does
CLIENT_IDCreates a unique ID for each board with machine.unique_id(); two devices connecting with the same ID knock each other off the broker
read_temp()Converts the ADC(4) value to a voltage, then to degrees Celsius with the formula 27 - (V - 0.706) / 0.001721
set_last_will()Makes the broker write "offline" to the status topic if the connection drops unexpectedly; it must run before the connect() call
subscribe()Starts listening to the LED topic; it's called again on every new connection
check_msg()Calls the on_message function if a message has arrived, otherwise returns without waiting
pending_stateInstead of publishing inside the callback, it leaves the state in a variable and the main loop does the publishing
ticks_diff()Measures ten seconds without blocking on sleep, so LED commands are handled without delay
reconnect()Retries the Wi-Fi and MQTT connection at intervals of 2, 4, 8 … up to 60 seconds

After running the program, connect to the same broker with MQTT Explorer on your computer and subscribe to the bluegrays/picow/# topic. You should see a temperature value arrive every ten seconds and "online" on the status topic. To try the LED, publish ON in capital letters to the bluegrays/picow/led topic; the green LED on the board lights immediately and the incoming message is printed in the Thonny shell. If the Mosquitto client tools are installed, you can do the same from the command line with mosquitto_pub -h broker.hivemq.com -t bluegrays/picow/led -m ON. Because the onboard sensor measures the chip's own temperature, it may read a few degrees different from room temperature; for real ambient measurements, connect an external sensor such as the DHT11/DHT22 or BME280 and change read_temp() accordingly.

Reconnecting automatically after a dropped connection

The biggest enemy of an IoT device running at home is dropped connections: the router restarts, the Wi-Fi signal weakens or the broker goes down for maintenance. umqtt.simple doesn't recover on its own in this case; it raises an OSError on the next publish() or check_msg() call. The try/except block in the program catches this error and calls the reconnect() function. The function first closes the old socket, reconnects Wi-Fi if it dropped, then sets up the MQTT connection and subscription from scratch. After each failed attempt the wait time doubles (2, 4, 8, 16, 32, 60 seconds); this is called exponential backoff and stops you from flooding the broker with dozens of attempts per second.

The keepalive value matters too. We set 60 seconds in the code; under the MQTT rules, the broker closes the connection if no packet arrives from the client for 1.5 times this period (that is, 90 seconds). Since we publish every ten seconds, this isn't a problem. But if you stretch the publish interval to, say, five minutes, you need to add regular client.ping() calls; umqtt.simple doesn't send the ping packet automatically. Thanks to the Last Will message, even if the board is unplugged the broker writes "offline" to the status topic once the keepalive period runs out, and Home Assistant shows the device as "unavailable".

  • Keep your Wi-Fi details and broker password in a separate secrets.py file; don't share that file when you share your code.
  • For stability, set up a watchdog timer with machine.WDT(timeout=8000) and call wdt.feed() regularly in the main loop; if the program gets stuck somewhere, the board restarts itself. In that case, keep the waits inside reconnect() under 8 seconds or feed the watchdog while waiting.
  • Publish the measurement at set intervals rather than every loop; to reduce momentary fluctuations, average several readings (sensor data filtering).
  • Use retain for topics where the last value matters, such as the LED state; don't send retained messages to command topics, or the board will re-apply the old command every time it reconnects.
  • If the connection drops often, try turning off the wireless chip's power-saving mode with wlan.config(pm=0xa11140); this reduces latency but increases current consumption.

Connecting the Pico W to Home Assistant

  1. In Home Assistant, install and start the Mosquitto broker add-on under Settings > Add-ons.
  2. Under Settings > People, create a separate user for the Pico W (for example "pico"); this user's name and password are used for the MQTT connection.
  3. Under Settings > Devices & Services, configure the discovered MQTT integration.
  4. Replace the BROKER value in the code with Home Assistant's local IP address (for example 192.168.1.50) and enter the username and password in the MQTT_USER and MQTT_PASS variables.
  5. Add the ha_discovery() function below to your code and call it as ha_discovery(c) after the subscribe() line in mqtt_connect().
  6. Within a few seconds, a new device named "Pico W" appears in the device list, with a temperature sensor and an LED switch under it.
MicroPython
1import json
2import binascii
3import machine
4
5DEVICE_ID = "picow_" + binascii.hexlify(machine.unique_id()).decode()
6DEVICE = {
7    "identifiers": [DEVICE_ID],
8    "name": "Pico W",
9    "manufacturer": "Raspberry Pi",
10    "model": "Pico W",
11}
12
13
14def ha_discovery(c):
15    temp_cfg = {
16        "name": "Sicaklik",
17        "unique_id": DEVICE_ID + "_temp",
18        "state_topic": "bluegrays/picow/sicaklik",
19        "unit_of_measurement": "°C",
20        "device_class": "temperature",
21        "availability_topic": "bluegrays/picow/durum",
22        "device": DEVICE,
23    }
24    led_cfg = {
25        "name": "LED",
26        "unique_id": DEVICE_ID + "_led",
27        "command_topic": "bluegrays/picow/led",
28        "state_topic": "bluegrays/picow/led/durum",
29        "payload_on": "ON",
30        "payload_off": "OFF",
31        "availability_topic": "bluegrays/picow/durum",
32        "device": DEVICE,
33    }
34    base = DEVICE_ID.encode()
35    # JSON'u bytes olarak gönder (°C çok baytlıdır) / send JSON as bytes (°C is multi-byte)
36    c.publish(b"homeassistant/sensor/" + base + b"/temp/config",
37              json.dumps(temp_cfg).encode(), retain=True)
38    c.publish(b"homeassistant/switch/" + base + b"/led/config",
39              json.dumps(led_cfg).encode(), retain=True)
40
41# mqtt_connect() içinde subscribe() satırından sonra çağır / call after subscribe() in mqtt_connect()
42# ha_discovery(c)

By default Home Assistant listens to topics starting with the homeassistant/ prefix. When the Pico W sends a JSON configuration to these topics with the retain flag, Home Assistant creates the entities automatically: the sensor configuration shows the temperature as a value you can chart, while the switch configuration adds an on/off switch to the interface. When you tap the switch, Home Assistant publishes "ON" or "OFF" to the command_topic, the board changes the LED and writes the new state to the state_topic; this way the switch in the interface always shows the real state. The availability_topic field uses the Last Will message to grey out the entities when the board goes offline. If you'd like to see the same structure on the ESP32 side, take a look at ESP32 MQTT and Home Assistant.

Project ideas with the Pico W and MQTT

  • Room temperature and humidity dashboard: put a Pico W and a DHT22 in every room and watch the whole house on one screen with topics such as home/livingroom/temperature.
  • Remote-controlled lamp: drive a relay module instead of the LED and switch the lamp on and off from Home Assistant.
  • Plant watering notification: publish the soil moisture sensor value and send a notification to your phone with an automation when the soil dries out.
  • Motion alarm: publish a message to the home/hallway/motion topic when the PIR sensor is triggered.
  • Aquarium thermometer: measure the water temperature with a DS18B20 and send a retained warning message when a threshold is exceeded.
  • Compare with a web interface: control the same LED with a Pico W web server too and see the difference between the two methods.

Common mistakes and how to fix them

SymptomLikely causeFix
ImportError: no module named 'umqtt'The library isn't in the firmwaremip.install("umqtt.simple") or the Thonny package manager
Wi-Fi won't connect5 GHz network, wrong password or weak signalUse a 2.4 GHz network, print wlan.status(), move the board closer to the router
OSError during connect()The broker address couldn't be resolved or there's no network connectionCheck wlan.isconnected() first, and write the broker name and port correctly
MQTTException: 4 or 5Wrong username or password, not authorisedCheck the Home Assistant user and password
Connection drops after about 90 secondsNo packet is sent during the keepalive periodPublish regularly or add client.ping()
Messages never arrivecheck_msg() isn't called in the loop or set_callback() was forgottenCall set_callback() before subscribe(), and use check_msg() in the loop
The comparison is always falseTopic and message arrive as bytes and you compare with strUse bytes constants such as b"ON"
Two boards keep knocking each other offThe same CLIENT_ID is usedGenerate a unique ID with machine.unique_id()
When debugging, test the chain piece by piece: does wlan.isconnected() return True in the shell, does a message you publish from MQTT Explorer show up on the Pico, and does the Pico's publish reach MQTT Explorer? With these three steps you can tell within minutes whether the problem is on the Wi-Fi, broker or code side. For general Wi-Fi tips, the checklist in ESP32 Won't Connect to Wi-Fi largely applies to the Pico W as well.

Once MQTT is set up, every new sensor or output you add to the board is just a new topic; the infrastructure stays the same. First run the program in this guide with the onboard LED and temperature sensor, then expand it with a relay and external sensors. If you'd like to reinforce basics such as LEDs, buttons and PWM in MicroPython, you'll find the circuit diagram and code for every step in the Raspberry Pi Pico projects in the BlueGrays app.

Frequently asked questions

Can I use MQTT with a regular Raspberry Pi Pico?

No. A plain Pico has no Wi-Fi or Ethernet, so it can't connect to a broker directly. For MQTT you need the Pico W or Pico 2 W with the wireless chip. A plain Pico can only get online with an external Wi-Fi or Ethernet module, which makes the setup considerably more complicated.

What is the difference between umqtt.simple and umqtt.robust?

umqtt.simple is a very small client that handles basic MQTT operations such as connecting, publishing and subscribing, and it raises an error when the connection drops. umqtt.robust is built on top of it and tries to reconnect automatically on errors. However, it doesn't renew subscriptions by itself, so you still have to call subscribe() again after reconnecting.

What is the best free MQTT broker?

For testing, broker.hivemq.com, test.mosquitto.org and broker.emqx.io are public brokers that need no sign-up and run on port 1883. Because they're open to everyone, you should only send test data to them. For a permanent and secure setup, installing Mosquitto on a Raspberry Pi at home or on Home Assistant is the best free option.

How do I add the Pico W to Home Assistant?

Install the Mosquitto broker add-on and the MQTT integration in Home Assistant, and create a separate user for the Pico W. Connect the board to Home Assistant's IP address with that user and publish a retained discovery configuration to topics starting with homeassistant/. Home Assistant then creates the sensor and the switch automatically.

Why does my Pico W MQTT connection keep dropping?

The most common cause is that no packet is sent within the keepalive period; umqtt.simple doesn't send the ping packet automatically, so you need a regular client.ping() or publish. A weak Wi-Fi signal, the router restarting and a second device using the same client ID can also cause drops. Writing your code to catch OSError and reconnect solves all of these cases.

Can I use TLS (port 8883) with MQTT on the Pico W?

Yes. You can make an encrypted connection on port 8883 with the ssl parameter of the umqtt.simple library; in current MicroPython versions you pass this parameter a context created with ssl.SSLContext. The TLS handshake can take a few seconds on the RP2040 and increases RAM usage. Cloud brokers such as HiveMQ Cloud usually require a TLS connection.

See all projects
Raspberry Pi Pico Onboard LED Blink (Pico and Pico W)
PI-1Beginner

Raspberry Pi Pico Onboard LED Blink (Pico and Pico W)

The opening project of the Raspberry Pi Pico series! We blink the Pico's green built-in LED to confirm the board works, the classic "Hello World" first experiment. No external parts needed, just the Pico and a USB cable. The code is written in MicroPython, the language officially supported by the Raspberry Pi Foundation.

5.0(1)
10
Raspberry Pi Pico: Controlling an External LED (Breadboard)
PI-2Beginner

Raspberry Pi Pico: Controlling an External LED (Breadboard)

The next step after the Pico's built-in LED: connect an external LED on a breadboard and control it through pin GP14. You'll learn how to use any of the Pico's GPIO pins as an output, the LED's polarity (long leg = anode/+, short leg = cathode/–) and why a current-limiting resistor (220Ω) is a must. Without the resistor, too much current flows through the LED and it can burn out.

4.5(2)
7
Raspberry Pi Pico Button Controlled LED (Push)
PI-9Beginner
Premium

Raspberry Pi Pico Button Controlled LED (Push)

First input project with Pico — button read! LED lights while button is pressed, off when released. This is the big step after LED animations: signal input from the world to Pico. Learn Pin.IN (input mode), Pin.PULL_UP (internal pull-up resistor — standard for buttons), button.value() reading. GP14 LED, GP2 button (internal PULL_UP). Pressed = LOW (0), released = HIGH (1) — reverse logic seems confusing at first but is industry standard.

11
Raspberry Pi Pico Button Toggle LED
PI-10Beginner

Raspberry Pi Pico Button Toggle LED

Button + LED — next level! Unlike the basic button project, there is no need to hold the button. Press and release → LED on. Press and release again → LED off (toggle). Same circuit (LED GP14, Button GP2), but big code difference. Learn edge detection (capturing the 1→0 falling moment), state tracking, debounce (mechanical bounce filter). MicroPython's led.toggle() swaps state in one line. Foundation of all interactive button projects (mode switcher, IRQ, double-click).

10
Raspberry Pi Pico PWM LED Fade (Breathing Effect)
PI-14Beginner

Raspberry Pi Pico PWM LED Fade (Breathing Effect)

The LED doesn't just blink anymore, it breathes! With the Raspberry Pi Pico's PWM (Pulse Width Modulation), the LED's brightness slowly rises and then slowly fades, a calm "breathing" effect like a sleeping laptop's light. You'll learn the machine.PWM class, the 16-bit brightness value from 0–65535 with duty_u16() and the PWM frequency.

4
Raspberry Pi Pico RGB LED Color Cycle (3-Channel PWM)
PI-15Beginner

Raspberry Pi Pico RGB LED Color Cycle (3-Channel PWM)

One LED, millions of colors! An RGB LED actually holds 3 separate LEDs: red, green and blue. Set the brightness of each one separately with the Pico's 3 PWM channels and the colors mix: red + green = yellow, green + blue = cyan, all three = white. In this project the LED cycles through 8 colors.

6
ESP32 Wi-Fi STA Connection (with LCD Screen)
ES-25Advanced

ESP32 Wi-Fi STA Connection (with LCD Screen)

In this project, we connect the ESP32 to the home Wi-Fi network in Station (STA) mode in a secure, fault-tolerant manner. We store the SSID and password in a separate secrets.h file to prevent leaking to Git, set up an auto-reconnect mechanism, and display the RSSI signal level and IP address on an I2C LCD screen. The internal LED works as a status indicator. It is a production-grade connection manager.

4.4(21)
38
ESP32 Asynchronous Web Server (with IP Display on LCD)
ES-27Advanced

ESP32 Asynchronous Web Server (with IP Display on LCD)

In this project, we’re turning the ESP32 into an asynchronous web server that you can control from your phone or computer on the same Wi-Fi network. Thanks to the ESPAsyncWebServer library, the server can process multiple requests simultaneously (unlike the classic WebServer.h, which blocks on a single request). You’ll be able to open the ESP32’s IP address in a browser and click the ON/OFF buttons (the /on and /off routes) to turn the LED connected to GPIO 5 on and off.

4.8(16)
26