29 September, 2021

Multi Face GPS Clock published

Version 1 of my Multi Face GPS Clock is here, as open source software for the Arduino Mega. It has some 22 19 different display screens showing time, location, solar and lunar positions and rise/set times. It shows UTC time as received from the GPS satellites and local time where it automatically adjust for summer time. The initial screen, no. 0, is this:

The display changes by pushing the right-hand pushbutton on the top, increasing the screen number by one. Similarly the number can be decreased by pushing the left-hand push-button. The potentiometer on the right side adjust the backlight. The clock is built on the same hardware as used for the K3NG Arduino CW keyer.

The date and time formats may be changed, and with US settings it looks like this:


This format is closer to the ISO standard:

When local time is shown, day names may be in another language than English. Here is my Norwegian day name display. The local short name for Tuesday (Tir) will be shown in some of the following displays also, because the native option is set:

The circuit diagram is rather simple and is based on an Arduino Mega and I2C or parallel connection to a 20x4 LCD display. It was drawn online on www.circuit-diagram.org and is a public circuit.

The GPS input is for serial data on a TTL-like interface. I use a QRPLabs QLG1 GPS. It is now discontinued and replaced by the QLG2.

The Menu+ and Menu- buttons will increase and decrease respectively the screen number in the following sequence of numbered screens.

The code is public on github.com/LA3ZA/Multi-Face-GPS-Clock. It uses 57714 bytes (22%) of program storage space of an Arduino Mega. This is too much to fit an Arduino Uno. Global variables use 2446 bytes (29%) of dynamic memory, leaving 5746 bytes for local variables.

Here are the other screens. Screen 1 shows UTC time and date, Maidenhead locator and number of satellites:

Screen 2 shows local time, and actual, civil, and nautical rise and set times for the sun, i.e. when the sun touches the horizon, and is 6 and 12 degrees below the horizon. To the right is shown solar elevation (-22 degrees), local time at solar noon (13.09), and solar elevation at local noon (27 degrees).

Screen 3 is similar to screen 2 except for the last line which shows the next lunar event, set, at 17:29, the lunar phase and illumination of, in this case, the decreasing moon, and lunar elevation.

Screen 4 is a lunar display showing actual elevation and azimuth, next set/rise time and azimuth. The last line shows lunar distance as a percentage of its maximum value (88-100%) and distance in km, as well as lunar phase (51% illumination). 

Screen 5 shows lunar rise/set times for the present 24 hours and the next and the corresponding azimuth angles:

Screen 6 is a display of time in various user configurable time zones, here showing central Europan Summer Time, Indian time, Eastern Daylight Time, and Pacific Daylight Time:

The following screens show several fancy, barely useable screens of various alternative displays. Screen 7 is binary while screen 8 is binary coded decimal:

Screen 9 is also binary coded decimal, but to be read vertically, like in the Wikipedia article on binary clock

Screen 10 is based on groups of three bars which are each 1/4 of a round clock:

Screen 11 emulates the set theory clock in Berlin

Screen 12 emulates the linear clock of Kassel:

Screens 13 and 14 are diagnostic displays which are not shown here. Screen 15 shows UTC time, position, altitude and number of satellites:

Screen 16 shows the NCDXF beacons in the 15, 12, and 10 m bands at the present time. It changes every 10 seconds as transmitters change frequency.

Screen 17 shows the NCDXF beacons in the 20, 17, and 15 m bands:

The NCDXF displays were inspired by the single-line display of OE3GOD.

Screen 18 shows the WSPR frequency used at the indicated time according to coordinated band hopping. All 10 bands between 160 m and 10 m are covered in a 20 minute cycle:

After the last screen, the screen counter goes to 0 and the sequence is repeated as the right-hand button is pressed. Pressing the left-hand button will take you directly from the initial display to the WSPR screen.

The startup screen shows GPS baud rate (user settable) as it is waiting for a GPS signal:


The code is on github and has several options. The way to choose and set options has been inspired by the way it is done in the The K3NG Arduino CW Keyer

An important feature is that it is possible to customize which screens to show and in which order. Thus only screens 0-5 with time, solar and lunar positions and screens 16-18 with the NCDXF and WSPR sequences may be made available for instance.

Other options and features are:
  • FEATURE_LCD_I2C  - I2C interface to LCD
  • FEATURE_LCD_4BIT - parallel interface to 20x4 LCD 
  • FEATURE_DAY_NAME_NATIVE - to use local language day names for local time
  • SECONDS_CLOCK_HELP - to set the number of seconds per minute when time is shown in a normal format in the Binary, BCD, etc displays. Values from 0 (never) to 60 (always)
Date and time formats allow most of the formats found on the Date format page of Wikipedia:
  • DATEORDER = 'L': Little-endian:  22.04.2016 or 22.04 - EU
  • DATEORDER = 'M': Middle-endian:  04/22/2016 or 04/22 - US
  • DATEORDER = 'B': Big-endian:     2016-04-22 or 04-22 - ISO
  • DATE_SEP = '.'; // Alternatives: '.', '/', '–', ' ', ...
  • HOUR_SEP = ':'; // Alternatives: ':', '.', 'h', ...
  • MIN_SEP  = ':'; // Alternatives: ':', '.', 'm', ... 

The GPS clock uses these libraries:
The lunar phase calculation is based on ideas discussed here. It is accurate to 5% or so compared to timedate.com

Details on how to set up the options and adaptations for the code published on github.com/LA3ZA/GPSClock is in the Wiki there


This blog post first appeared on the LA3ZA Radio & Electronics blog.

11 comments:

  1. Replies
    1. Thanks Goody, and also for inspiration from your CW keyer!

      Delete
  2. Thank you Sverre for such a nice GPS clock. Have mine working on the bench, just need a suitable enclosure now !

    ReplyDelete
    Replies
    1. Clock now complete and in an enclosure,a very nice addition to the shack,many thanks Sverre.
      73 Malcolm

      Delete
  3. Sverre, Many thanks indeed for your interesting project. I have it all setup with the Mega, GPS and RotEnc on a breadboard. I keep getting this error when I compile...

    GPSClock:161:55: error: 'POSITIVE' was not declared in this scope
    LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Set the LCD I2C address
    ^~~~~~~~
    D:\AA_ELECTRONIC\ARDUINO\AA_Projects\GPSClock\GPSClock.ino:161:55: note: suggested alternative: 'PORTE'
    LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Set the LCD I2C address
    ^~~~~~~~
    PORTE
    exit status 1
    'POSITIVE' was not declared in this scope

    Can you offer any advice on what might the issue be ?

    Terry

    ReplyDelete
    Replies
    1. It seems to me that the code cannot find the proper library for the I2C LCD. Try to set verbose output (File->Preferences->Show verbose output during: Tick box for compilation). I have then this output during compilation:

      Detecting libraries used...
      Alternatives for LiquidCrystal_I2C.h: [NewLiquidCrystal_lib]
      ResolveLibrary(LiquidCrystal_I2C.h)
      -> candidates: [NewLiquidCrystal_lib]

      Delete
    2. Hi Sverre,
      Many thanks for your reply. I got it fixed, you are right, it was the LCD I2C library. But also, I had to fix the '#include <TinyGPS++.h' entry to '... TinyGPSPlus.h' as that is the folder that the linked library creates upon install.
      Kind regards.
      Terry

      Delete
  4. Hello! Very nice job! I have a question. I don't have a LCD display with I2C, but have with parallel connection. How I can connect it to Mega?

    ReplyDelete
    Replies
    1. A parallel LCD is no problem. Check out the wiki page: https://github.com/la3za/Multi-Face-GPS-Clock/wiki#20-x-4-lcd-display . Enable #define FEATURE_LCD_4BIT and disable #define FEATURE_LCD_I2C and look for or change pin numbers for the connection in the file clock_pin_settings.h

      Delete