How fboegard/m5_nightscoutmon works
Project type and purpose
• This is an embedded IoT full-stack application running on an M5Stack (ESP32) device.
• Purpose: periodically fetch blood-glucose (“BG”) data from a Nightscout server over Wi-Fi, display it (and optional sensor readings) on a small LCD, log errors, sound alarms, provide a simple web-based config interface, and read configuration/images from an SD card.
File structure
• Top-level firmware sources:
• M5_NightscoutMon.ino (main Arduino sketch)
• DHT12.cpp/.h, SHT3X.cpp/.h (environment sensors)
• IniFile.cpp/.h (INI parser)
• M5NSconfig.cpp/.h, M5NSWebConfig.cpp/.h (configuration & embedded web server)
• externs.h (global declarations)
• iot_iconset_16x16.c (graphics)
• Free_Fonts.h (fonts)
• PlatformIO folder: preconfigured VSCode/Platform.IO project
• Binaries folder: compiled .bin artifacts
• SD folder: default M5NS.INI example
• images folder: JPEG boot screens
README for additional insights
• Architecture is monolithic firmware on ESP32 but logically split into:
• Initialization: mount SD, parse M5NS.INI (nightscout URL, Wi-Fi SSIDs, thresholds, pages)
• Networking: connect to one of up to 9 Wi-Fi SSIDs → HTTP GET Nightscout JSON via ArduinoJson
• UI: update three display pages + optional error/log page
• Sensors: read DHT12 or SHT3X if present for temperature/humidity
• Alarm & input handling: buttons for brightness, page sweep, snooze/sleep
• Web server: optional lightweight HTTP server for remote config