GPS with Adafruit Ultimate GPS (breakout)

Antenna works when manually testing with gpsd. Logs show otherwise:
Nov 12 23:06:08 pwnagotchi pwnagotchi-launcher[2399]: [2019-11-12 23:06:08,642] [INFO] grid plugin loaded.
Nov 12 23:06:08 pwnagotchi pwnagotchi-launcher[2399]: [2019-11-12 23:06:08,744] [INFO] BT-TETHER: Sussessfully loaded …
Nov 12 23:06:08 pwnagotchi pwnagotchi-launcher[2399]: [2019-11-12 23:06:08,762] [INFO] [update] plugin loaded.
Nov 12 23:06:08 pwnagotchi pwnagotchi-launcher[2399]: [2019-11-12 23:06:08,767] [INFO] gps plugin loaded for /dev/ttyS0
Nov 12 23:06:08 pwnagotchi pwnagotchi-launcher[2399]: [2019-11-12 23:06:08,792] [WARNING] ui.fps is 0, the display will only update for major changes
Nov 12 23:06:08 pwnagotchi pwnagotchi-launcher[2399]: [2019-11-12 23:06:08,796] [INFO] initializing waveshare v2 display
Nov 12 23:06:12 pwnagotchi pwnagotchi-launcher[2399]: [2019-11-12 23:06:12,810] [INFO] [ai] loading /root/brain.json
Nov 12 23:06:12 pwnagotchi pwnagotchi-launcher[2399]: [2019-11-12 23:06:12,902] [INFO] [email protected][redacted] (v1.2.1)
Nov 12 23:06:13 pwnagotchi pwnagotchi-launcher[2399]: [2019-11-12 23:06:13,017] [INFO] web ui available at http://0.0.0.0:8080/
Nov 12 23:06:13 pwnagotchi pwnagotchi-launcher[2399]: [2019-11-12 23:06:13,744] [INFO] entering auto mode …
Nov 12 23:06:13 pwnagotchi pwnagotchi-launcher[2399]: [2019-11-12 23:06:13,767] [INFO] [ai] bootstrapping dependencies …
Nov 12 23:06:14 pwnagotchi pwnagotchi-launcher[2399]: [2019-11-12 23:06:14,626] [INFO] connecting to http://localhost:8081/api
Nov 12 23:06:16 pwnagotchi pwnagotchi-launcher[2399]: [2019-11-12 23:06:16,728] [INFO] found monitor interface: mon0
Nov 12 23:06:16 pwnagotchi pwnagotchi-launcher[2399]: [2019-11-12 23:06:16,744] [INFO] supported channels: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
Nov 12 23:06:16 pwnagotchi pwnagotchi-launcher[2399]: [2019-11-12 23:06:16,749] [INFO] handshakes will be collected inside /root/handshakes
Nov 12 23:06:19 pwnagotchi pwnagotchi-launcher[2399]: [2019-11-12 23:06:19,178] [INFO] [epoch 0] duration=00:00:06 slept_for=00:00:00 blind=0 inactive=1 active=0 peers=0 tot_bond=0.00 avg_bond=0.00 hops=0 missed=0 deauths=0 assocs=0 handshakes=0 cpu=16% mem=30% temperature=41C reward=-0.2
Nov 12 23:06:19 pwnagotchi pwnagotchi-launcher[2399]: [2019-11-12 23:06:19,225] [INFO] enabling gps bettercap’s module for /dev/ttyS0
Nov 12 23:06:19 pwnagotchi pwnagotchi-launcher[2399]: [2019-11-12 23:06:19,446] [INFO] error 400: module gps is not running

Any guidance would be appreciated

what are your bettercap logs?

[email protected]:/home/pi# grep bettercap /var/log/syslog | grep gps
Nov 13 00:22:45 pwnagotchi pwnagotchi-launcher[5208]: [2019-11-13 00:22:45,719] [INFO] enabling gps bettercap’s module for /dev/ttyS0
Nov 13 00:22:46 pwnagotchi bettercap-launcher[406]: [00:22:46] [sys.log] [war] gps error while reading serial port: read /dev/ttyS0: file already closed
Nov 13 00:22:46 pwnagotchi bettercap-launcher[406]: [00:22:46] [sys.log] [inf] gps started on port /dev/ttyS0 …

You can check that it is working by using screen to get the data from the GPS:

    screen /dev/ttyS0 

This should then spit out a load of data from the GPS, to leave the screen session you must kill the session by ctrl a followed by a capital K. If this doesnt work then somethign has not been setup right.

In which case, How is the GPS connected to your pi?

If you have it connected via USB with a serial to ttl adaptor as adafruit document here then the issue is that your config is set to look for the GPS at /dev/ttyS0 when it should be /dev/ttyUSB0 (or which ever USB tty port it has created).

However if you have it setup the other way by being directly connected to the Pi via UART then you first need to ensure that the serial port is enabled via sudo raspi-config, details can be found in the adafruit link above. Once done and rebooted you should be able to reach it. Just make sure you get the right serial interface. Re-run the screen command above and you should be able to see the data coming in.

EDIT

Something I have found with my crappy Bluetooth GPS is that I have to manually restart the pwnagotchi service to get the GPS to fully kick in after it has connected, this may just be a qwerk of using a cheap, old and crap bluetooth GPS unit though.

Apologies as I should have included more details on what hardware and methods I was using.
Adafruit GPS Breakout model is a serial device: https://www.adafruit.com/product/746

I have the GPS pins soldered directly onto the GPIO pins so no USB device/adapter is being used.

already used raspi-config to disable the login shell over serial but enable serial port hardware.

my go to for testing anything with UART is always screen due to its simplicity in defining parameters like baud rate. So we’re on the same page there.

after a lot of trial, error, and searching I found that @dave was encountering a similar problem due to the way waveshare was compiled. He provided an excellent and concise explanation of how to re-compile so the serial pins could be used again. Serial (UART) not working on GPIO 14 and GPIO 15

TL;DR It works now :slight_smile:

Thanks to both @battletux and @dave :slight_smile:

1 Like