Pi Pico 2W Planetarium
by 101thingsvlog in Circuits > Electronics
6313 Views, 103 Favorites, 0 Comments
Pi Pico 2W Planetarium
The Pi Pico Planetarium is a compact, low-cost astronomy viewer built around the Raspberry Pi Pico 2W and a 480x320 ST7796 TFT display. Designed with both beginners and experienced hobbyists in mind, it offers a hands-on introduction to microcontrollers, electronics, and astronomy, while remaining flexible and expandable for more advanced use. The device displays a real-time map of the night sky, including stars, constellations, planets, the Moon, and deep sky objects. By using Wi-Fi to retrieve accurate time data via NTP, the planetarium keeps the star chart aligned with the user’s current time and location.
Supplies
- 1 off 480x320 ST7796 TFT Display https://shorturl.at/H14Pt
- 1 off Raspberry Pi Pico 2W https://shorturl.at/7EYhl
- 4 off Tactile buttons 6mm https://shorturl.at/IHNVn
- 1 off 3D-printed enclosure (optional) https://github.com/dawsonjon/Pico-Planetarium/tree/main/enclosure
Links are for illustrative purposes and not necessarily recommendations.
Build Circuit
The planetarium uses NTP to update the time via the Wi-Fi capabilities of the Pico 2W. This feature can be disabled at compile time if using a microcontroller without Wi-Fi.
While ILI9341 SPI displays are supported, the higher resolution of the ST7796 (480x320) makes it more suitable here. The display requires a 300 KB frame buffer, which exceeds the 264 KB RAM of the original Pico but fits within the 520 KB of the Pico 2 and Pico 2W.
The ST7796 display I used has an SPI interface, and is inexpensive and widely available. I chose a 4.0-inch version. Ensure the display you choose supports SPI and is supplied with the correct voltage. Some displays allow selection between 5v and 3.3v using a jumper.
Displays with 3.3v I/O are directly compatible with the Pico. The “4-wire” SPI interface requires only MOSI and SCK, along with chip select (CS) and data/command (DC) lines. While the display includes a hardware reset pin, it can be safely tied to 3.3v, and I have found software reset to be reliable.
See the attached images for the wiring of the display and the buttons.
3D Printed Enclosure
If you want to build a 3D printed enclosure for this project, you can grab the .stl files here: https://github.com/dawsonjon/Pico-Planetarium/tree/main/enclosure
Get the Code
The code is available on github.The Planetarium code is written in pure C++, but a demo application is provided as an Arduino sketch in the "pico_planetarium" folder.
Install Arduino IDE
Download and install the Arduino IDE.
Install Arduino-Pico
The Arduino Pico port by Earle Philhower is probably the easiest way to install and configure a C++ development environment for the Raspberry Pi Pico. Its possible to install the tool and get up-and running with example applications in just a few minutes. Refer to the installation instructions and the online documentation to get started.
Upload Sketch to Pico
- From Arduino IDE, open the pico_planetarium sketch.
- There are some settings in the sketch that can be edited (comment/uncomment as required) this allows the screen rotation to be changed, or to enable/disable WIFI features.
- Select "Raspberry Pi Pico 2W" as the board type.
- Connect Raspberry Pi Pico 2W using a USB cable. (If your Raspberry Pi Pico is new, hold the bootsel button while plugging it in, it should appear as a USB drive).
- Select "sketch" and "upload sketch".
WIFI Setup
The planetarium code uses a WIFI manager to configure WIFI credentials. The first time you turn on the planetarium, it should appear as a wireless access point called PICO_PLANETARIUM_PICO2W. If you connect to this wireless access point from another device (e.g. smartphone, tablet or laptop), you can enter the credentials for your WIFI router. Once the credentials have been stored, the device will remember them in future and automatically connect.
Usage
The planetarium has a simple interface allowing your location (lat/lon) and your view (alt/az) to be configured. The time is either fetched automatically from an NTP server, or can be entered manually. A menu allows you to change which items are displayed, including stars, planets, the sun and moon, constellations and deep sky objects.
Conclusion
The Pi Pico Planetarium is a simple device that brings the night sky to life in the palm of your hand. It combines real-time astronomy, embedded graphics, and wireless connectivity. This project has proven to be a rewarding challenge, blending software engineering, astronomy, and electronics. It’s a great tool for learning, teaching, or simply enjoying a more personal connection with the stars.
If you would like to find out more about the technical details checkout the technical documentation.
Credits
Credits
This project uses the following libraries:
Data Sources
- Bright Star Catalog
- Marc van der Sluys - Contellation Lines
- Greg Miller - Constellation Lines
- Greg Miller - Common Star Names
- Eleanor Lutz - Mesier and NGC Objects
Other Links and References