Simple Clock for the Raspberry Pi, using OpenVG for its output
Checkout this project by:
```shell
# 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
```
-
First you'll need to install some dependencies (ntpdate is only suggested for runtime):
sudo apt-get install libjpeg-dev ntpdate ttf-dejavu libboost-program-options-dev libboost-system-dev libssl-dev libmagick++-dev libb64-dev
-
Compile:
make
-
Run:
./piclock
When ntp notices a large jump in time (such as when first booting up the Raspberry Pi), it tells clients it is not synchronised for quite a while (many minutes). To work around this, I run ntpdate to manually crash in the time whenever a new network connection is started up, closing down and then re-starting the main NTP daemon whilst this happens. To do this I have a slightly modified ntpdate script in if-up.d, you can install this update script by:
-
Make sure ntpdate is installed:
sudo apt-get install ntpdate
-
Copy in new script:
sudo cp if-up.d-ntpdate /etc/network/if-up.d/ntpdate
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
-
Make the system auto-login as the piclock user:
sudo editor /etc/systemd/system/autologin@.service
and change:
```
ExecStart=-/sbin/agetty --autologin pi --noclear %I $TERM
```
to:
```
ExecStart=-/sbin/agetty --autologin piclock --noclear %I $TERM
```
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. Instructions for this can be found at https://www.raspberrypi.org/forums/viewtopic.php?p=213440