Commit | Line | Data |
---|---|---|
6bdc2473 SBS |
1 | * Time |
2 | This document was created by Steven Baltakatei Sandoval on | |
3 | ~2020-07-23T22:27Z~ under a [[https://creativecommons.org/licenses/by-sa/4.0/][Creative Commons BY-SA 4.0 license]]. It | |
4 | was updated by Steven Baltakatei Sandoval on ~2020-07-25T19:34Z~ | |
5 | ** Development Task list | |
6 | *** Set up prototype unit | |
aafe11cf SBS |
7 | **** DONE Solder wire for PPS signal |
8 | ***** 2020-07-25T20:03Z; bktei> Soldered pins to permit accessibility. | |
9 | CLOSED: [2020-07-25 Sat 20:03] | |
6bdc2473 SBS |
10 | **** Follow guide |
11 | - [[https://ozzmaker.com/forums/topic/connecting-gps-pps-pin/][Ozzmaker post]] on ~PPS~ wiring and a [[https://www.satsignal.eu/ntp/Raspberry-Pi-NTP.html][guide]] recommendation. | |
12 | - [[http://www.satsignal.eu/raspberry-pi/Schmidt-RPZ-NTP-2016.pdf][Schmidt article]] on Raspberry Pi Zero time server. | |
13 | - [[https://gpsd.gitlab.io/gpsd/gpsd-time-service-howto.html][GPSD dev ref]] page for ~gpsd~ interfacing with ~ntp~. | |
aafe11cf | 14 | - [[https://raspberryautomation.com/connect-multiple-ds18b20-temperature-sensors-to-a-raspberry-pi/][Raspberry Autom]] article on specifying custom GPIO pin. |
6bdc2473 SBS |
15 | *** Document prototype unit |
16 | ** Narrative | |
17 | The ~ninfacyzga-01~ device is equipped with an Ozzmaker BerryGPS-IMU | |
18 | module which provides time and location data to ~gpsd~. The time is | |
19 | provided by GPS satellites which themselves are [[https://science.nasa.gov/science-news/science-at-nasa/2002/08apr_atomicclock/][equipped]] with atomic | |
20 | clocks. This extremely accurate set of clocks are needed since a GPS | |
21 | receiver calculates its position in space using a General Relativity | |
22 | calculation that uses the small variations in the time stamps received | |
23 | from each satellite. This means that ~gpsd~ may be used to set the | |
24 | system clock without a need for an internet connection to a default | |
25 | Debian time server; ~ninfacyzga-01~ can be its own time server. | |
26 | ** Description | |
27 | *** Hardware | |
28 | Ozzmaker BerryGPS-IMU, Version 3 | |
29 | *** Software | |
30 | This guide describes steps that may be used to convert a Raspberry Pi | |
31 | into a time server using ~gpsd~. | |
32 | ** Operating Procedures | |
33 | *** Initial Startup | |
34 | **** Install Raspbian 10 (Buster) onto a Raspberry Pi Zero W. | |
35 | **** Install Hardware | |
36 | See [[https://ozzmaker.com/forums/topic/connecting-gps-pps-pin/][this]] Ozzmaker forum topic about connecting the BerryGPS-IMU | |
37 | ~T_PULSE~ pin to GPIO 18. | |
38 | ||
39 | Connect the ~T_PULSE~ connection on the BerryGPS-IMU-3 to GPIO pin 18 | |
aafe11cf SBS |
40 | (ex: with solder and wire) in order to provide the PPS data signal |
41 | generated by the BerryGPS-IMU to the Raspberry Pi. Processing of this | |
42 | data signal is handled by adding a line to ~/boot/config.txt~ in the | |
43 | next section ("Install Software"). | |
6bdc2473 SBS |
44 | |
45 | **** Install Software | |
6bdc2473 SBS |
46 | These instructions assume that ~gpsd~ has already been setup to |
47 | provide NMEA sentences to ~gpspipe~ for location. See the ~README.org~ | |
48 | in ~doc/location~ for details. Basically, ~gpsd~ needs to be told via | |
aafe11cf | 49 | its ~/etc/default/gpsd~ configuration file of which ~/dev/ttyS0~ will |
6bdc2473 SBS |
50 | provide the raw GPS module data. |
51 | ||
aafe11cf SBS |
52 | ***** Install packages via ~apt~ |
53 | Run the following command to install the required packages. | |
54 | : $ sudo apt install usbmount eject gpsd gpsd-clients python-gps pps-tools ntp | |
55 | ||
56 | ***** Modify ~/boot/config.txt~ | |
57 | In order to tell the Raspberry Pi to expect PPS data on ~BCM 18~ (pin | |
58 | number 12; see [[https://pinout.xyz/][RaspPi pinout]]), add the following line to | |
59 | ~/boot/config.txt~ as described on [[https://ozzmaker.com/forums/topic/problems-with-pps-on-a-pi0w-running-raspian-and-attached-to-a-berrygps-imuv3/][this Ozzmaker page]]: | |
60 | ||
61 | : dtoverlay=pps-gpio,gpiopin=18 | |
62 | ||
63 | PPS data can be confirmed by running: | |
64 | ||
65 | #+BEGIN_EXAMPLE | |
66 | $ sudo su - | |
67 | # ppstest /dev/pps0 | |
68 | trying PPS source "/dev/pps0" | |
69 | found PPS source "/dev/pps0" | |
70 | ok, found 1 source(s), now start fetching data... | |
71 | source 0 - assert 1595708074.003644641, sequence: 219 - clear 0.000000000, sequence: 0 | |
72 | source 0 - assert 1595708075.003709620, sequence: 220 - clear 0.000000000, sequence: 0 | |
73 | source 0 - assert 1595708076.003779580, sequence: 221 - clear 0.000000000, sequence: 0 | |
74 | source 0 - assert 1595708077.003850580, sequence: 222 - clear 0.000000000, sequence: 0 | |
75 | #+END_EXAMPLE | |
76 | ||
77 | ***** Add udev rule | |
78 | As per [[https://www.slsmk.com/how-to-setup-a-gps-pps-ntp-time-server-on-raspberry-pi/][the slsmk.com]] guide, create symbolic links expected by ~ntp~ | |
79 | pointing to the PPS device. This may be performed by creating the file: | |
80 | ||
81 | : /etc/udev/rules.d/09-pps.rules | |
82 | ||
83 | with the contents: | |
84 | ||
85 | #+BEGIN_EXAMPLE | |
86 | KERNEL=="ttyAMA0", SUBSYSTEM=="tty", DRIVER=="", OWNER=="root", GROUP=="tty", MODE=="0777", SYMLINK+="gps0" | |
87 | #+END_EXAMPLE | |
88 | ||
89 | ***** Modify ~/etc/modules~ | |
90 | For older versions of Raspberry Pi, it may be necessary to explicitly | |
91 | require the ~pps-gpio~ module to be loaded by making sure | |
92 | ~/etc/modules~ contains the line: | |
93 | ||
94 | : pps-gpio | |
95 | ||
96 | According to [[https://www.raspberrypi.org/forums/viewtopic.php?p=757747#p757747][this]] post on 2015-05-13T09:14 by [[https://www.raspberrypi.org/forums/memberlist.php?mode=viewprofile&u=31454][ame]] on the Raspberry Pi | |
97 | forums, | |
98 | ||
99 | #+BEGIN_QUOTE | |
100 | rowlandski wrote: | |
101 | > Hi, | |
102 | > | |
103 | > I want the RPi to load/probe the w1-gpio module on boot. | |
104 | > | |
105 | > I have added: | |
106 | > | |
107 | > sudo modprobe w1-gpio | |
108 | > | |
109 | > To the etc/modules file, but on boot it is not loaded. | |
110 | > I have checked this by the lsmod command. If i then enter the above line manually and then check it's there loaded. | |
111 | > | |
112 | > What's wrong with my line on code in the modules file? | |
113 | > | |
114 | > Thanks | |
115 | ||
116 | You no longer need to load modules for some devices. It's handled by devicetree. | |
117 | ||
118 | Search for "devicetree" on the forum, or start here: | |
119 | https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=97314 | |
120 | #+END_QUOTE | |
121 | ||
122 | As of 2020-07-25, using Raspbian Buster 10 with a BerryGPS-IMU v3, | |
123 | ~/etc/modules~ did not need to be modified. | |
124 | ||
125 | ***** Remove DHCP client hooks | |
126 | As per [[https://www.slsmk.com/how-to-setup-a-gps-pps-ntp-time-server-on-raspberry-pi/][this]] guide, "remove ntp DHCP hook (so that it doesn't override ntp settings)". | |
127 | ||
128 | This can be performed by running the following command (shown in | |
129 | script form for readability): | |
130 | ||
131 | #+BEGIN_EXAMPLE | |
132 | if [ -f "/etc/dhcp/dhclient-exit-hooks.d/ntp" ]; then | |
133 | mv /etc/dhcp/dhclient-exit-hooks.d/ntp /etc/dhcp/dhclient-exit-hooks.d/xxxntp-orig; | |
134 | else | |
135 | echo "NTP exit hook does not exist"; | |
136 | fi; | |
137 | #+END_EXAMPLE | |
138 | ||
6bdc2473 SBS |
139 | *** Normal Startup |
140 | *** Normal Operation | |
141 | *** Normal Shutdown | |
142 | *** Unscheduled Shutdown | |
143 | ||
144 |