30 practical MicroPython patterns for building real ESP8266 / ESP32 IoT applications.
Most tutorials teach MicroPython using trivial examples like blinking LEDs.
This repository focuses instead on practical applications and reusable embedded concepts used in real IoT systems.
Each example demonstrates:
• A real-world use case
• A reusable programming pattern
• A small, understandable codebase
The goal is to help developers understand how embedded applications are actually structured, not just how to toggle pins.
This repository focuses on:
- ESP8266
- ESP32
Most examples work on both boards with minimal changes.
Each example contains:
main.py→ working codeconcept.txt→ explanation
- Connect to WiFi
- Automatic WiFi reconnect
- Scan available networks
- Device configuration via Access Point
- Store WiFi credentials in flash
- Send HTTP GET request
- Send HTTP POST data
- Read JSON API
- Simple REST client
- Periodic cloud data upload
- Local web server
- Control LED from browser
- Web dashboard
- Sensor data webpage
- Web-based device configuration
- MQTT publish
- MQTT subscribe
- MQTT sensor reporting
- Device command control
- MQTT reconnect logic
- JSON parsing
- JSON device status report
- Data logging to flash
- Rolling log system
- Sensor data buffering
- Configuration file system
- Boot configuration loader
- Safe reboot system
- Factory reset mechanism
- Device status reporting
Download firmware:
https://micropython.org/download/
Flash using esptool:
esptool.py erase_flash
esptool.py write_flash -z 0x1000 firmware.bin
You can upload scripts using:
- Thonny
- mpremote
- ampy
- rshell
Example using mpremote: mpremote connect /dev/ttyUSB0 fs cp main.py :
This project aims to teach practical embedded programming patterns, including:
- network communication
- web interfaces
- cloud interaction
- device configuration
- data handling
Instead of isolated hardware demos, the examples focus on building blocks used in real IoT systems.
MIT License