You require an RPIv2 or later (to use the SmartiPi Touch 2 case, you require an RPI4). It will not run on an RPI1 or an RPI-Zero. This installation and configuration guide assumes you have installed an operating system on your Pi and can login either directly (with a keyboard/monitor attached to the Pi) or indirectly through SSH or VNC across a network.
Note the operating system you install must have a Desktop, and the PI must be configured to boot into it. If you choose an operating system other than Raspberry Pi OS, you may have to adjust some of the instructions which refer to the LXDE Desktop manager configuration.
The Raspberry Pi needs a little configuration. For starters, the default brightness for the touchscreen makes it bright enough to use as a Bat-Signal. Settings range from 0 (zero=off) to 255. I set it at 75. Enter the following at the command line:
sudo su echo 75 > /sys/class/backlight/rpi_backlight/brightness exit
n.b. The last line (
exit) is important, it exits you from the super-user shell.
As well as being easier on the eyes, it'll make the touchscreen last longer. 50 also seems to be a good value. Feel free to experiment to find a balance that suits you. Remember that an intense backlight will shorten the lifespan of the screen.
With that taken care of, a new version of nodejs needs to be installed. By default (at the time this article was written), the version of node installed on Raspbian is v10, but the clock needs v14.
Enter the following commands on the command line (you can ignore those starting with a # - these are just comments to help explain what is going on):
# point at the node 14 repository curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash - # install node sudo apt-get install nodejs # install electron globally sudo npm install -g electron
If you haven't got GiT installed, do that:
sudo apt-get install git
You may get a message saying the latest version is already installed.
With that done, we're ready to install the clock. However, before we get to that, there are a few things we want to do. Firstly, if you haven't already done so, CHANGE THE DEFAULT PASSWORD!
For the next part you need to be in the Desktop GUI. Right-click the menu bar and select
Panel Settings, then on the
Advanced tab enable
Automatic Hiding (to make the menu bar slide off the screen).
Next we'll make things look a bit prettier by getting rid of the ugly cursor, so it's back to the terminal window (either in the desktop or in an SSH session, it's up to you - I prefer the SSH session).
sudo apt-get install unclutter # now edit the desktop config file sudo nano /etc/xdg/lxsession/LXDE-pi/autostart # at the end of the file, add this line, then save and exit: unclutter -idle 0
Now create a folder called Autostart in ./config, and create a desktop file:
mkdir ~/.config/autostart nano ~/.config/autostart/marsclock.desktop # in the editor, add these lines: [Desktop Entry] Type=Application Name=piMars Exec=npm start --prefix ~/marsclock
After you've saved the file, make sure you are in your home folder, then clone the repository:
cd ~/ git clone https://github.com/phil-ide/marsclock.git
This will take a few moments to download everything. Next you need to initialise the application and install all the dependencies. This is simple enough:
cd ./marsclock npm install
It may take a little while to install everything, so go grab a coffee. Once it is finished, you should test. From a terminal window you opened in the Desktop environment (if you do it from an SSH terminal you won't see anything):
cd ~/marsclock npm start
If everything goes OK, the application should start. Don't worry if you see warnings in the terminal window, they're not important and related to some minor incompatibilities that don't affect the clock.
If the program runs, then you can reboot the machine. To do this from the GUI, press Alt-F4 to halt the program, then from the Desktop menu select
Logout/Reboot or from a terminal, type:
When the machine starts, it'll boot straight into the Desktop and then after a moment or two the cursor will disappear, then the clock will start up. If everything is good, there will be no cursor and no menu bar (not even the bottom edge of it lurking at the top of the screen).
To control or administer the machine, you can SSH into it as usual or use VNC if you have enabled it.
To gain access to the Desktop menu, you'll first have to stop the clock by clicking on it (you'll see just enough of the cursor to do this) and then type
Alt-F4 to kill the clock. At this point, the cursor is almost unusable, but you can start a terminal window, and from there you can re-enable the cursor:
unclutter -idle 1
Once you have the cursor back, you can access the Desktop's menu. When you have finished, just reboot the machine to restore the clock.