This live screen grab is from one of my HamClocks. It updates automatically every minute after making a random tap.

Ham Clock

This page refers to my QST article in the October 2017 issue. All updates will be posted here.

I would like to give Shoutouts to Adafruit and the Raspberry Pi Foundation for their great products, software and documentation.

News highlights: See the complete version history in the Download tab and details in the User Guide.
  • Two map styles now available, Terrain and Countries; select in Setup.
  • HamClock can now connect to WSJT-X and JTDX to automatically set DX from FT8 contact.
  • Stopwatch with Countdown timer, tap icon below seconds to access.
  • DX Spider spots are an option in the center plot pane for listing and display on the map. Tap list entry to set DX and KX3 frequency (if configured).
    Note: You are logged into a cluster while this feature is visible.
  • Support UNIX gpsd daemon for setting DE location and time from a GPS receiver.
  • Display VOACAP band path reliability predictions from DE to DX at various power levels.
  • Now manufactured by Veritium Research and marketed by Gigaparts rebranded as HFClock.

73, Elwood Downey, WBØOEW

Original QST Article proof

Corrections:

Download current stable HamClock release source code here.

Revision history:

Version 2.52: Version 2.51: Version 2.50: Version 2.49: Version 2.48: Version 2.47: Version 2.46: Version 2.45: Version 2.44: Version 2.43: Version 2.42: Version 2.41: Version 2.40: Version 2.39: Version 2.38: Version 2.37: Version 2.36: Version 2.35: Version 2.34: Version 2.33: Version 2.32: Version 2.31: Version 2.30: Version 2.29: Version 2.28: Version 2.27: Version 2.26: Version 2.25: Version 2.24: Version 2.23: Version 2.22: Version 2.21: Version 2.20: Version 2.19: Version 2.18: Version 2.17: Version 2.16: Version 2.15: Version 2.14: Version 2.13: Version 2.12: Version 2.11: Version 2.10: Version 2.09: Version 2.08: Version 2.07: Version 2.06: Version 2.05: Version 2.04: Version 2.03: Version 2.02: Version 2.01: Version 2.00: Version 1.94: Version 1.93: Version 1.92: Version 1.91: Version 1.90: Version 1.89: Version 1.88: Version 1.87: Version 1.86: Version 1.85: Version 1.84: Version 1.83: Version 1.82: Version 1.81: Version 1.80: Version 1.79: Version 1.78: Version 1.77: Version 1.76: Version 1.75: Version 1.74: Version 1.73: Version 1.72: Version 1.71: Version 1.70: Version 1.69: Version 1.68: Version 1.67: Version 1.66: Version 1.65: Version 1.64: Version 1.63: Version 1.62: Version 1.61: Version 1.60: Version 1.59: Version 1.58: Version 1.57: Version 1.56: Version 1.55: Version 1.54: Version 1.53: Version 1.52: Version 1.51: Version 1.50: Version 1.49: Version 1.48: Version 1.47: Version 1.46: Version 1.45: Version 1.44: Version 1.43: Version 1.42: Version 1.41: Version 1.40: Version 1.39: Version 1.38: Version 1.37: Version 1.36: Version 1.35: Version 1.34: Version 1.33: Version 1.32: Version 1.31: Version 1.30: Version 1.29: Version 1.28: Version 1.27: Version 1.26: Version 1.25: Version 1.24: Version 1.23: Version 1.22: Version 1.21: Version 1.20: Version 1.19: Version 1.18: Version 1.17: Version 1.16:

• How do I build the ESP8266 software?

  1. Install the latest Arduino IDE with these these instructions. I am currently using version 1.8.13.
  2. Load up the ESP8266 Arduino extension described here. Stop when you reach the step named "Setup ESP8266 Support" then do these steps:
    1. Quit and restart the IDE
    2. Open Tools -> Boards -> Boards Manager
    3. Search for "esp8266"
    4. Select version 2.7.4 then click Install.
      Do not select a different version.
    5. Close then Quit the IDE again
  3. Download and install the following Arduino libraries:

    Do not use newer versions, these are the versions I have tested extensively.

    If you need help with libraries in general try here .

  4. Connect your computer to the Huzzah with a USB port
  5. Download current stable HamClock release here, unzip it any place you wish.
  6. Start the Arduino IDE. Open the ESPHamClock.ino file you just unzipped. This will create a new project.
  7. In the IDE Tools menu make the following selections (click for larger view):

    ide

    If the options you see do not look exactly like mine (except possibly Port) then you have the wrong esp8266 board version, go back and install 2.7.4 before continuing!

  8. Run Sketch → Compile then Sketch → Upload
  9. Your HamClock should start running. Follow the touch screen and setup functions carefully.

• How do I build the Raspberry Pi Desktop or fb0 software?

See the Desktop tab, on the right.

• Can HamClock run on Windows?

No, it can not run natively on Windows but it can display on Windows by using an X Server. The idea is to run the HamClock program on a UNIX-like system, such as RPi or WSL (Windows Subsystem for Linux) or Cygwin, then run HamClock in such a way that it displays on the X Server running on Windows.

For example:

Note in the example above, 192.168.7.129 is the IP of the Windows machine, so change that to match your system configuration. Also note the ":1" of the DISPLAY environment variable says to use X Server display 1, which corresponds to the selection I made while running XLaunch. If you find it won't connect, it might be due to your Windows firewall. X Window servers listen on port 6000 + display_number, so in this case be sure Windows is allowing incoming connections on port 6001.

• Can HamClock run on iPhone or iPad?

Similar answer as previous FAQ but you'll need an X server app for iPad. I find Mocha X11 works well.

• How does HamClock compare to Geochron 4k?

I do not have a Geochron 4K but from its literature I can think of the following display functions related to ham radio that HamClock offers but Geochron does not:

  1. VOACAP predictions for any path at several power levels
  2. trend plots and predictions for solar flux, sunspot, XRay and Kp index
  3. short and long path antenna beam heading and distance to any DX location
  4. display next satellite rise/set times and overhead pass (not just global track)
  5. display local time in HH:MM digital, analog or calendar formats
  6. azimuthal world maps centered on any location
  7. local weather, time, grid square, prefix and sun rise/set times at any DX location
  8. live scrolling DX cluster display
  9. live display of WSJT-X and JTDX FT8 contacts
  10. live solar images from Solar Dynamics Observatory
  11. live NCDXF beacon location, time and frequency schedule
  12. live RSS feeds from popular ham web sites
  13. stopwatch and station ID count down timer with optional color LED and switch control
  14. show Moon rise/set and overhead passes for EME
  15. adjust time forward or back to explore gray line location, satellite orbits etc
  16. optional Elecraft KX3 transceiver frequency control from DX Cluster spot
  17. optional local temperature, pressure and humidity sensor for real-time and 25 hour trend plots
  18. optional photosensor to adjust display brightness with changes in room lighting
  19. adjustable scheduled display On and Off times, and idle time dimming
  20. remote control functions from any browser or curl command line

Conversely, Geochron can do things HamClock can not. These items are certainly interesting but to me they do not seem specifically useful to the typical amateur radio operator:

  1. air and sea traffic
  2. pollution and population maps
  3. different landform map styles

If I have misrepresented Geochron in any way, please let me know and I will correct immediately.

• How does the DX Cluster feature work?

  1. In the Setup page, tap the Cluster? button then set the internet host name and port for your desired DX Spider node. A good list is here. Be sure to choose a Spider node, AR and CC clusters are not supported. Turn off the Cluster? button if you don't want to use a cluster.
  2. Once HamClock is up and running, tap the center plot pane until the DX Cluster page appears. The name of the host will be shown in yellow, and it will turn green when a connection is established. If the connection fails, it will show an error in red.
  3. Once connected, just leave it run, new spots will be listed, scrolling when full. Tap on a spot to set DX to that location. The tap can also set the frequency of an Elecraft KX3, see the User Guide for details.
  4. Beware: HamClock stays logged into the cluster node with your call sign as long as the DX Cluster pane is active. So do not use this feature if you want to use the unassisted category in a contest -- some judges do check!
  5. Spider nodes support a lot of options and settings and HamClock makes no attempt to control any of them. But you may still be able to set them by logging in to the same cluster a second time simultaneously from a different application or telnet session. You should use the same call but add an SSID suffix like "-1" so the spider software won't detect a duplicate and disconnect HamClock. Now from this second connection, make the desired settings and most nodes will carry them over to all login sessions, including the HamClock session. Here is just one example of a set of filters that will show only CW spots from operators in US or southern Canada:
        filter1 reject not by_zone 3,4,5
        filter2 reject not on hf/cw
        filter3 reject on hf/rtty
        filter4 reject on hf/ssb
        filter5 reject info ft8
                    
  6. Oddly, it is also possible to use this feature to communicate with WSJT-X. Instead of showing cluster spots, it shows each FT8 station you attempt to work and also immediately loads DX with its location. Details for doing this are in the User Guide.

• Can I make different sizes beyond those in the Makefile?

No. Each size requires its own custom fonts, symbols, maps and solar images in order to take full advantage of the higher resolutions. Otherwise, these would be very pixelated if they were just multiples of the base images. Plus, if the aspect ratio changes, the layout would need to be rebalanced. This is why all sizes are multiples of 2 of the base size in order to maintain the same layout proportions.

• Why can I click on the DE or DX grid square and sometimes get a second value?

Because displaying location only to a whole degree, or any finite precision, can be ambiguous. Suppose you use the Setup screen to enter location 40N and 100.1W. This is in grid square DN90. But this location will be rounded to 40N 100W for display and this location is in grid square EN00. Just looking at the rounded HamClock display values you can't tell what the original location is, so HamClock gives you the choice of selecting the grid according to your intended usage.

The reason this happens is because grid squares increase from west to east, starting at 180W, and the major longitude grid boundaries are on even integral values. Thus 100W is in one grid and 100.1W is in a different grid. This becomes easier to see when using signed notation. You might expect moving from -100 to -100.1 would stay in the same grid but it doesn't because it is more westward and crosses the boundary at -100. But there is no ambiguity going from -101 to -101.1 because these are both near the center of the same grid, DN90. There is also no grid change going from the eastern longitude of positive 100 to 100.1 because the numeric increase is eastward and both locations are in the same grid, ON00.

The exact same thing happens with latitudes except they grow northwards from 90S and grid boundaries are on every integral line.

In addition to being set from the Setup screen, fractional coordinates can also result when setting location with other methods as well, such as IP Geolocation, gpsd or the remote web socket interface -- in all cases the full precision is maintained internally but only displayed to whole degrees. However, if you set a location by tapping the map or tapping the coordinate values to increment or decrement them then HamClock discards any fractional coordinate values so these methods never lead to a grid square ambiguity.

• Occasionally you mention web interface to the HamClock, what is this?

Among its other features, the HamClock is also a web server. This allows you to remotely control your HamClock over a network using a browser or command line tool such as curl or wget.

To try the following examples, you will need a computer on the same network as your HamClock. Here we will use curl but the same URLs will work in your browser as well (although some browsers are getting more paranoid about accessing a web site with http and you may be asked to trust the site). Note that these commands only function while HamClock is displaying its main page, not auxiliary pages such as Setup, Stopwatch etc.

Start by querying HamClock for a list of all its commands as follows: (actually any unrecognized command will produce this help text)

	curl 'http://192.168.7.101/help'
        

The output will be a list of all supported commands as follows:

Syntax Summary
get_capture.bmp Save screen as bmp file
get_config.txt Report current HamClock configuration settings
get_countdown.txt Report remaining seconds of count down timer
get_de.txt Report DE info
get_dx.txt Report DX info
get_dxspots.txt Report current list of DX cluster spots
get_satellite.txt Report current satellite position, if one is defined
get_sensors.txt Generate list of sensor values, if one is attached
get_sys.txt Report some basic HamClock system information
get_time.txt Report HamClock's idea of UTC
set_countdown?minutes Set count down timer minutes and start
set_displayOnOff?on|off Turn display on or off
set_displayTimes?on=HR:MN&off=HR:MN&idle=mins Set DE display on and off times and idle duration
set_newde?lat=X&lng=Y Define a new DE location using latitude/longitude
set_newdegrid?AB12 Define a new DE location using its maidenhead grid square
set_newdx?lat=X&lng=Y Define a new DX location using latitude/longitude
set_newdxgrid?AB12 Define a new DX location using its maidenhead grid square
set_pane?Pane[123]=XXX

Pane1=SSN,XRAY,Flux,KP,VOACAP

Pane2=XRAY,Flux,KP,VOACAP,Cluster

Pane3=ENV_Temp,ENV_Pressure,ENV_Humidity,

ENV_DewPoint,SDO_Composite,SDO_6173A,

SDO_Magnetogram,Gimbal,KP,VOACAP,NOAA_SpaceWx

Set what is displayed in a given plot pane; no dups allowed
set_satname?abc|none Select satellite from built-in list, or none
set_sattle?name=abc&t1=line1&t2=line2 Define a satellite using TLE values
set_time?ISO=YYYY-MM-DDTHH:MM:SS Set UTC to the given time
set_time?Now Set UTC to current time from network
set_time?unix=secs_since_1970 Set UTC to the given UNIX time
set_touch?x=X&y=Y Act as if touched at the given screen coordinates, scaled to 800 x 480
restart Restart HamClock
updateVersion Check for new version and update if found
any command not recognized Show this help

Examples:

Get the current clock UTC time:

	curl 'http://192.168.7.101/get_time.txt'
        

Set display to shut off at 10 PM and back on at 8 AM, DE time, with 10 minutes idle time:

	curl 'http://192.168.7.101/set_displayTimes?on=8:00&off=22:00&idle=10'
        

Set a new DE location from latitude and longitude:

	curl 'http://192.168.7.101/set_newde?lat=40.7&lng=-74'
        

Save the current display to a file named hcscreen.bmp:

	curl 'http://192.168.7.101/get_capture.bmp' > hcscreen.bmp
        

Set and start the count down timer to 10 minutes:

	curl 'http://192.168.7.101/set_countdown?10'
        

Set satellite to ISS and report current ephemeris with respect to DE:

	curl 'http://192.168.7.101/set_satname?ISS'
        

Set Pane 3 to show NOAA Space weather:

	curl 'http://192.168.7.101/set_pane?Pane3=NOAA_SpaceWx
        

• How are the background maps managed?

As of Version 2.52, the background map images are downloaded and stored as local files as needed. In previous versions they were embedded within the executable image and were thus immutable and limited by memory size.

This meant the ESP HamClocks could only ever support one map style, and even that was only at half the available screen resolution. ESP HamClocks now use the extended FLASH file system to store the map images at full resolution. The improved resolution is especially apparent in the night portion of the Terrain style map. Unfortunately, more pixels and slower FLASH access means the display update rate is about 30% slower but the added flexibility and visual results seem worth it.

The UNIX versions of HamClock store their map files in ~/.hamclock. Note if you run with sudo, this refers to root's home directory, not your login home.

If you run HamClock without a network connection, you will be limited to map styles already downloaded.

The maps are stored in .bmp format, version 4, using 16 bit RG565 pixels. There are separate files for day and night for each map style. HamClock uses these to render the two sunlit regions and blends them in a 12° band to match civil twilight.

• Holding the padlock does not restart ESP, what's going on?

For some unknown reason, this feature does not work the first time you try it after flashing the ESP Huzzah via USB from your computer. Use the reset button on Huzzah once then the padlock will work from then on. This issue does not occur if the Huzzah was reflashed remotely.

• How do I shut off HamClock on the RPi fb0?

Log in and kill the process with the following command:

        sudo pkill 'hamclock.*'

• How do I safely power off my RPi?

  1. First tell linux to shut down gracefully in either one of these two ways:
    1. If running fb0 HamClock: hold padlock for 3 seconds, then select Shutdown
    2. otherwise in general: Log in and type the following command:
      sudo halt
      
  2. Then either way, watch the green LED; when it stops blinking it is safe to remove power.
  3. Note you do not need to bother shutting off HamClock before powering off RPi, it won't hurt the Clock in any way.

• My question is not here and I can not find the answer after studying everything on this site, where I get help?

Send a polite note to me at ecdowney@clearskyinstitute.com.

To use a 9" ER-TFTM090-2 from buydisplay.com:

Select these options during purchase:

This is the wiring list:

    EP = ESP Huzzah
    BM = BME280 sensor
    PC = photo cell
    DP = display

    EP_SCL    BM_SCK
    EP_SDA    BM_SDI
    EP_3V     BM_VIN
    EP_GND    BM_GND

    EP_ADC    PC_1, 330k
    EP_GND    PC_2
    EP_3V     330k

    EP_SCK    DP_8
    EP_MO     DP_7
    EP_MI     DP_6
    EP_2      DP_5
    EP_16     DP_11
    EP_USB    DP_3, 4, 37, 38
    EP_GND    DP_1, 2, 13, 31, 39, 40
	

Pros:

Cons:

The display stand from Adafruit can be made to work with a little ingenuity but is not perfect for the LCD. Send suggestions for better ideas and I will post here.

If you find your display idea works better if the cable exits from the top, there is an option in the Setup screen that allows you to flip the display upside down.

Here is how I built my first two prototypes:

Shack photo showing 7" version.

Rear of 7" version

Both the 7" and 9" versions.

Rear of 9" version

This is a guide to the touch controls and map symbols of HamClock. A printable view is also available.








HamClock may also be built for Raspberry Pi, macOS, linux, Ubuntu, FreeBSD or any other UNIX-like system in either of two ways:

HamClock may be built in the following sizes. If the display is larger, HamClock will center itself within a black background.

Operation of HamClock on these platforms is exactly the same as the ESP8266 version with the following exceptions:

Using a Pi Zero is not recommended as it will lead to erratic behavior. HamClock requires the multiple cores only available on any Pi model 3 or 4.

• To give it a try on your GUI desktop, follow these steps:

  1. open a terminal on the target system desktop to get a command line prompt
  2. run these commands:
        cd
        curl -o ESPHamClock.zip http://www.clearskyinstitute.com/ham/HamClock/ESPHamClock.zip
        unzip ESPHamClock.zip
        cd ESPHamClock
        make -j 4 hamclock-800x480
        sudo ./hamclock-800x480
    
  3. If you get errors during make:
    • on RPi try updating and loading more packages such as
          sudo apt-get update
          sudo apt-get -y install make g++ libx11-dev
      
    • on Ubuntu try loading more packages such as
          sudo apt install curl make g++ xorg-dev
      
    • on macOS try installing XQuartz and Xcode. Then run
          xcode-select --install
      
  4. The example make command above will build HamClock at 800x480 pixels for X11. Type make help for a list of other sizes available. Then redo the make and sudo commands again substituting the preferred size.
  5. If you would like a Desktop icon with which to start HamClock on RPi, copy hamclock.desktop to your Desktop folder with this command:
        cp hamclock.desktop ~/Desktop
    

    Or if you would like HamClock to start automatically when you log in, make sure you have an autostart directory then copy hamclock.desktop into there with these commands:

        mkdir -p ~/.config/autostart
        cp hamclock.desktop ~/.config/autostart
    

    The sample hamclock.desktop file assumes you made hamclock-800x480 so edit the Exec line if you have chosen a different size program name.

  6. If you want HamClock to completely fill the display but can't find a good match between your screen size and a HamClock size, try running xrandr. This command can resize your display resolution to more closely match HamClock. For example, my display is 1920x1280 so I build hamclock-1600x960 and run the following command:
        xrandr --output HDMI-1 --scale 0.833x0.92
    
    I computed 0.833 from 1600/1920 but 0.92 was found experimentally to account for the extra menu bar height. With care, this technique can come quite close but don't expect perfection.
  7. On macOS, you can turn the bare executable into a clickable App on your Desktop as follows:
        mkdir -p ~/Desktop/HamClock.app/Contents/MacOS
        cp hamclock-800x480 ~/Desktop/HamClock.app/Contents/MacOS/hamclock
    
    To give it a proper icon:
    1. open hamclock.png with Preview
    2. type Commmand-A to select the image
    3. type Commmand-C to copy the image to the clipboard
    4. right-click the new HamClock.app Desktop item and select Get Info
    5. click the existing default icon in the upper left corner
    6. type Command-V to paste a new icon
    7. close Get Info
    8. close Preview

• To try it on an RPi using a dedicated HDMI or DSI display, which I call the fb0 version, follow these steps:

Note: you must use ssh as instructed, do not try to use the RPi display for these commands. The HamClock must have the fb0 display all to itself.

  1. log in via ssh (or putty, etc)
  2. run sudo raspi-config one time and set the following options:
    1. Boot Options -> Desktop/CLI -> Console
    2. For HDMI only, not for DSI: Advanced options -> Resolution -> choose one the same or a little larger than a HamClock size
  3. reboot
  4. connect to your RPi again with ssh and run the following commands:
        cd
        curl -o ESPHamClock.zip http://www.clearskyinstitute.com/ham/HamClock/ESPHamClock.zip
        unzip ESPHamClock.zip
        cd ESPHamClock
        make -j 3 hamclock-fb0-1600x960
        sudo ./hamclock-fb0-1600x960
    
  5. The example make command above will build HamClock at 1600x960 pixels for fb0. If you want the smaller size 800x480 for the 7" display, redo the make and sudo commands with hamclock-fb0-800x480. Type make help for a list of other fb0 sizes available.
  6. If HamClock is logging a message about incorrect frame buffer depth, try this:
    • edit /boot/config.txt
    • put a # character in front of all lines that contain dtoverlay=vc4-fkms-v3d
    • save and reboot
    • then type
      sudo fbset -depth 32
      
  7. If you see a little blinking line near the left edge, try running this command:
        sudo bash -c "echo 0 > /sys/class/graphics/fbcon/cursor_blink"
    
  8. Note that all UNIX versions of HamClock emulate the ESP non-volatile EEPROM with the file ~/.hamclock/eeprom. Removing this file and restarting HamClock will reset it back to all default values. Note if you run with sudo, this refers to root's home directory, not your login home.
  9. To start HamClock automatically when the system boots, consider using crontab. For example:
    1. Start crontab with the edit option:
          crontab -e
      
    2. Add this one line:
          @reboot cd ESPHamClock; sudo ./hamclock-fb0 > hamclock.log 2>&1
      
    3. Save and exit the editor. Test by rebooting. This example assumes ESPHamClock is in your home directory and you want to run hamclock-fb0 therein. Adjust as necessary to match the configuration you specified in your make command. This example also saves the log output but if you would rather just discard it, change the log file name to /dev/null like so:
          @reboot cd ESPHamClock; sudo ./hamclock-fb0 > /dev/null 2>&1
      
    4. To learn more about crontab type:
          man 5 crontab
      

• To use the Bosch BME280 environment sensor on RPi, follow these steps:

  1. connect the sensor to the RPi using the 40 pin connector as follows:

    RPi Header pin BME label
    1 Vin
    3 SDI
    5 SCK
    9 GND

  2. install i2c-tools:
        sudo apt-get install i2c-tools
    
  3. run sudo raspi-config and set the following options:
        Interface Options: I2C: enabled
    
  4. Check the Bosch is connected correctly with these tests:
        sudo i2cdetect -y 1
    
    you should see 77 in lower right corner of matrix; then
        sudo i2cdump -y 1 0x77 b
    
    you should see a matrix of numbers, NOT XX
  5. Restart HamClock by tapping and holding the padlock for 3 seconds.
  6. After HamClock is running again, click in the lower half of SDO image pane to see environmental plots.
This site does not use cookies.