Device to warn of potential asteroid impacts


Know when to panic! 🌎🌠😱

I built a device to warn of potential Earth-threatening asteroids. It monitors NASA JPL’s Sentry web service using a Raspberry Pi Pico W and CircuitPython. This is a description of how it’s made.

Source code and design files for this project are available on GitHub.

This device is based on a project by Jeff Epler.

The Sentry System

NASA’s Jet Propulsion Laboratory operates the Sentry system which keeps track of Earth-approaching asteroids, predicts their orbits, and assigns each one a threat level indicating its impact risk.

The Sentry system provides a web API to query its database and return results in JSON format. This device uses that to get information about the asteroids that are most likely to hit the Earth.

Device Operation

Periodically, an HTTP request is sent over wifi to the Sentry web service to query for the asteroids with the highest threat levels. Typically 6 or 7 objects are returned. This list is compared to the results from the previous request.

If the new results have any objects that did not appear in the previous results, or if the threat level of any of the objects has increased since the previous request, then an alert message is displayed on the OLED display and an alert sound is played. The device then waits for the pushbutton to be pressed, to make sure that the alert is seen.

If no new threats are found, “No new threats” is displayed for a few seconds, then the device waits for an hour before querying the Sentry service again. If the pushbutton is pressed, it will stop waiting and do the next check immediately.


The Pico W connects to the internet via wifi, and it is also connected to an OLED display, an I2S audio amplifier, and a pushbutton. A PiCowbell proto board hooks things together.

The bill of materials (parts list) is here, in spreadsheet-friendly text format.

Here is a wiring diagram and photo showing how the components are connected. (A Fritzing file is here.)

wiring diagram wiring photo

Note that special cables are required for the OLED display and the speaker. To connect the Pico W to the I2S board, I made a cable using header connectors, but those wires can be soldered directly point-to-point.

The Pico W is stacked on top of the PiCowbell board using header connectors, as shown below.

Pico W and PiCowbell Pico W and PiCowbell


The firmware that runs on the Pico W has to perform several tasks:

CircuitPython makes it easy to write code to do all of that.

Installing CircuitPython

CircuitPython must be installed on the Pico W, if it isn’t already. Click here for instructions.

Downloading the Code

The CircuitPython program and associated libraries are published on GitHub and can also be downloaded in a .zip file.

To get it running on the Pico W:

  1. Download the .zip file to your computer and uncompress it.
  2. Connect the Pico W to your computer with a USB cable. It should show up as a drive named CIRCUITPY.
  3. Copy the files from the uncompressed .zip bundle to the CIRCUITPY drive.
  4. Use a text editor to open the file settings.toml on the CIRCUITPY drive and edit it to contain the correct wifi network name and password. It should look something like this:


  5. When the settings.toml file is saved, the program should restart and after a few seconds the OLED display should show “Fetching data”. If that doesn’t happen, unplug and replug the USB cable.

Optional: If you copy an audio file named alert.wav to the CIRCUITPY drive, that sound will be played whenever an asteroid alert message is displayed. The alert.wav file should be a brief audio clip in WAV format.

Once the device is set up and running, it no longer needs to be connected to a computer – it may be plugged into a USB power supply instead.

Code Details

The CircuitPython code running in this device is over here on GitHub.

The Sentry system’s web API is documented here.

Several CircuitPython libraries are used which are not included in the base CircuitPython distribution. These libraries are included in the firmware download (see above).

Thanks to jepler for the WrappedTextDisplay class, borrowed from here.


I made a simple case out of heavy cardboard (chipboard), covered with with printed and painted decoration on adhesive paper, with clear adhesive lamination for protection.

Inside is a mess of wires and hot glue, but apparently the electrons don’t mind.

case inside