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 mypage, 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:
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.
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.
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.
Full installation instructions can be found on https://github.com/phil-ide/marsclock. If you feel confident you can do it blindly, the software repository is here:
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