How-To: Rasberry Pi Fullscreen Digital Wall Clock

Ampron Digital Wall Clock
Create a device that will display big nice green clock on a TV or LED video wall that is connected to a Raspberry Pi HDMI.

Following is our contribution to community of Raspberry Pi lovers. As we didn’t find any very decent and simplest solution, we did this how-to with the purpose of helping others.

If you are not skilled enough to create this on your own, then please let us know and we will ship you the preconfigured device. Send note to: team@ampron.eu

Applicability

Applicable and tested with:

Raspbian Stretch Lite
Minimal image based on Debian Stretch
Version: November 2018
Release date:2018-11-13

Download link:
https://downloads.raspberrypi.org/raspbian_lite_latest.torrent

Following detailed instructions are made with Mac in mind. If you will do in Windows or Linux, then some details may differ.

Download and unpack Raspbian image

Open Terminal

curl http://director.downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2018-11-15/2018-11-13-raspbian-stretch-lite.zip -o rasp.zip
unzip -a rasp.zip
rm rasp.zip

Create Raspbian SD Card for your Raspberry Pi

Insert SD card into your Mac or Linux

diskutil list

Replace [n] with the number of the disk, ie: /dev/disk2

sudo diskutil unmountDisk /dev/disk[n]
sudo dd bs=1m if=2018-11-13-raspbian-stretch-lite.img of=/dev/rdisk[n]

Leave Terminal to do its thing

When the copy is finished, enable ssh:

Eject and put back SD

cd /Volumes/boot
touch ssh
cd /Volumes
sudo diskutil eject /dev/disk[n]

Put SD card to Raspberry Pi, connect LAN cable and power up.

Create new user

First login:

user: pi
pswd: raspberry

create user with root access:

sudo adduser clock

add user to sudo group:

sudo usermod -aG sudo clock

Remove Pi user

exit
ssh clock@YOUR-RASPBERRY-IP
sudo deluser -remove-home pi

Change hostname

change raspberrypi to clock:

sudo nano /etc/hostname
sudo nano /etc/hosts
sudo reboot

Set screen black on boot

We want the display stay clean without the rubbish during the starting of the clock.

sudo nano /boot/cmdline.txt

Add this to the end of the row:

consoleblank=1 logo.nologo quiet loglevel=0 plymouth.enable=0 vt.global_cursor_default=0 plymouth.ignore-serial-consoles splash fastboot noatime nodiratime noram

[IMPORTANT] You can add the any of the options to the end of the cmdline.txt file make sure it is all on the same line or else it will break your boot sequence!!!

Disable large rainbow screen on initial boot

sudo nano /boot/config.txt

Add Rows:

#Disable large rainbow screen on initial boot
disable_splash=1
sudo reboot

Web-based Wifi connect

More details: https://github.com/jasbur/RaspiWiFi

ssh through LAN into your Raspberry Pi

ssh clock@YOUR_RASPBERRY-IP-NO

sudo apt-get update

sudo apt-get install git -q

git clone https://github.com/jasbur/RaspiWiFi.git

cd RaspiWiFi && sudo python3 initial_setup.py

Answer the questions and installation begins.

Usage:

Connect to the “RaspiWiFi[xxxx] Setup” access point using any other WiFi enabled device. Navigate to 10.0.0.1. Select the preferred WiFy and enter password.

Install X-server and Chromium

sudo apt-get update
sudo apt-get install xorg openbox -q
sudo apt install xserver-xorg xinit -q
sudo apt-get install chromium-browser -q
sudo apt-get install unclutter

Allowing X server to be started by all users

By default, X server can only be started by root. To change this behavior:

sudo nano /etc/X11/Xwrapper.config

Change to this:

allowed_users=anybody

Configuring X server start-up parameters and disable screen blanking

X server uses ~/.xserverrc at startup. Create /home/screen/.xserverrc and add the below content. It disables power management at startup in addition to starting an X server. This ensures that our display never goes to sleep and is always available.

sudo nano /home/clock/.xserverrc
#!/bin/sh
#Start an X server with power management disabled so that the screen never goes blank.
exec /usr/bin/X -s 0 -dpms -nolisten tcp "$@"

Configure post X server start behaviour

X server users ~/.xsession at start-up to launch applications. In our case, we need Chromium to start. Do this:

sudo nano /home/clock/.xsession

Add content:

#!/bin/sh
#This tells X server to start Chromium at startup
chromium-browser --start-fullscreen --window-size=1920,1080 --disable-infobars --noerrdialogs --incognito --kiosk https://ampron.eu/clock

Install lighttpd webserver to your Raspberry Pi

FOR ADVANCED USERS: If you want to host the clock at your raspberry, then go and download files from https://ampron.eu/clock and host them locally. Easiest way to di it is to install lightweright http server.

run in a terminal:

sudo apt-get install lighttpd

the root of the web server is at “/var/www/html”. Download files there.

cd /var/www/html

sudo wget https://ampron.eu/clock/digital-7.ttf

sudo wget https://ampron.eu/clock/index.html

Then you also have to change the content of the .xsession file. For this:

sudo nano /home/clock/.xsession

Add content:

#!/bin/sh
#This tells X server to start Chromium at startup
chromium-browser --start-fullscreen --window-size=1920,1080 --disable-infobars --noerrdialogs --incognito --kiosk http://localhost

Start the clock at boot and during failure

Now that we have Chromium and X server configured, all we need is some way of starting and managing it. A systemd service does the job perfectly. Do this:

sudo nano /etc/systemd/system/clock.service

Insert content:

[Unit]
Description=Clock
After=network-online.target
DefaultDependencies=no

[Service]
User=clock
ExecStart=/usr/bin/startx
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target

Enable this service by running

sudo systemctl enable clock

Finally, start it

sudo systemctl start clock

To see the status of the service:

sudo systemctl status clock

To stop the service:

sudo systemctl stop clock

Display the status

systemctl status clock

More detailed status with logs:

journalctl -u clock -f

Restart to see if it boots up with clock in fullscreen

sudo reboot

If everything went well, then this is how it should look at the screen:

Rasberry Pi Fullscreen Wall Clock

Final Thoughts

Hopefully you now have nice fullscreen clock on your computer screen if you connected monitor or TV to HDMI port of you Raspberry Pi. If you would like to have it on some of our Rugged LED Message Boards or LED Video Wall, then please contact us and we will advise you the right size and model suitable to your needs and expectations.

If you had troubles during the setup and Google couldn’t help you out, then please send pic from the error on console and we will try to help you out. Send message to: team@ampron.eu.

Liked the article? Share it!

Ampron test lab can perform tests in full accordance with EN60529 (also known as IP rating or enclosure waterproof tests), EN62262 (also known as IK rating or vandalism tests) and EN60068 (parts related to temperature and humidity). Some test methods of military standards MIL-STD-202, MIL-STD-810, MIL- STD-833 and MIL-STD-1344 are also supported.

Ampron Environmental Testlab

Ampron test lab can perform tests in full accordance with EN60529 (also known as IP rating or enclosure waterproof tests), EN62262 (also known as IK rating or vandalism tests) and EN60068 (parts related to temperature and humidity). Some test methods of military standards MIL-STD-202, MIL-STD-810, MIL- STD-833 and MIL-STD-1344 are also supported.

Read More »