DEV Community

Cover image for ๐Ÿ’ป MicroPython on a $3 Board: Real-Time IoT Dashboard with Zero Cloud Costs!
Yevhen Kozachenko ๐Ÿ‡บ๐Ÿ‡ฆ
Yevhen Kozachenko ๐Ÿ‡บ๐Ÿ‡ฆ

Posted on • Originally published at ekwoster.dev

๐Ÿ’ป MicroPython on a $3 Board: Real-Time IoT Dashboard with Zero Cloud Costs!

๐Ÿ’ป MicroPython on a $3 Board: Real-Time IoT Dashboard with Zero Cloud Costs!

If you think you need a Raspberry Pi, AWS, or thousands of dollars to build real-time IoT dashboards, youโ€™ll be blown away by what MicroPython and a $3 ESP8266 board can do.

In this post, weโ€™ll walk through how to use MicroPython on the popular ESP8266 microcontroller to stream sensor data (like temperature and humidity) directly to a real-time web dashboard โ€” no cloud platform, no third-party services, and no cost beyond your WiFi and coffee.

This is not a toy example. We'll build an actual live dashboard that runs entirely on the chip using HTTP and WebSocket protocols. This is the power of embedded servers + Python + modern web tech.


๐Ÿง  Why MicroPython?

Most people know Python as a desktop/server scripting language, but MicroPython is a lean, efficient implementation of Python meant to run on microcontrollers.

Benefits:

  • Full control in Python โ€” ditch the C headaches
  • Tiny memory footprint (can run with 128KB RAM!)
  • Rapid prototyping for IoT and hardware hacking
  • Built-in modules for networking, file I/O, and peripherals

Supported Boards: ESP8266, ESP32, STM32, and many others.


๐Ÿ› ๏ธ The Hardware Setup

  • Microcontroller: NodeMCU / WeMos D1 Mini (ESP8266, ~$3)
  • Sensor: DHT11 or DHT22 (Temperature + Humidity)
  • USB cable + Laptop

Wiring:

DHT11 -> ESP8266
VCC   -> 3.3V
GND   -> GND
DATA  -> D4 (GPIO2)
Enter fullscreen mode Exit fullscreen mode

๐Ÿงช Step 1: Flashing MicroPython

Download MicroPython firmware.

Flash it using esptool.py:

pip install esptool
esptool.py --port /dev/ttyUSB0 erase_flash
esptool.py --port /dev/ttyUSB0 --baud 460800 write_flash --flash_size=detect 0 <firmware-file>.bin
Enter fullscreen mode Exit fullscreen mode

Now connect with REPL via screen or Thonny IDE.


๐Ÿ“ฆ Step 2: The MicroPython Web Server

Letโ€™s host a tiny server that:

  • Reads the sensor values
  • Serves a basic HTML page
  • Uses WebSocket for real-time updates

main.py

import network
import socket
import uasyncio as asyncio
from machine import Pin
import dht
...

loop = asyncio.get_event_loop()
loop.create_task(asyncio.start_server(serve_client, "0.0.0.0", 80))
loop.run_forever()
Enter fullscreen mode Exit fullscreen mode

Upload main.py using ampy or WebREPL.


๐Ÿš€ Run and View

  1. Power up the ESP8266
  2. Open your browser and navigate to the IP (e.g., 192.168.1.42)
  3. Watch real-time sensor data update every 2 seconds โ€” no refresh!

๐Ÿง  What's Happening Under the Hood?

  • ESP8266 runs both a simple HTTP server and WebSocket logic
  • On every connection, the WebSocket stream pushes fresh sensor data
  • The client reads and updates the DOM โ€” all without any cloud services

๐Ÿšจ Downsides to Be Aware Of

  • The ESP8266 has limited RAM (~50KB usable)
  • No SSL/TLS support in MicroPython (don't expose over the internet unprotected)
  • WebSocket over HTTP, not secure WebSocket (wss)

But for LAN dashboards, DIY home sensors, or educational demos, this is magic.


๐Ÿงฑ How to Scale This Up

You can extend the setup to multiple sensors or rooms:

  • Add routing paths to serve different sensors
  • Hook in a lightweight frontend framework like Vue.js or HTMX
  • Push data to a local server on a Raspberry Pi or local NAS

Want historical data? Use SPIFFS on the flash or store logs over HTTP to your own backend.


๐Ÿ”Œ TL;DR

  • MicroPython turns $3 boards into real-time web servers
  • No cloud, no Node.js, no database required
  • Great for hobbyists & pros alike looking to prototype fast

With simple Python scripts and a basic HTML front, you can run your own server at the edge โ€” powered by 3 bucks and your love for code.


โšก Related Tools You Might Love

  • mpfshell: File management on MicroPython devices
  • uasyncio: Async tasks in MicroPython
  • Thonny IDE: Friendly IDE with MicroPython support

๐Ÿ’ฌ Letโ€™s Chat!

Have a question or want to share your setup? Drop it in the comments โ€” or tweet it with hashtag #MicroPythonDash ๐Ÿ๐Ÿ“Š


๐Ÿ‘‰ If you need help taking your IoT or hardware idea from prototype to production โ€“ we offer research and development services.

Top comments (0)