Awesome
PiClock
Simple studio clock for linux. This was originally built using OpenVG on Raspberry Pi for its output, but now uses plain OpenGL and works fine on normal XOrg on Debian.
Checkout
Checkout this project by:
# Install git if you don't already have it
sudo apt-get install git
# Checkout the main project and it's submodules
git clone --recursive https://github.com/simonhyde/PiClock.git
Build
- First you'll need to install some dependencies (ntpdate is only suggested for runtime):
sudo apt-get install libjpeg-dev libboost-program-options-dev libboost-system-dev libssl-dev libmagick++-dev libb64-dev freeglut3-dev libglew-dev x11-xserver-utils xinit ntp ntpdate libglfw3-dev premake4
- Change to the directory you checked the code out into; probably:
cd PiClock
- Compile:
make
- Run:
./piclock
Configure NTP
You may want to add/change your NTP servers (in /etc/ntp.conf)
Running at startup
To configure this to run at startup, I did the following:
- Add a new user to run the clock:
sudo adduser --disabled-password piclock
sudo usermod --append --groups spi,video piclock
- Make the user profile run the clock:
sudo editor ~piclock/.bashrc
# And add a line to the end, something like: /home/pi/PiClock/piclock-startx-wrapper
- Enable text-mode autologin using raspi-config:
sudo raspi-config
#Boot Options, Desktop/CLI, Console Autologin
- Make the system auto-login as the piclock user:
sudo editor /etc/systemd/system/getty@tty1.service.d/autologin.config
and change:
ExecStart=-/sbin/agetty --autologin pi --noclear %I $TERM
to:
ExecStart=-/sbin/agetty --autologin piclock --noclear %I $TERM
(ie change pi to piclock)
Switching to Read Only SD Card
Once you've got everything working, you may want to make the SD card read-only, to prevent future corruption/wearing out the SD card. The easiest way to do this nowadays is to use the Overlay FS option built into raspi-config, however this seems to cause the network interface to be accidentally renamed, so you first have to delete the rule that's messing that up:
sudo rm /lib/udev/rules.d/73-usb-net-by-mac.rules
sudo raspi-config
#Advanced, Overlay FS, Enable Overlay FS, and set boot filesystem to write-protected/read-only
Remote Control PiClock via Tally Server
It's possible to remote control PiClock's behaviour using the Tally Protocol; you can either write your own server or use one of the pre-existing implementations:
- Bitfocus Companion (since v3.4) has a basic implementation via the simonhyde-piclock module