/covidticker

A wall-mounted ticker, which updates hourly with the total number of COVID-19 deaths for the United States and Los Angeles county.

Primary LanguagePython

covidticker

fetch latest data and deploy to Adafruit IO

How many people have died in the United States and in Los Angeles county during the COVID-19 pandemic? Every hour, fetch the data and display it on a wall-mounted LED display ticker.

wall-mounted LED display ticker on January 23, 2021

A Python script pulls data from the following sources:

The data is recorded on Adafruit IO and is updated hourly using a scheduled GitHub Action. Johns Hopkins and LA Times are the primary data sources for US and LA county deaths, respectively. Their figures are typically ahead of the data published by the CDC and CDPH. However, we collect CDC and CDPH data for comparison, and as backups for display on the ticker.

Adafruit IO dashboard on January 23, 2021

Code written in CircuitPython runs on an Adafruit Matrix Portal circuit board, powered by USB-C. The Matrix Portal uses the MQTT protocol to receive data posted on Adafruit IO. It is connected to an RGB LED matrix, which serves as the LED display ticker.

Adafruit IO feeds

If you don't already have one, you'll also need to setup an Adafruit IO account with the following feeds. The first 4 feeds store the US and LA county deaths from a scheduled GitHub Action. The next 4 feeds can be controlled from a dashboard (pictured above) to change the LED display's appearance or performance. The final 2 feeds monitor the LED display for crashes and errors.

feed name key description
US deaths (JHU) us-deaths-jhu COVID-19 deaths in the United States, according to Johns Hopkins University
US deaths (CDC) us-deaths-cdc COVID-19 deaths in the United States, according to the CDC
LA deaths (LAT) la-deaths-lat COVID-19 deaths in Los Angeles County, according to the LA Times
LA deaths (CDPH) la-deaths-cdph COVID-19 deaths in Los Angeles County, according to the CA Dept of Public Health
JHU-CDC jhu-cdc toggle US data source between Johns Hopkins or Centers for Disease Control
LAT-CDPH lat-cdph toggle LA county data source between LA Times or CA Dept of Public Health
LED color led-color choose a text color for the LED matrix display
loop delay loop-delay how many seconds to wait between executions of the main loop?
still alive? still-alive if 1: LED display is still alive; if 0 (for a long time): it has crashed
reset reset reset button to manually reconnect LED display to Adafruit IO server

Webhooks

The Python script publishes data to Adafruit IO using webhooks. You'll need to generate your own unique webhook URLs for the first 4 feeds listed above, and replace the URLs in each of the requests.post() calls in the send_data() method. For example, the us-deaths-jhu feed would look like this:

requests.post('[INSERT WEBHOOK URL HERE]', json={'value': us_jhu})

More information is available in the docs and this blog post.

Hardware required

Usage

  1. Install CircuitPython on your Matrix Portal board. Also see detailed instructions here.
  2. Copy the files from the matrixportal folder onto the CIRCUITPY volume on your Matrix Portal board.
  3. Create a secrets.py file on the CIRCUITPY volume. Follow these instructions to save your private logins for WiFi and for Adafruit IO in secrets.py. (Note: if you don't want to store your WiFi password in plaintext, you can use the wpa_passphrase utility to store an encrypted hash of your password instead. See the Adding the network details to the Raspberry Pi section in this page for instructions.)
  4. Use the Mu editor to test if the code is working. Activate the serial console to see any print() statements on your screen.
  5. Connect the Matrix Portal board to your LED matrix display. Plug a USB-C power supply into the Matrix Portal to turn it on.

Acknowledgements

This project was heavily inspired by these projects:

Installation at California Science Center

All in This Together exhibit on display at the California Science Center in Los Angeles.