Table of Contents
Set up device and network connection
-
Flash Raspberry Pi OS on SD card
- Download light image from the official site of Raspberry Pi Foundation
- Use
sudo dd if=<path-to-image> of=/dev/<SD-card-device>
-
Enable SSH
- Make directory to mount SD card to with
sudo mkdir /mnt/sdcard
- Mount device with
sudo mount /dev/<SD-card-device>p1 /mnt/sdcard
- Do
cd /mnt/sdcard
then make file "ssh" withsudo touch ssh
- Make directory to mount SD card to with
-
Insert the SD card and power on Raspberry Pi
-
Connect Raspberry Pi using network cable
-
Find and connect to the device using PC terminal
- Use
nmap -sn <network-ip>/<network-bits>
and copy the IP that corresponds to the MAC address of a "Raspberry Pi Foundation" device - Connect to the device using
ssh pi@<device-IP>
- Use
-
Do basic setup
- Login as pi, enter password
raspberry
- Do
sudo passwd
to change the password for user pi - Do
echo '<hostname>' > sudo tee /etc/hostname
to change hostname
- Login as pi, enter password
-
Connect to WiFi hotspot
- Do
rfkill unblock wlan
to unblock wlan -
Edit the files below using vi or nano
/etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 country=DE # Example network configuration network={ ssid="example-SSID" psk="example-password" } # Add any additional networks
/etc/dhcpcd.conf
# Add these lines to the bottom of the file interface wlan0 arping <router-ip-1> arping <router-ip-n> profile <router-ip-1> static ip_address=<static-ip>/<host-bits> static routers=<router-ip> # Typically .1 static domain_name_servers=<DNS1>,<DNS2> profile <router-ip-n> # Repeat for any additional networks
- Do
-
Reboot the device using
sudo reboot
and remove network cable- Repeat step 1.5 using WiFi hotspot network address
- In case of major interference, do
echo sudo iwconfig wlan0 power off >> ~/.bash_profile
to disable power savings for interface wlan0
Enabling GPS hardware
-
Enable the serial interface and connect the GPS module
-
Edit the files below using vi or nano
/boot/config.txt
# Add these lines to the bottom of the file dtparam=spi=on dtoverlay=pi3-disable-bt core_freq=250 enable_uart=1 force_turbo=1
/boot/cmdline.txt
dwc_otg.lpm_enable=0 <all existing args> plymouth.ignore-serial-consoles
-
In order to disable console login for serial ports, enter
sudo systemctl mask serial-getty@ttyAMA0
- By default, Raspberry Pi echoes data back to the device. To reduce the noise, do
echo '/bin/stty -F /dev/ttyAMA0 -echo' >> ~/.bash_profile
- Shut down using
sudo shutdown now
, wait for the green light to blink a few times and disconnect from power after the long glow - Connect the GPS module — connect VCC to Pin 1 (+3.3V), GND to Pin 6 (GND), TXD to Pin 10 (RXD) and (optionally) RXD to Pin 8 (TXD)
-
-
Testing operation
- Connect Raspberry Pi to power
- Execute
cat /dev/ttyAMA0
— if it displays serial data, it's working - Wait until $GNGGA supplies data — if comma-separated fields are not empty/the indication LED starts blinking, a location is captured
Using GPS data
-
Capture and save data
- Start a screen session using
screen
, then entercat /dev/ttyAMA0 > nmea_data
- Detach from session using Ctrl+A then d
- Exit the shell and gather data remotely
- When you want to end the capture, reconnect to device SSH
- Find running screen sessions using
screen -ls
- Reattach to the existing one using
screen -r <session>
, then kill using Ctrl+A, k then y to confirm - Exit remote shell, copy data from device using
scp pi@<device-IP>:/home/pi/nmea_data .
- Install
gpsbabel
, convert the file to gpx usinggpsbabel -i nmea -f nmea_data -o gpx -F nmea_data.gpx
- Start a screen session using
-
Display data
- Have QGIS installed on main PC
- Download a QML style set compatible with Geofabrik shapefile extracts such as mkoenigb's OSM Geofabrik Universal QML Style and extract it
- Download a OSM shapefile extract from Geofabrik and extract it to the
Geofabrikdata
subdirectory of the previous extraction - Open the
ExampleProject.qgs
file using QGIS - Do Ctrl+Shift+V or
Layer
>Add Layer
>Add Vector Layer
, specify location ofnmea_data.gpx
in Vector Dataset(s) >Add
Capturing and displaying live GPS data
-
Set up
gpsd
- Install
gpsd
on Raspberry Pi -
Edit the configuration and socket file
/etc/default/gpsd
# Find this line and add ttyAMA0 path DEVICES="/dev/ttyAMA0"
/lib/systemd/system/gpsd.socket
[Socket] # Enables listening to LAN ListenStream= ListenStream=/var/run/gpsd.sock ListenStream=2947 SocketMode=0600
-
Reload services using
sudo systemctl daemon-reload
, then enable service usingsudo systemctl enable gpsd
and start usingsudo systemctl start gpsd
- Install
-
Display data in QGIS
- In QGIS, in the existing project, create a new layer using
Layer
>Create Layer
>New Temporary Scratch Layer
> selectPoint
in Geometry type - Show the GPS Information panel using
View
>Panels
>GPS Information
- In the Options pane, select gpsd under Connection and fill in the required data
- Under Track, enable
Automatically add points
- Let it gather data. When you want to end tracking, click the
Toggle Editing
button and confirm saving the changes done to the layer
- In QGIS, in the existing project, create a new layer using
Sources
https://www.xarg.org/2016/06/neo6mv2-gps-module-with-raspberry-pi/
https://sparklers-the-makers.github.io/blog/robotics/use-neo-6m-module-with-raspberry-pi/
https://raspberrypi.stackexchange.com/questions/88916/getting-nmea-unknown-msg58-and-other-garbage-from-my-neo-6m-0-001-gps-module/104296#104296
https://www.youtube.com/watch?v=BlkMQwvpOJE
Comments
There are no comments yet.