chronometer icon indicating copy to clipboard operation
chronometer copied to clipboard

Raspberry Pi Internet Chronometer

Chronometer Display

Turn your RaspberryPi in to an Internet Chronometer.

Display is a UCTRONICS 3.5 Inch HDMI display.

Features:

  • Utilizes system time via NTP. All you need to provide is an internet connection.
  • Customizable world clock timezones

Description / Abbreviations

Requirements

  • In order to get the HDMI display to work with this code, you need to set the resolution to 480x320 and set the console font to VGA 8x14. Run sudo dpkg-reconfigure console-setup to configure these settings.

  • NTP daemon needs to be running as a background service: sudo apt install ntp

  • Python3 (Should already be installed on RPi): sudo apt install python3

  • pytz module for python3: pip3 install pytz or from your distros repositories.

Installation for Raspberry Pi

  1. Download the script to a folder of your choice.
    curl -O https://raw.githubusercontent.com/rothman857/chronometer/master/chronometer.py
    
  2. Running chronometer.py for the first time will generate a .config file with default values*:
    python3 <path/to/chronometer.py>
    
  3. Edit .config with current coordinates in decimal notation (West longitude is negative)
    "coordinates": {
      "latitude": 40.7128,
      "longitude": -74.006
    },
    
  4. Update time zones as desired. Timezones must be in pytz format. To see a list of available options, run the following in a python3 shell:
    import pytz
    for tz in pytz.all_timezones:
        print(tz)
    
  5. If you wish to have the chronometer start at boot, add the following line to /etc/rc.local (before the exit(0) line):
    python3 /path/to/chronometer.py &
    
    ...
    exit(0)
    

Notes

  • *Sunrise, sunset, daylight duration, and solar time were calculated from the Sunrise Equation, which uses the coordinates provided in .config. Using the default values for longitude and latitude may result in inaccurate calculations.