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.
A Python script pulls data from the following sources:
- US deaths
- CSSEGISandData/COVID-19 by Johns Hopkins University Center for Systems Science and Engineering
- Centers for Disease Control (CDC)
- LA County deaths
- datadesk/california-coronavirus-data by The Los Angeles Times
- California Department of Public Health (CDPH)
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.
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.
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 |
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.
- Adafruit Matrix Portal - CircuitPython Powered Internet Display
- 64x32 RGB LED Matrix - 6mm pitch (Note: if you don't need something this big, other 64x32 displays with smaller spacing between pixels (i.e., pitch) should also work: 5mm, 4mm, or 3mm)
- Official Raspberry Pi Power Supply 5.1V 3A with USB C - 1.5 meter long (or similar USB-C power supply)
- Install CircuitPython on your Matrix Portal board. Also see detailed instructions here.
- Copy the files from the matrixportal folder onto the CIRCUITPY volume on your Matrix Portal board.
- 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.)
- Use the Mu editor to test if the code is working. Activate the serial console to see any print() statements on your screen.
- Connect the Matrix Portal board to your LED matrix display. Plug a USB-C power supply into the Matrix Portal to turn it on.
This project was heavily inspired by these projects:
- Adafruit: Matrix Portal New Guide Scroller
- Hackaday: Stay Informed: How To Pull Your Own COVID-19 Data
- simonw/covid-19-datasette, deploys an API to https://covid-19.datasettes.com/ with JHU & LA Times data
- julianbruegger/corona-display, an LCD ticker run by a Raspberry Pi
- Adafruit: Network Connected RGB Matrix Clock
- Adafruit: Tombstone Matrix Portal
All in This Together exhibit on display at the California Science Center in Los Angeles.