Philip P. Ide

Author, programmer, science enthusiast, half-wit.
Life is sweet. Have you tasted it lately?

User Tools

Site Tools


blog:articles:raspberry:phys_marsclock:pi_marsv1_install

Pi-Mars Installation

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.

To Begin

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:

sudo reboot

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.

Preferences

To access the settings of the clock, tap/click the cogs in the top right corner of the screen (they may not be easily visible against some backgrounds, but they are always there, superimposed on top of everything else).

After selecting a location or mission, you need to tap the Set Location, Use Preset or Set Mission button that appears next to the option in order to inform the system that you're actually making a choice and not just browsing around.

Any choices you make in the Preferences screen are not applied unless you select Save & Exit in the top right corner of the screen. Choosing Abort will discard any and all options you have selected, and return you to the clock in its previous state.

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies

Discussion

Enter your comment:
R N Y V F
 
blog/articles/raspberry/phys_marsclock/pi_marsv1_install.txt · Last modified: 2020/11/20 11:24 by Phil Ide

Except where otherwise noted, content on this wiki is licensed under the following license: Copyright © Phil Ide
Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki