Raspberry Pi · 2021

Unicorn HAT Mini clock

A fork of unicornhatmini-clock with a night mode that drops the LEDs to 2% after dark, and settings that are easy to change.

  • Python
  • Raspberry Pi
The Unicorn HAT Mini showing 22:40 in purple LEDs, standing on yellow Lego bricks
Showing 22:40, standing on Lego bricks

A clock for the Pimoroni Unicorn HAT Mini on a Raspberry Pi. I forked unicornhatmini-clock and added a night mode that dims the LEDs when it's dark. The HAT gets very bright, and 2% brightness is plenty at night. I also moved the settings into variables at the top of the script, so you can customise the clock without touching the code.

Features

  • A blinking colon between the hours and minutes
  • Text that changes colour every minute or every hour
  • A night mode that dims the lights after dark
  • Settings that are easy to change

Settings

Setting Default Options
Flash the colon between hours and minutes True True or False
Daytime brightness 0.10 0.02 to 1.00
Night-time brightness 0.02 0.02 to 1.00
Daytime start hour 8 0 to 24
Daytime end hour 23 0 to 24
Enable night mode (with the settings above) True True or False
Change colour every minute False True or False
Change colour every hour True True or False