Simple Clock for the Raspberry Pi, using OpenVG for its output
Switch branches/tags
Nothing to show
Clone or download
simonhyde Merge pull request #2 from peternewman/patch-1
Fix formatting in the README
Latest commit 648c243 Jul 11, 2018
Permalink
Failed to load latest commit information.
libmcp23s17 @ f65a5e2 Tweaks for GPIs and make second hand less continuous Nov 24, 2016
libpifacedigital @ 933268f Tweaks for GPIs and make second hand less continuous Nov 24, 2016
ntpstat @ 7a0558d Switch over to C++ Dec 23, 2016
openvg @ e6ec10c Allow images to be loaded Apr 24, 2018
.gitignore Place a ... when truncating, enable labels on tallies Nov 28, 2017
.gitmodules Change to forked openvg for subrepo Apr 12, 2018
Makefile Allow images to be loaded Apr 24, 2018
README.md
TallyProtocol.md Allow images to be loaded Apr 24, 2018
blocking_tcp_client.cpp Add close method, include source directly (bodge) Dec 23, 2016
if-up.d-ntpdate Update docs, use random port for ntpdate Nov 24, 2016
ntpdate.patch Add some basic docs, document/include ntpdate script changes Jul 8, 2013
piclock.cfg Move config for tally stuff out into a file Jan 12, 2017
piclock.cpp Perform all image scaling in background thread Apr 25, 2018
piclock_messages.h Allow images to be loaded Apr 24, 2018

README.md

PiClock

Simple Clock for the Raspberry Pi, using OpenVG for its output

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

  1. 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
  1. Compile:
	make
  1. Run:
	./piclock

Clock Unsynchronised

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:

  1. Make sure ntpdate is installed:
	sudo apt-get install ntpdate
  1. Copy in new script:
	sudo cp if-up.d-ntpdate /etc/network/if-up.d/ntpdate

Running at startup

To configure this to run at startup, I did the following:

  1. Add a new user to run the clock:
	sudo adduser --disabled-password piclock
	sudo usermod --append --groups spi,video piclock
  1. Make the user profile run the clock:
	sudo editor ~piclock/.bashrc

	# And add a line to the end, something like: /home/pi/PiClock/piclock
  1. 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

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. Instructions for this can be found at https://www.raspberrypi.org/forums/viewtopic.php?p=213440