This is code powering a little desktop project to create a "physical progress bar" or an "ambient information display".
The device itself consists of a Raspberry Pi Pico W connected to three LEDs (red, green, and blue) and an analog ammeter. By performing PWM on the outputs to these devices, they render any arbitrary number between 0 and 100. The Pico also has an onboard temperature sensor which is reported as part of the device's state. A WiFi interface provides the bidirectional upstream link to the cloud.
The device runs MicroPython and libraries sufficient to interact with the AWS IoT service. The IoT service offers a "device shadow" functionality that helps the device to track what updates are needed locally to reflect the desired state of the device.
The data feed to the meter is powered by the meter Python package in
this repository. It runs as a terminal app on the user's desktop, and
computes the desired state of the meter based on the selected source
of info. Any potential numerical source that can be retrieved
automatically and mapped to a 0-100 scale is suitable as an
information source. The sources will evolve as the meter is used, but
currently include:
InsideTemp: The temperature from the Pico's onboard temperature sensorOutsideTemp: Current weather conditions from Open-Meteo.comOctoPrint: 3D Printer completion progressSfnMapRun: AWS Step Functions Map Run progressCloudWatchAlarm: Status of an AWS CloudWatch alarmCloudWatchLogs: Retrieve a numerical value from CloudWatch LogsPomodoro: A simple Pomodoro timer for scheduling work and break periodsCountdownTimer: A countdown timer, to a time or durationMeetings: Progress bar through your meetingsTraeger: Temperature probe data from Traeger WiFire grills