Thanks to visit codestin.com
Credit goes to github.com

Skip to content

mrcxmrj/meteo-station

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

85 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Raspberry Pi Pico Meteo Station

Full-stack web application for Raspberry Pi Pico WH, displaying data gathered from connected sensors in the form of an interactive dashboard.

Running the project

First make sure the Pi Pico is connected to the approprate port (my setup script assumes it is /dev/ttyACM0):

ls /dev | grep ttyACM

Then run the setup script to setup the virtual environment, Wi-Fi config and some useful aliases:

source setup.sh

Finally, use the run alias to run the project:

run src/main.py

Technologies used

I used the hottest tech stack in the web-apps-for-microcontrollers world:

  • MicroPython
  • Txt
  • Vanilla JS
  • Pico CSS
  • Lightweight Charts

Circuit

Schema Result
schema circuit image

Software architecture

The server has been implemented according to this very serious UML diagram:

uml diagram

Notes

SSR vs CSR

As you can see, the web dashboard is implemented using Server Side Rendering and HTML As The Engine Of State (mostly) with some JS to prevent additional page refreshes. The reason behind this decision is I have recently been reading too much about htmx and React Server Components. If you're considering writing your own application based on this one, I suggest implementing your own frontend as a SPA with a fully JSON API, as rendering templates on the Pico is expensive and may lead to memory shortages.

Manual garbage collection

Additionally, if you're creating a lot of temporary objects, make sure to manually trigger garbage collection to prevent memory fragmentation:

# server.py
import gc
# this runs after sending responses to clean up all UI component objects
gc.collect()

Preview

Table view Chart view - pressure Chart view - temperature

Credits

dafvid/micropython-bmp280 - custom driver for BMP280

About

Project for Complex Digital Systems at AGH UST

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published