colourcountry / picon

Display 8x8 icons on an Astro-Pi / Sense HAT / Unicorn HAT based on sensor values and APIs
1 stars 0 forks source link

picon

Display 8x8 icons on an Astro-Pi / Sense HAT based on sensor values and APIs

Dependencies

And how to satisfy them on a Raspberry Pi

NB. Install Sense HAT before skyfield to avoid having two conflicting copies of numpy floating about.

How to run

Display an icon

Run ./display_icon.py

It should display a single icon until you exit the program.

By default, the icon is output to your terminal. To display on a connected Sense HAT, run ./display_icon.py -d sense

If it doesn't work, check the dependencies above. Also check SPI is enabled in raspi-config.

Display an icon that depends on a value in a file

./display_digit.py looks in the file samples/digit for a single digit to display.

Display a value in a repeating loop with a banner icon

loop.py can display data from any available source.

There may be more data sources installed. Run ./loop.py -h to see them all. You can see help for a specific data source with ./loop.py <source> -h.

The -l parameter makes loop.py repeat the loop for a set time period: ./loop.py -l 5 makes it run for 5 minutes.

loop.py also takes the -d parameter to display the icons on your device.

Display several values with banner icons

The previous programs got their information from only one place: they had a single data source. loop.py can use several data sources, and you can configure which ones it uses.

The supplied configuration displays the random number and the digit from samples/digit in turn.

Configure different sources in a file

The data sources for loop.py are configured in the file config.json containing the sources in the order they appear in the loop. Each data source has parameters which apply to that source.

Try adding a second random source with a different range, and running ./loop.py again.

Display values with transitions

You can add a parameter transition to any data source in config.json to specify a transition effect:

Display weather and transport information sourced from an API

(To do)

Add these to your crontab as you see fit.

Data is saved into the samples/ directory.

Next edit the config.json file as you want. Here you can configure

Once there is data in the samples file...

display.sh will output icons to the terminal for testing, just once.

sense_hat.sh N will display them on the Sense Hat, looping for N minutes.