A GPS HAT for Raspberry Pi for easy Stratum 1 Time Server
With a RPI4 the setup is very simple just add to /boot/config.txt :
And the PPS interrupt is working :
pi@raspberrypi:~ $ sudo ppstest /dev/pps0 trying PPS source "/dev/pps0" found PPS source "/dev/pps0" ok, found 1 source(s), now start fetching data... source 0 - assert 1569142530.000035957, sequence: 125 - clear 0.000000000, sequence: 0 source 0 - assert 1569142531.000034676, sequence: 126 - clear 0.000000000, sequence: 0 source 0 - assert 1569142532.000033663, sequence: 127 - clear 0.000000000, sequence: 0
To setup the NTP server look at : http://www.satsignal.eu/ntp/Raspberry-Pi-quickstart.html
The enclosure is a PVC pipe adapter I found at a local store for 1.2 Euros :
Once it's closed it looks good :
The top is screwed and it has an inside seal, I just needed to cut a piece of plastic to fill the void.
I'm running a test with a 100 meters (328 feet) ethernet cable between the RPI and the GPS head and it works without a hitch. It should work with longer length without problem, the limiting factor should be the voltage drop but at 24V the current is small, and one pair in the cable is used for GND and another for +24V.
Basically the project is finished and it's working great. I need to publish the schematics and the gerber for the boards and add a step by step howto to ease the replication process.
On problem though: It is my first project with a RPI4,and the board is running really hot. I'm still waiting for my enclosure but there is no way the processor will run full speed without throttling when the hat is on and without heat sink nor fan. So I will make a new HAT with a fan... In this version I have a RTC with a backup battery, it works great but I do not think it's really useful in real life. So in the next version I'll remove the RTC to make room for a fan and I'll add few LED to show the status of the NTP server.
PCB received, components soldered, boards plugged, debug begins:
Sometimes the debug part of a project can be very time consuming sometime it doesn't. :-)
After a quick check everything is working, the longest part was to download a RPI image and flash it on a SDCard.
Let's look at the block diagram :
The GPS head is powered by a 24V rail coming from the RPI Hat, the PPS output and TX serial are converted to RS485 for long range communication.
The 24V rail is converted to 5V through a DC/DC buck converter to power the RS485 transmitters, and a 3.3V LDO is used to power the GPS module :
A small micro controller was put on the board to configure the GPS module but the default configuration is working great so this micro controller is not used.
The use of a RJ45 connector allows a simple Ethernet cable to connect the GPS Head to the RPI Hat.
The RPI Hat consists mainly in a dual RS485 receiver and galvanic isolation to power the GPS head.
The circuit for RS485 receivers is as follow :
The UA9637 converts the RS485 signals in TTL 5V and the digital isolator ISO7720DR drives the input of the RPi at 3.3V.
Termination resistors should be added, I unfortunately forgot them on the schematic but they can easily be soldered directly on the SO8 pins of U4.
Two isolated DC/DC module provide the 24V for the GPS head and a local isolated 5V for the RS485 receiver.
After plugin everything together, the GPS is sending data to the RPI on serial port and a very stable 1PPS pulse is driving GPIO23 on the 40 pin connector.
Success for the hardware part. In a next update we'll look at the software on RPi to set up a NTP server.