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

Pi-Mars v1.1

Desktop screen shows time for the InSight lander. Pi screen shows time at Valles Marineris

Pi-Mars is a clock for the Raspberry Pi, that tells the time anywhere on Mars. It has options to nominate ad-hoc locations, pre-selected locations and sites of the various missions that made it to the Martian surface. It is skinnable and highly configurable.

Having written several clocks that tell the time at various locations on Mars for my Mars Weather page, I immediately knew I wanted to make a physical clock - something that could sit on my desk or such like, and tell the time on Mars.

The Raspberry Pi was a shoo-in for the job. Items required:

  1. Raspberry Pi 4B+ 2GbRAM (£34)
  2. Power Supply Unit (£8)
  3. 7“ Official Touchscreen (£60)
  4. SmartiPi Touch 2 case (£24)

Total cost: ~£130.00 plus SD card (16Gb) plus p+p. An 8Gb SD card is sufficient if you want to minimalize, but a 16Gb will have a longer life.

These were all standard components that fit together in just a few minutes. Writing the software would take a bit longer - this was after all, mainly a software task. Luckily, I'm a programmer. ← Mark Watney moment, did you spot it?.

As you can see, taking images of the Pi displaying the clock is not easy because it is backlit. I found that placing it in front of my PC monitor helped. Better still, since the software I was writing was multi-platform, I could take screenshots directly from the PC's raster, so you can see some of them below.

Features

  • tell the time at any location (on Mars), so must have the ability to enter map coordinates
  • have pre-selections for all the missions that made it to the surface - successfully or otherwise
  • have pre-selections for major landmarks
  • work with any screen dimension
  • be skinnable to change background, fonts, colours etc. and positioning of elements
  • skins can decide which elements to show
  • can select maps for background to show current coordinates (Viking and MOLA maps)
  • override skin background to display any other image
  • create a slideshow of background images at intervals determined by the user
  • automatically update leap-second bulletins (necessary for Earth/Mars time conversions)
  • automatically detect and install new mission data when updated information becomes available
  • can be configured for an ftp-proxy if required
  • write to the SD card only when absolutely necessary, to help extend its life
  • optimised code wherever possible, but maintain flexibility and readability

v1.1 added power management options (quit the application, reboot and shutdown).

Optimising the code was essential. Although computers are great for repetitive tasks, making them work unduly hard at high frequency rates persistently reduces their lifespan. This clock was going to perform a large number of calculations and then repeat that task up to ten times every second (user configurable). Giving the clock a breather between each trip around the loop is just taking care of the equipment.

Maintaining flexibility was essential of course, but so was readability - which also translates into maintainability.

Mars24

The logic of translating times on Earth to times on Mars is relatively straightforward, although at first glance it might seem otherwise. Essentially a Martian second is longer than an ISO second. This means that Earth time and Martian time represent two entirely different time streams that are both anchored at midnight on the morning of 11th April 1955. Earth also subtracts leap seconds, something that Mars doesn't, and this increases the divergence.

NASA produce (at the Goddard Institute for Space Studies) software called Mars24, which also tells the time anywhere on Mars (it can tell the time anywhen too), so I used that as my benchmark to ensure my times are correct. This creates an issue where the Ls is different from the code often used on the web, so I sided with the NASA software.

If NASA have this software, and it is freely downloadable (here), why make another clock? Mars24 is a tool, and what I wanted to create is an ornament, and as such it has more configuration options and capabilities. Plus it's a nerd-fest-in-a-box, right? Unless you work for a Mars mission team for a space agency, this clock is entirely useless to you, except for its nerd and ornamental value.

Installation

Full installation instructions can be found on this page. If you feel confident you can do it blindly, the software repository is here: https://github.com/stroggprog/marsclock

Caveats

At this time, the sunclock is not working properly because the clock isn't calculating the times of sunrise and sunset properly. These will be fixed in a future update.

Installation instructions can be found on this page

Screenshots

Configuration

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:
U Q I V M
 
blog/articles/raspberry/phys_marsclock/pi_marsv1.txt · Last modified: 2024/06/22 13:55 by 127.0.0.1

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