The GPS module I am using is a GT-U7 compatible met NEO-6M. The main chip is a U-blox 7 (UBX-G7020-KT).
Set hostname
/etc/hostname
Setup sudo
/etc/sudoers:
Defaults:%sudo env_keep += "SSH_AGENT_PID SSH_AUTH_SOCK"
Disable serial terminal
raspi-config
- 5. Interface
- P6. Serial
- Shell: no
- Port enabled: yes
Connect PINs
- VCC - 3v3 (1)
- GND - GND (6)
- RX -TX (8)
- TX - RX (10)
- PPS - GPIO 18 (12)
GPSd
Install GPSd
$ sudo apt install gpsd
Configure settings:
/etc/default/gpsd:
GPSD_OPTIONS="-n -G"
DEVICES="/dev/ttyAMA0 /dev/pps0"
USBAUTO="false"
Enable and start gpsd
sudo systemctl enable gpsd
sudo systemctl start gpsd
Check results with gpsmon and cgps
$ gpsmon $ cgps
Enable PPS
/boot/config.txt: dtoverlay=pps-gpio,gpiopin=18
/etc/modules-load.d/modules.conf:
pps-gpio
/etc/ntp/ntp.conf:
# GPS as source
server 127.127.28.0 minpoll 4 maxpoll 4
fudge 127.127.28.0 time1 0.127 stratum 2 refid GPS
server 127.127.28.2 minpoll 4 maxpoll 4 prefer
fudge 127.127.28.2 refid PPS
Monitoring with Telegraf
Telegraf monitoring (GPU access):
sudo usermod -a -G video telegraf
Telegraf sensors (CPU temp)
sudo apt install lm-sensors
/etc/telegraf/telegraf.conf
[global_tags]
[agent]
interval = "30s"
round_interval = true
metric_batch_size = 1000
metric_buffer_limit = 10000
collection_jitter = "0s"
flush_interval = "10s"
flush_jitter = "0s"
precision = "0s"
hostname = ""
omit_hostname = false
[[outputs.influxdb]]
urls = ["http://influx:8086"]
database = "telegraf"
username = "telegraf"
password = "ASDFASDFASDFASDFASDFASDF"
[[inputs.cpu]]
percpu = true
totalcpu = true
collect_cpu_time = false
report_active = false
core_tags = false
[[inputs.disk]]
ignore_fs = ["tmpfs", "devtmpfs", "devfs", "iso9660", "overlay", "aufs", "squashfs"]
[[inputs.diskio]]
[[inputs.kernel]]
[[inputs.mem]]
[[inputs.processes]]
[[inputs.swap]]
[[inputs.system]]
[[inputs.ntpq]]
options = "-p -n"
[[inputs.sensors]]
[inputs.sensors.tagdrop]
feature = ["in0"]
#[[inputs.temp]]
[[inputs.exec]]
commands = ["/usr/bin/vcgencmd measure_temp"]
name_override = "sensors"
data_format = "grok"
grok_patterns = ["%{NUMBER:temp_input:float}"]
# tag:feature = "temp_gpu"
[inputs.exec.tags]
feature = "temp_gpu"
GPSd socket enable remote access
# To allow gpsd remote access, start gpsd with the -G option and
# uncomment the next two lines:
ListenStream=[::]:2947
ListenStream=0.0.0.0:2947
Start gpsd after pps1 becomes available
/lib/systemd/system/gpsd.service Under [Service] add:
ExecStartPre=/usr/bin/test -c /dev/pps1
ExecStart=/usr/sbin/gpsd $GPSD_OPTIONS $OPTIONS $DEVICES
RestartSec=10s
Restart=on-failure
Influxdb monitoring of gpsd: as root:
# apt install python3-influxdb
# cd /opt
# git clone https://github.com/qistoph/gpsd-influx
# cd gpsd-influx
# cp gpsd-influx.service /etc/systemd/system
# systemctl daemon-reload
# systemctl enable gpsd-influx
# systemctl start gpsd-influx
I²C Display
- GND - GND
- VCC - 3V3
- SDA - SDA (3)
- SCL - SCL (5)
# apt install i2c-tools python3-luma.oled
Run ntp-gps-oled.py
Remaining
Note that for Raspbian I did need to include sudo scons udev-install, to install the systemd service.