4G Expansion GPS for Wardriving

I wanted to see if I could use the SIM module on the expansion board as a GPS peripheral for wardriving and avoid having to solder a 3rd party GPS module to the uconsole USB pins. It took some digging and I didn’t find any consolidated steps but just bits and pieces. I am writing this so anyone else trying to do this will have everything they need in one place.

These steps are just to get your 4G expansion working with gpsd. Ideally you should then be able to get gpsd working with something like Kismet, but that is a personal preference kind of thing.

  1. Install your dependencies
    • sudo apt install minicom gpsd gpsd-clients modemmanager -y
  2. Create a service to enable the 4G and activate GPS
    • sudo nano /etc/systemd/system/uconsole-sim.service
[Unit]
Description=Enable SIM Module and Activate GPS at Boot
After=network.target

[Service]
ExecStart=/usr/local/bin/setup-sim-gps
Restart=on-failure

[Install]
WantedBy=multi-user.target
  1. Create the startup script the service will execute
    • sudo nano /usr/local/bin/setup-sim-gps
#!/bin/bash
# Power on the SIM module
/usr/local/bin/uconsole-4g-cm4 enable

# Wait for the SIM module to initialize
sleep 5

# Activate GPS via AT commands
echo -e "AT+CGPS=1,1\r" > /dev/ttyUSB2
sleep 1
echo -e "AT+CGPSINFO\r" > /dev/ttyUSB2
  • chmod +x /usr/local/bin/setup-sim-gps
  1. Configure gpsd
    • sudo nano /etc/default/gpsd
# Devices gpsd should collect to at boot time.
# They need to be read/writeable, either by user gpsd or the group dialout.
DEVICES="/dev/ttyUSB1" #Yes I know it says /dev/ttyUSB1

# Other options you want to pass to gpsd
GPSD_OPTIONS="-n"

# Automatically hot add/remove USB GPS devices via gpsdctl
USBAUTO="true"
  1. Enable the new service

    • sudo systemctl enable uconsole-sim
  2. Enable the gpsd service

    • sudo systemctl enable gpsd
  3. Disable login over Serial, enable Serial hardware using raspi-config interfacing options, finish, and reboot

  4. Once the uconsole has rebooted, stand somewhere you’re likely to receive a GPS fix and run the following command to ensure you are able to stream GPS data properly

    • gpsmon

Be aware this will make it so the 4G modem and GPS are automatically enabled at boot which means they will be consuming power. If you don’t want this to happen, don’t run step 5.

7 Likes