Skip to content

Software for displaying the best effects and animations on the Pimoroni Galactic Unicorn.

License

Notifications You must be signed in to change notification settings

CodyTolene/Unicorn-Pi-Galactic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unicorn-Pi Galactic

Software for your Pimoroni Galactic Unicorn that brings the best effects and animations to life. Use the onboard buttons to switch views, customize text colors, adjust brightness, and much more. Many effects and animations also feature custom sounds for an immersive experience.

The effects in this software are written in Python and designed to be easy to use, modify individually, and test. Suggestions for new effects or animations are always welcome. Thank you for checking out this project!

Index

Build Status

Python Linting

[ Index ]

Parts List

Pimoroni Galactic Unicorn

Part Price (USD)
Pimoroni Galactic Unicorn $65.00

[ Index ]

Previews

Name Sound(s) Wi-Fi Preview
DVD Bouncer Bounce / Celebrate False DVD Bouncer
Digital Clock (12 hour) None True Digital Clock 12
Digital Clock (24 hour) None True Digital Clock 24
Digital Rain None False Digital Rain
Emergency Siren Tones False Emergency
Fire None False Fire
Fireflies Random Crickets False Fireflies
Fireplace Burning Noises False Fireplace
Fireworks Freedom Bursts False Fireworks
Flashlight Torch None False Flashlight Torch
Lava Lamp None False Lava Lamp
Lightning Thunder Claps False Lightning
Nyan Cat Demo Music False Nyan Cat
Plasma None False Plasma
Rainbow (default) Relaxing Tones False Rainbow
Raindrops Rain False Raindrops
SOS (Morse Code) None False SOS
Snowfall None False Snowfall
Stocks Display None True Stocks Display
Warp Speed None False Warp Speed
Wave None False Wave

Warning This software may produce flashing lights, which can trigger seizures in individuals with photosensitive epilepsy. Please exercise caution if you or anyone who may be exposed to the lights has a history of epilepsy or seizures.

Warning The use of emergency lights and/or siren sounds may be inappropriate or illegal in certain situations or locations. Users are responsible for ensuring compliance with local laws and regulations and must use this code responsibly. Use this software at your own risk. The author disclaims all responsibility for any misuse or adverse effects resulting from the use of this software.

Info Have another idea? Share it here. You can also fork this repo and submit a pull request with your own effect or animation! I'd love to see what you come up with.

[ Index ]

Software Setup

First make sure you have this repo cloned to your computer. If you don't have Git installed, you can download the repo as a ZIP file by clicking the green "Code" button at the top of this page. Follow the steps below to run the Python scripts in this repository on your Raspberry Pi Pico with the Pimoroni Unicorn Pack:

  1. Similar to how you install the Pimoroni custom software to a Raspberry Pi Pico (official guide), you need to install the .uf2 file for the Pimoroni Galactic Unicorn. You can find the .uf2 file on the Pimoroni GitHub Release Page where the file is generally named starting with "galactic_unicorn...".

    Info This is a one-time setup.

  2. Download and install the Thonny IDE from the official website.

    Info This allows us to write and run Python code on the Galactic Unicorns Raspberry Pi Pico.

  3. Open Thonny and connect your Galactic Unicorns Raspberry Pi Pico to your computer using a USB cable.

  4. On the left hand side you should see the file explorer for your Galactic Unicorns Raspberry Pi Pico. Drag and drop all the files from the scripts folder in this repository to the root directory of your Galactic Unicorns Raspberry Pi Pico.

  5. Unplug and replug your Galactic Unicorn to restart the device or press the "Reset" button on the back.

The file main.py will automatically run when the Galactic Unicorn is powered on.

[ Index ]

Wi-Fi Setup

Some views may require you to have Wi-Fi connected to your Raspberry Pi Pico. Follow the steps below to connect your Raspberry Pi Pico to Wi-Fi:

  1. After copying the options.json (see User Options below for more information) file to the root directory of your Raspberry Pi Pico, open the file in Thonny or another IDE.

  2. Add your Wi-Fi SSID and password to the wifi_ssid and wifi_password objects in the options.json file. Example:

    {
      "wifi_ssid": "MY_WIFI_SSID", 
      "wifi_password": "MY_WIFI_PASSWORD",
      ...
    }

Info Connecting to Wi-Fi is optional and only required for views that need internet access.

[ Index ]

User Options

The options.json file contains user options that can be modified to customize the software or add additional functionality. The following options are available:

Option Default Value Description
wifi_ssid "" The SSID of your Wi-Fi network.
wifi_password "" The password of your Wi-Fi network.
stocks_finnhub_api_key "" A FinnHub API Key for fetching current stock prices.
stocks_symbols ["NVDA", "AMD", "MSFT", "GOOGL"] A list of up to 4 stock symbols.
stocks_update_after_x_scrolls 3 The number of scrolls before updating stock prices.
stocks_update_message true Display a message while updating stock prices.
time_zone "America/Chicago" The default time zone for the digital clock views.

[ Index ]

Software Guide

Pimoroni Galactic Unicorn Button layout

|===========================================|
| (A) oooooooooooooooooooooooooooooooo (V+) |
| (B) oooooooooooooooooooooooooooooooo (V-) |
| (C) oooooooooooooooooooooooooooooooo (Zz) |
| (D) oooooooooooooooooooooooooooooooo (L+) |
|     oooooooooooooooooooooooooooooooo (L-) |
|===========================================|

Global Controls

Button Action
"A" Next view/scene.
"B" Previous view/scene.
"C" Varies by view/scene.
"D" Varies by view/scene.
"V+" Increase volume.
"V-" Decrease volume.
"Zz" Sleep or Awaken.
"L+" Increase brightness.
"L-" Lower brightness.

Digital Clock 12-hour (AM/PM meridiem) View

Button Action
"C" Cycle text color to previous.
"D" Cycle text color to next.
"V+" Manually update time, add minutes.
"V-" Manually update time, subtract minutes.

Digital Clock 24-hour View

Button Action
"C" Cycle text color to previous.
"D" Cycle text color to next.
"V+" Manually update time, add minutes.
"V-" Manually update time, subtract minutes.

Rainbow (default) View

Button Action
"C" Increase stript width.
"D" Decrease stript width .

Stocks Display View

Button Action
"C" Cycle text color to previous.
"D" Cycle text color to next.

Stocks display view setup:

  1. Be sure your Wi-Fi is connected, by following the Wi-Fi setup instructions here.

  2. Sign up for a free API key (a place to get stock data) at Finnhub.io.

  3. Add the API key to the stocks_finnhub_api_key object in the options.json file. Example:

    {
      "stocks_finnhub_api_key": "MY_API_KEY"
    }
  4. Add up to 4 stock symbols to the stocks_symbols list in the options.json file. Example:

    {
      "stocks_symbols": ["NVDA", "AMD", "MSFT", "GOOGL"]
    }
  5. See more options in the User Options section.

[ Index ]

Development

  1. Make sure you have Python installed on your computer (3.8+). You can download Python from the official website.

  2. Run the following in a terminal at the root of this repository to install development dependencies:

# Install the required packages
python3 -m pip install -r requirements.txt
# Install the pre-commit hooks
pre-commit install
# Update the pre-commit hooks
pre-commit autoupdate
  1. Make your code changes using Thonny, add new views, fix a bug, etc.

  2. Test using Thonny by connecting your Raspberry Pi Pico to your computer. Run the main.py script or any view script individually by pressing the "Run" button with the file open.

  3. When your changes are in you can optionally run the following commands to lint and format your code:

# Format
python3 -m black scripts/
# Lint
python3 -m flake8 --show-source --ignore E501 scripts/

Info These scripts will also run automatically when you commit changes (pre-commit hooks) to ensure code quality.

  1. Submit a pull request with your changes.

[ Index ]

Licensing

This project is licensed under the Apache License, Version 2.0. See the APACHE_2_LICENSE file for the pertaining license text.

SPDX-License-Identifier: Apache-2.0

[ Index ]

Wrapping Up

Thanks to all the people and projects that made this possible! I hope you enjoy this project as much as I enjoyed working on it. If you have any questions, please let me know by opening an issue here.

Type Info
[email protected]
https://www.buymeacoffee.com/codytolene
bc1qfx3lvspkj0q077u3gnrnxqkqwyvcku2nml86wmudy7yf2u8edmqq0a5vnt

Fin. Happy programming friend!

Cody Tolene

About

Software for displaying the best effects and animations on the Pimoroni Galactic Unicorn.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages