Pages

20 November, 2022

W8BH clock with EU option

The TFT GPS clock with touch control which has been designed by Bruce E. Hall, W8BH, is a very nice clock with a large and easily readable 3.2" color display. Its three different screens have been nicely laid out and designed also. The processor is an STM32 Blue Pill.

I cloned the software and modified it in two simple ways:

1. EU option

This is a backwards compatible version which can be Europeanized with formats for date and units. It also has possibility for removing the display of the battery icon, when running from a USB supply.

New boolean variables to set:

  • US_UNITS - if false: m, kmh, Little-endian date with '.', if true: feet, mph, Middle-Endian date with '/'
  • BATTERY_DISPLAY - true: as original code, false: no display of battery icon and status

2. Minor fixes

  • There is now a new way of initializing Serial1 (used for GPS input signal) as the original one didn't compile in Arduino IDE 1.8.13. See https://github.com/stm32duino/wiki/wiki/API#hardwareserial
  • The satellite count in the upper right corner is more agile so it now drops to 0 whenever the GPS signal is lost, rather than stay forever at last satellite count.

The two other screens, selectable by touch, are these:




6 comments:

  1. Hi Can not find PCB Gerbers for GPS clock (BN34)

    ReplyDelete
    Replies
    1. See link on the last page here: http://w8bh.net/gps_clock.pdf

      Delete
    2. Hi again It was my PC dont allow to download now it works.
      Tanks.

      Delete
  2. I am working on a GPS driven clock project, running on an Arduino uno board and on NANO ESP32 board. The memory of the UNO version is full there is no S_video support.
    The Nano version adds a serial output toward an ESP32 WROOM to drive the TV output.

    There are 2 ways to architect a program which read the NMEA GPRMC sentence from GPS satellite and use the 1PPS iterrupt to accuratly display time and date.
    My display is an LCD screen 20x4 and I am testing both implementation on a Arduino UNO and a NANO ESP32.


    One approach as implemented by Bruce E. Hall, W8BH receive the GPRMC sentence and wait for the 1PPS interrupt to add one second and update the display. The age of the frame is close to 1 seconde. Dispaly and other functions must terminate before the first character of the next frame is available to read in.


    An alternate approach as implemented in « Horloge UTC Exacte Électro-Bidouilleur » by Bertrand. Here the end of the GPRMC sentence (CR & NL, \n) is detected and trigger the preparation of the display. At the 1PPS time the display is shooted. The age of the sentence is around 1 milliseconde.
    Preparing the display and other functions can easly expand from \n until next 1PPS. This waiting time can be measured.

    Here is the specific of my implementation :


    void loop()
    {
    feedGPS(); // lecture une phrase
    interpret();
    if (mm>0) // eliminer les dates a zero
    {
    if ((affiche_flag) && (init_flag))
    {
    affiche_flag = false;
    wait_time = micros()- start_time;
    affichage(); // display
    }
    if (go)
    {
    go = false;
    if (init_flag == false)
    {
    init_flag = true;
    service() ; // can take time
    return;
    }
    start_time = micros();
    service() ; plus_one();
    start_time = micros();
    }
    }
    }
    void feedGPS()
    {
    if (sws.available()>0) // if a character is ready to read...
    {
    char c = sws.read(); // get the character
    gps.encode(c);
    if (c == '$')
    {
    start_char = gps.charsProcessed()-1;
    start_time = micros();
    }
    if (c == '\n')
    { go = true;
    read_time = micros() - start_time;
    char_in = gps.charsProcessed() - start_char;
    }
    }
    }
    Performance measurement example :
    The timing of events can be identified in the code above.
    age 2 mS wait 872 mS read time 69mS char 68
    We can see that the processor is idle 87%, reading a GPRMC sentence take 69 mS. If necessary we can a lot of code/operations in the idle time of the processor.

    ReplyDelete
    Replies
    1. Interesting. I use the W8BH way in the Multi Face GPS Clock, but I found the description of the other way you mention here: https://forum.arduino.cc/t/horloge-tres-precise-pilotee-par-gps-avec-arduino-nano/1215261

      Delete
  3. Not exactly. The architecture of my code is different from both design mentioned.
    I use the ISR driven by the PPS.
    I take advantage of the NMEA frame structure starting with the $ sign and ending wth \rn.
    So I can evaluate the time to transfer one sentence and compare the number of byte with charsProcessed().
    When I receive \rn the sentence is complete and I can add one second and do other function(s), including collecting the age() and preparing the display.
    I now have to wait for the PPS, so I can start my timer, and stop it when the PPS arrives and shoot the display.

    ReplyDelete