Live level and temperature readings from my water container.
Project
A MicroPython project built on the Raspberry Pi Pico W that monitors water-container level and three temperature sensors (air, inlet, water), shows live readings on a 128×64 OLED, and uploads data to ThingSpeak over WiFi. The pump itself runs on its own automatic controller — this is a safety net: a ThingSpeak action pings me on Telegram if the container stays empty, meaning something has gone wrong and the pump isn't recovering on its own. The temperatures are mostly for curiosity, and for deciding when to add heating to the container over winter. Configuration can be changed from any browser on the local network — no re-flashing required.
Pico W
MicroPython
ThingSpeak
HTTP · channels
This page
live dashboard
Telegram
pump-failure alert
| GPIO | Function | Direction |
|---|---|---|
| 5 | Water level sensor 1 (lower) | Input, pull-down |
| 6 | Water level sensor 2 (upper) | Input, pull-down |
| 9 | DS18B20 OneWire data | — |
| 10 | Mode pin 1 | Output |
| 11 | Mode pin 2 | Output |
| 13 | OLED toggle button | Input, pull-up |
| 26 | OLED SDA (I²C1) | — |
| 27 | OLED SCL (I²C1) | — |
Runs every 100 ms. Feeds a 15-second hardware watchdog, reads temperatures and water level on separate intervals, uploads to ThingSpeak, checks the OLED button, and handles web-config requests.
SSD1306 over I²C. Updates are batched into a single flush to minimise bus traffic and keep the main loop responsive.
A non-blocking HTTP server on port 80 exposes a form for WiFi credentials, API keys, and intervals. Submissions are written to config.json and the device reboots.
Temperature values upload every cycle; water-level uploads only fire on state change. The pump runs on its own automatic controller — a ThingSpeak action pings Telegram only as a safety net when the container stays empty, i.e. the pump failed to recover on its own.
. ├── main.py # Entry point — main loop, watchdog, button, scheduling ├── config.py # Defaults + config.json override loader ├── networking.py # WiFi connect + ThingSpeak HTTP uploads ├── sensors.py # DS18B20 temperature + water-level sensors ├── oled_display.py # SSD1306 rendering helpers ├── web_config.py # HTTP server for browser-based configuration └── README.md
Live readings
Level updated 18 Apr, 20:33 · temps updated 19 Apr, 00:48
9.9°C
9.2°C
10.0°C