Skip to content

JiyaMehta-6/30-MicroPython-Patterns-for-ESP32-ESP8266-IoT-Development

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MicroPython ESP Projects

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.


Supported Hardware

This repository focuses on:

  • ESP8266
  • ESP32

Most examples work on both boards with minimal changes.


Repository Structure

Each example contains:

  • main.py → working code
  • concept.txt → explanation

Example Categories

Networking Fundamentals

  1. Connect to WiFi
  2. Automatic WiFi reconnect
  3. Scan available networks
  4. Device configuration via Access Point
  5. Store WiFi credentials in flash

HTTP Applications

  1. Send HTTP GET request
  2. Send HTTP POST data
  3. Read JSON API
  4. Simple REST client
  5. Periodic cloud data upload

Web Servers on ESP

  1. Local web server
  2. Control LED from browser
  3. Web dashboard
  4. Sensor data webpage
  5. Web-based device configuration

IoT Communication

  1. MQTT publish
  2. MQTT subscribe
  3. MQTT sensor reporting
  4. Device command control
  5. MQTT reconnect logic

Data Handling

  1. JSON parsing
  2. JSON device status report
  3. Data logging to flash
  4. Rolling log system
  5. Sensor data buffering

Device Management

  1. Configuration file system
  2. Boot configuration loader
  3. Safe reboot system
  4. Factory reset mechanism
  5. Device status reporting

Getting Started

1. Flash MicroPython Firmware

Download firmware:

https://micropython.org/download/

Flash using esptool: esptool.py erase_flash esptool.py write_flash -z 0x1000 firmware.bin


2. Upload Code

You can upload scripts using:

  • Thonny
  • mpremote
  • ampy
  • rshell

Example using mpremote: mpremote connect /dev/ttyUSB0 fs cp main.py :


Goal of This Repository

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.


License

MIT License

About

30 practical MicroPython patterns for ESP32 and ESP8266 covering WiFi, HTTP, MQTT, web servers, data logging, and real IoT applications.

Topics

Resources

License

Stars

2 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages