
#Mars24 time clock code
Thanks for the advice if it was for me, and if it was for me no I am not trying to avoid math my post states that I am trying to make it "simple" as in low cost hardware and minimal code (as it applies to total size, for example 12kb versus 30kb) I have no problem doing any math or in depth code, although again as I mentioned I am no programmer and this is a great learning project for me. I'm not sure if you're addressing the original poster or me because there's no name in your post. Odometer wrote:If you want an RTC backup, you will have to do conversion anyway. If you are really concerned about the math slowing down the Arduino, then just do the "hard" math once every minute or so, and count chunks of 1027491 microseconds (or even 1027 milliseconds, if you like) in between. I don't understand why go so far out of your way to avoid a little math. If you do, the clock will be out two minutes in three days. It's really not a good idea to use 1027 milliseconds to approximate 1.027491. Look at the "Blink without delay" example in the tutorial. Counting chunks of time of arbitrary but uniform length (in out case, 1027491 microseconds) is very straightforward. When you get to 60 Mars seconds, then you have one Mars minute, etc. Each such chunk is a Mars second, more or less. If you don't want to use the time information from an external RTC, then just count chunks of 1027491 microseconds in software. I don't get why try alter the speed of an RTC or Arduino clock. If you want an RTC backup, you will have to do conversion anyway. And yes, this can get complicated.)įor speed, you can replace some of the divisions by "bit shifts". (Yes, the concept of time zones applies to any planet that has day and night, not just Earth. The exact value of this number depends on which "time zone" on Mars you are using. The variable k should be set to the number of earth_seconds at 00:00:00 Mars time. If this bothers you, just add the total number of leap seconds so far - 25 or so - to your value for Unix Time. (Note: Unix Time sweeps leap seconds under the carpet. Unix time (look it up) is an example of a system that would work for this it uses 00:00:00 UTC on. This is the total number of seconds that have passed since some specified time on earth. Y = x - (x / 8) - (x / 53) + (x / 19820) įor this to work, the variable earth_seconds will need to have been calculated in some other part of the code beforehand. For example, instead of calculating thisĬode: Select all k = ? // value of earth_seconds at 00:00:00 Mars time 02&start=0įourth: If you are going for mean Mars solar time (1 Mars day = 24 h 39 min 35.244 sec Earth time = 1.027491252 Earth day = 88775.244 Earth seconds, or to put it another way, 1 Earth day = 0.973244296 Mars day), then the only "floating point" arithmetic you need is a single division (or multiplication) by a number close to 1.

Third: Someone already is making (has made?) a watch to handle Mars time, albeit with imperfections. You can find them on eBay just search for "24 hour" clock (with quotes around "24 hour"). If you use one of these and slow it down for Mars time, you will then have a clock showing Mars hours, minutes, and seconds.

Second: There do exist (somewhat) reasonably priced analog 24-hour clocks, for Earth time. This is what I had to do for a clock for my apartment: There are some points I would like to make:įirst: I am glad people are taking the initiative to do something instead of just wringing their hands and lamenting the lack of an existing product. This is the first piece of code I'm messing with (terribly inefficient) and start again adding 1 digit every 1027 milliseconds. I thought since you can write a delay based on milliseconds you might be able to write a digit 000,000(plus one) at a delay rate of 1027-1028 until you reach 243,935 at which point the program would return to start at 000,000. The difference in time between seconds on Mars and Earth is (Earth 1.0274912510416665 second = Mars 1 second) so my idea was to simplify the code and make the watches extremely low cost and easy to reproduce.

I had hoped to stay under the pricing and complicated programming/workmanship they had to input ($50-$400 price points). or_JPL.php ).Īnd an engineering student made a digital one (. I looked around to see if anybody else had made one and it turns out a jeweler made a mechanical one for JPL (. I've been thinking about making a super simple Mars watch.
