Get Informed out of Data

Full width home advertisement



Post Page Advertisement [Top]

Interfacing GPS and Raspberry Pi - How to use it for Tracking

Interfacing GPS and Raspberry Pi - How to use it for Tracking
Global Positioning System(GPS) has already become a vital factor into security systems and also work management.

From Vehicles to Factory Automation tracking the events will provide a strong case of data to make better decisions with respect to time.

Here, we are going to use Raspberry pi, Jio Fi(SIM based Modem) and Neo 6m GPS module,

Reasons for choosing Raspberry Pi - can support multiple hardwares and also can be used as a hosting server to show data.

Generally, people don't just like to track but also make decisions like actuating new hardwares.

For example, If a vehicle runs over 80 kmph we can give alert to the driver, more than that the owner of the vehicle will be sure of what their employee trying to do with the vehicle.

Raspberry Pi can be any version,

With Raspberry pi installed with raspbian and also connected to the jio fi wifi.

lets make it ready for GPS module connection.

Pin1 = 5V = VCC - GPS
Pin6 =GND - GPS
Pin8 =RX- GPS(GPIO14)

Now, coming to the raspberry pi configurations,
we need to edit the /boot/config.txt file, open the file either on your desktop computer or using the Raspberry Pi via SSH

sudo nano /boot/config.txt

Add the following lines in the last


use Ctrl+X and then press Y to save and exit

Now edit /boot/cmdline.txt.

sudo nano /boot/cmdline.txt

Change the file to the following:

dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait

Exit and save the changes

To disable the built in bluetooth we need to stop hciattach trying to use the modem via uart0 which will disable the relevant systemd service

sudo systemctl disable hciuart

Now edit /lib/systemd/system/hciuart.server and replace ttyAMA0 with ttyS0 .

sudo nano /lib/systemd/system/hciuart.service

Replace "After=dev-serial1.device" with "After=dev-ttyS0.device"

Exit and save the changes.

Update the operating system with the latest patches with:

sudo apt-get update
sudo apt-get upgrade
sudo reboot

Now, on rebooting

type the following command to see the raw values from GPS

sudo cat /dev/ttyS0

with these values - we make sure the configurations are working perfect.

Now, its time for NMEA- standard conversion of these values into information.

Install GPSD

You can always just read that raw data, but its much nicer if you can have some Linux software prettify it. We'll try out gpsd which is a GPS-handling Daemon (background-helper)

To install gpsd, run the following commands from the console: 

 sudo apt-get install gpsd gpsd-clients python-gps 

Raspbian Jessie systemd service fix

Now lets disbale the service to run at our usage,

 sudo systemctl stop gpsd.socket
 sudo systemctl disable gpsd.socket

GPSD needs to be started up, using the following command: 

 sudo gpsd /dev/ttyS0 -F /var/run/gpsd.sock

Now GPS doesn’t work indoors – as it needs a clear view of the sky so for this I’ve placed the PI on the window sill. Next I ssh into the pi and run cgps. There is a simple GPS client which you can run to test everything is working: 

 cgps -s 

The -s flag is there to tell the command not to write raw data to the screen as well as the processed data. 

For further experimentations like google map tracking,

No comments:

Post a Comment

Bottom Ad [Post Page]