User Tools

Site Tools


timehat:software_03-2025


TimeHat Software 03/2025

This page serves as a descriptor of how the software is configured on the TimeHat SD card as of 03/2025. Made for the Pi3b and 4b. (Will be testing and adding support for other Raspberry Pi models as time allows, and as interest is shown).

  • RV-3032-c7 Version

General

Software Info

  • The operating system is Raspbian Lite (64bit)
  • Key software conponents:
    • chrony - NTP client & server
    • gpsd - communicates with and configures the GNSS receiver, sends time data to chrony
    • lighttpd - web server for status page
    • sshd - remote access over secure shell

Hardware Info

  • CPU locked to 1GHz to minimize jitter and heat
  • GNSS receiver connected to ttyAMA0
  • RTC (DS3131 or RV-3032-c7) connect to i2c bus
  • WiFi and Bluetooth disabled to save power. Also WiFi is generally too unstable for use as a network time server.
  • RAM usage is minimal, any Pi can run this setup, adding more RAM will not improve performance.

System Status Web Page

To provide users with a quick snapshot of the status of the TimeHat system, I created a simple web page that shows things like the system uptime, temperature from the CPU and RTC, chrony status, gpsd status, and current satellite map and historical satellite heat map.

This page is updated every five minutes by the TimeHatInfoGetter.py script, which runs as a cron job by the root user:

*/5 * * * * /root/TimeHatInfoGetter.py >/dev/null 2>&1

This script generates two JSON files which are placed in /var/www/html/ - timehatstats.json and satplot.json. The first is where the general system information is stored, and the second is where the heatmap log is stored. Check out the examples below. The main configurable parameter of the info getter python script is whether or not to obfuscate the location. Some users may choose to expose this on the public web, but not want to share their precise location. The obfuscation routine simply truncates the latitude and longitude to two decimal places. E.g. - 44.1234567 gets trimmed to 44.12.

script

HTML

example JSON

Config Files

config.txt

/boot/firmware/config.txt

# For more options and information see
# http://rptl.io/configtxt
# Some settings may impact device functionality. See link above for details
 
dtparam=i2c_arm=on
dtoverlay=i2c-rtc,rv3032
dtparam=backup-switchover-mode=1
 
arm_64bit=1
 
[all]
enable_uart=1
dtoverlay=disable-wifi
dtoverlay=disable-bt
dtoverlay=pps-gpio,gpiopin=4
dtparam=act_led_trigger=heartbeat
 
disable_fw_kms_setup=1
auto_initramfs=1
#disable_poe_fan=1
#force_eeprom_read=0
#ignore_lcd=1
 
arm_boost=0
arm_freq=1000
force_turbo=1

gpsd

/etc/default/gpsd

GPSD_OPTIONS="-n -p"
DEVICES="/dev/ttyAMA0"

gpsd.service

/etc/systemd/system/gpsd.service

[Unit]
Description=GPS (Global Positioning System) Daemon
Requires=gpsd.socket
# Needed with chrony SOCK refclock
After=chronyd.service

[Service]
Type=forking
EnvironmentFile=-/etc/default/gpsd
EnvironmentFile=-/etc/sysconfig/gpsd
ExecStart=/usr/local/sbin/gpsd $GPSD_OPTIONS $OPTIONS $DEVICES

[Install]
WantedBy=multi-user.target
Also=gpsd.socket

chrony.conf

/etc/chrony.conf

server time-a.nist.gov
server time-a-wwv.nist.gov
server time-a-b.nist.gov

refclock SOCK /run/chrony.ttyAMA0.sock refid GPS

rtcsync

logchange 0.5

local stratum 10

makestep 1.0 3

logdir /var/log/chrony
log statistics tracking

dumpdir /var/log/chrony
driftfile /chrony.drift

allow

chronyd.service

/etc/systemd/system/chronyd.service

[Unit]
Description=chrony, an NTP client/server
Documentation=man:chronyd(8) man:chronyc(1) man:chrony.conf(5)
Conflicts=openntpd.service ntp.service ntpsec.service
Wants=time-sync.target
Before=time-sync.target
After=network.target

[Service]
Type=forking
ExecStart=/usr/local/sbin/chronyd -f /etc/chrony.conf

[Install]
Alias=chronyd.service
WantedBy=multi-user.target
timehat/software_03-2025.txt ยท Last modified: 2025/03/16 01:38 by millerjs

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki