GPS controlled clock based on Raspberry Pi

This is an adjunct to my previous post on creating a Stratum 1 NTP time server with a Raspberry Pi. I finished this project about a year ago, and I have to say it has been running flawlessly since then. I thought that perhaps the inexpensive GPS module designed to work with drones might not hold up. But it has.

Midnight in London

Wouldn’t it be nice to use this time source, not just to set hardware clocks but also display the time in varous places? Yes, yes it would.

Since most of my ideas are not original, I figured a quick internet search may shed some light on how to proceed. Keith, G6NHU did exactly this a year ago or so. His project can be viewed here: https://qso365.co.uk/2023/05/how-to-build-a-shack-clock-using-a-raspberry-pi-and-a-7-touch-display/

As I suspected, with a few more configuration steps, this NTP server can display the time on the native HDMI port as well as create a simple web page available on the LAN for any computer to access with a web browser. The web server is Lighttpd, which is a low CPU load, low memory demon, perfect for an older Raspberry Pi 3.

The display I chose is a 7-inch 16×9 non-touch purchased from Amazon for $33.99: https://www.amazon.com/gp/product/B0BGXB2Y67/ (not an affiliate link)

When I created the NTP server last year, I named it ntpserver. The unit runs headless (no keyboard or monitor) so I use ssh to get into the command line. Thus, the first command is:

ssh ntpserver@192.168.1.200

Once in, always do an update:

sudo apt-get update
sudo apt-get upgrade -y

The following programs need to be added to the Pi:

sudo apt install xorg openbox xserver-xorg xinit unclutter lighttpd -y

If the OS is off the shelf Raspian, then Chromium should already be installed, but if not, then add it:

sudo apt install chromium-browser -y

Once that is done, some things need to be configured. Using whatever text editor you like the xserver so that anyone can access it. Open the Xwrapper file:

sudo nano /etc/X11/Xwrapper.config

Then add line:

allowed_users=anybody

Exit and save. Next open the xserverrc file:

sudo nano /home/ntpserver/.xserverrc

Add the following:

#!/bin/sh
#Start the X server session with no power management so the display never sleeps
exec /usr/bin/X -s 0 -dpms -nolisten tcp "$@"

Exit and save. Next open the xsession file:

sudo nano /home/ntpserver/.xsession

Add the following:

#!/bin/sh
#Start Chromium at startup
chromium-browser --start-fullscreen --window-size=800,480 --disable-infobars --noerrdialogs --incognito --kiosk http://localhost

Exit and save. Note the display size can be configured to any screen resolution. This affects the HDMI port, not the web page. The 7-inch Raspberry Pi monitor that I purchased from Amazon has an 800 x 480 screen resolution. If you are using a different screen resolution, change as needed. Next open the clock.service file (it will be created when you save the file):

sudo nano /etc/systemd/system/clock.service

Add the following:

[Unit]
Description=Clock
After=network-online.target
DefaultDependencies=no

[Service]
User=clock
ExecStart=/usr/bin/startx
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target

Exit and save.

The web page that will be displayed on the HDMI port as well as served to local hosts on the LAN is a java script page. It was originally developed by Nayuki: https://www.nayuki.io/page/full-screen-clock-javascript You can download whatever format you like from that site (I copied the page source) or you can download a 24-hour format from Keith’s site:

cd /var/www/html
sudo wget https://qsl.net/g6nhu/clock/index.html

The colors can be edited:

sudo nano /var/www/html/index.html

The background, foreground, and font type can be changed as desired.

Next start the clock service and reboot:

sudo systemctl enable clock
sudo systemctl start clock
sudo reboot now

Here is a quick video of the web page on my desktop computer. I have the GPS monitor from the ntpserver up and running in the left upper corner. That shows the GPS data going into the Raspberry Pi from the serial port along with some scratchy WWV audio. The actual clock sync is from the 1PPS output of the GPS module.

I could see this being used as an inexpensive master clock system somewhere. With an HDMI splitter (or a better name would be Distribution Amp), this could be sent to many locations.

Now all I need to do is figure out how to get a GPS synced 10 MHz output capable of driving multiple devices.

The Shively 6025 Broadband Log Periodic Antenna

Several companies make variations of this antenna; Scale FM-CL is a lower-power version that is used mostly by translators. They are highly directional and can be installed in a vertical, horizontal, or cross-polarized (45-degree slant) manner. This model input power is 5 KW per bay and the manufacturer’s specification is for 1.28:1 or less VSWR across the entire FM band. In the slant configuration, which Shively states is right-hand circularly polarized, the gain is 4.03 dB.

I recently did some work onsite for WXMD, California, Maryland. They were having some issues with high reflected power readings on their transmitter and suspected an antenna or transmission line problem. The station has been on the air for about 10 years and began having issues late last year after a thunderstorm passed through the area.

WXMD California, MD South East Bay Shively 6025 antenna

The main issue was that the transmitter was showing 243 watts of reflected power with 9800 watts of forward power, while the inline watt meter showed 37 watts. As part of the repairs, a new 1 5/8 transmission line was run up the tower replacing the old line which was damaged at the power divider input connector. A new power divider was also installed. Was the antenna still defective? Was the new transmission line and/or power divider defective? Was there an issue with the inline watt meter? Questions, questions, questions…

Thus, several sweeps were needed to verify things:

1 5/8 inch line terminated at the power divider with known good load

This antenna has a power divider that splits the power between a southeast-facing antenna bay and a southwest-facing antenna bay. To be sure that we were not dealing with a bad connector or transmission line, the line was swept in isolation from the input of the inline watt meter to the input of the power divider. This showed that the transmission line, connectors, elbows, and inline watt meter were all good.

Southeast Antenna SWR
Southeast antenna return loss

Next, each antenna bay was swept individually. The power divider port going to the disconnected antenna was terminated with a known good 50-ohm load.

Southwest antenna SWR
Southwest antenna return loss

Once the individual bays, jumpers, and power divider tested good, the entire antenna system was swept.

Full antenna SWR

With everything connected, the SWR showed 1.19:1. Not ideal but not terrible either. The inline watt meter readings were verified with a precision watt meter and the final SWR calculated by hand was 1.16:1.

Full antenna return loss

Therefore, the antenna system is performing within the manufacturer’s specifications.

Network analyzer

The American Amplifier Technology inline FM watt meter was then checked with a precision power meter. The readings on that device were more or less in line with the precision power meter, thus the transmitter directional coupler is out of calibration.

Mini-Circuits Precision Power meter, Forward Power
Mini-Circuits Precision Power meter, Reflected Power

The transmitter shelter is just large enough for one rack. Thankfully, the weather was cooperative, we were able to work outside. Overall, it was a productive trip and an enjoyable experience.

Measuring FM Harmonics

Anytime a new transmitter is installed or major changes to an FM transmission system are implemented, the performance measurements described in FCC 73.317 should be completed to ensure no interference to other radio services. This is becoming a larger issue with the advent of LTE and 5G mobile data. These services along with E911 and other mobile services are often co-located at FM transmitter sites.

The FCC stipulates that emissions removed from the carrier by more than 600 KHz must be attenuated 80 dB below the carrier. These days, that is not enough. We have had issues with older tube-type transmitters interfering with cellular and mobile data service, even though they met or were far below the FCC specification. The first in, first out rule also didn’t seem to matter either. Those mobile phone providers paid a lot of money when they purchased chunks of RF spectrum at auction, and the FCC will side with them if there is any dispute.

Having a record of measurements that show compliance with the FCC regulations can go a long way in heading off any future problems. I make measurements out to the 10th harmonic.

To get the best results, I have been using a couple of high-pass filters from Mini-circuits.

Mini-Circuits NHP-200+

These attenuate the carrier power seen by the spectrum analyzer by approximately 90 dB depending on the frequency. That allows the instrument noise floor to be lowered to -130 dB which should be well below any receiver noise floor being used by other wireless services.

100.7 MHz no HPF
100.7 with two HPF-200+ High Pass Filters

The carrier is attenuated by 92.44 dB. The rest of the measurements are made with the attenuation set to zero and the preamp turned on. For the lowest FM frequency, 88.1 MHz, the filters are on the edge of their shoulder at the 2nd harmonic. I measured the return loss and found that they matched the manufacturer’s datasheet.

Mini-circuits HPF-200+ X 2, 176 – 216 MHz S21 Return loss

That loss is counted as attenuation for the second harmonic. For the rest of the harmonics, I used 0.5 dB attenuation, which represents connector loss. I could have also measured the cable loss at each harmonic, but that seems unnecessary, given several of the readings were below the noise floor.

To speed things along, I made this handy Excel spreadsheet, which does all of the calculations for me:

FM harmonics spreadsheet

A copy of that spreadsheet can be downloaded: FM Harmonic template

Once completed, I printed a copy and put it with the station maintenance log at the transmitter site.

Repairing an RF module for a DX-50

I like these types of posts. Many people are intimidated by component-level repairs. I write this to show that it is possible, with minimal test equipment and easy-to-understand directions, to make repairs and get things back in working order.

Every year, we lose two or three RF amplifier modules from the DX-50s. Normally, this happens after a thunderstorm. Sometimes it is a spontaneous failure.

The project starts here; faulted RF module

These are fairly simple medium-wave RF amplifiers. There are no adjustments or tuning circuits on the amplifier board itself. They use eight IRFP-350 RF devices. There are two fuses to protect the transmitter power supply against device short circuits. If a fuse blows; Section C, RF amplifier Modules, of the DX-50 manual has a good troubleshooting guide. There is a very good chance that one or more of the RF devices is bad. Unfortunately, they have to be removed to be tested.

Gates Air recommends that if one device is failed, all four devices from that section are replaced at the same time even if they test good. The IRFP350s are inexpensive devices and it is easier to replace everything at once. The Mouser Part number is 844-IRFP350PBF and they are $3.81 each as of this writing. The PBF suffix means it is lead-free.

The other part that can be bad, but it is unlikely, is the TVSS diode across the gate and source (CR1-4). These are inexpensive as well. Mouser part number is 576-P6KE20CA and they are $0.38 each. It is good to have a few of these on hand.

Heatsink removed from the module

The most difficult part of this is dealing with the heat sinks. The devices get stuck to the heat sink pads after so many years, so it takes a little effort to get them separated. The manual recommends gently prying the device away from the heat sink with a small screwdriver. They can be reused if you are careful and do not rip the insulator pad. However, if the insulator pad rips, it needs to be replaced. Mouser part number 739-A15038108 ($0.86 each).

To test each IRFP350 after it has been removed, use either a DVM with greater than 3 VDC on the resistance setting or a Simpson 260 on the Rx10,0000 range. Connect the positive lead to the Drain, the negative lead to the Source, and then use a jumper connected to the Gate to turn the device on or off. Alternatively, you can use a 9-volt battery to turn the device on and off.

If the device does not turn on or off, it is defective.

The TVSS diode should measure open (>2M) in both directions. Anything other than that, the unit is defective and needs to be replaced.

DX-50 module, heatsinks removed

The first step is to remove the heat sink. I used a small screwdriver under the leads to gently pry the MOSFETS off of the heat pads. If you are careful, all of the heat pads will survive. Once the heat sink is off, I remove all four of the suspected MOSFETS. The leads are heavy gauge, so it takes a little bit of work with the solder pump and solder wick. I tested each MOSFET and found one shorted unit, the other three test okay. However, since these are inexpensive devices, I replaced all four.

DX-50 module, MOSFETS removed

Good device:

Device off
Device on

Bad device:

Device shorted

Assembly is in reverse order. Make sure that none of the insulating pads were torn during disassembly. I like to get everything attached to the heat sink before soldering the leads. It helps with lining everything up. Take care and make sure that the ferrite beads on the drain leads of Q3,10 and Q4,11 are re-installed with the new devices. These are necessary to prevent high-frequency oscillations.

Ferrites

Of course, the final test is in the transmitter. Generally speaking, I test the standby transmitter into the test load every two weeks. This is done in conjunction with the generator load test so as not to spin up the demand meter.