0

$USD

$USD
PROJECTS Raspberry Pi

Using Raspberry Pi with a GPS Module

DFRobot Nov 08 2017 2112

After my brainstorming session ended today, I was doing some testing with a GPS and I thought, why don’t I send all my on the forum? So at night when I started to drink green tea, listening to music with the air conditioning blowing a breeze, I felt good and creative…
So let me tell you why I was writing about the GPS module. I was browsing the forum to check Lisper codes that can take GPS data and show on a screen; so I did not write a tutorial but I shared my notes over here which are just as good.

 
The equipment needed for this project:

 


A lot of people will ask; What is Raspberry Pi and why did you choose it? Well a quick summary is you can Google the Raspberry Pi and I chose it because it is much easier to work on Linux with the GPS module!
 


Below is a simple Tutorial
First, a look at how a GPS sensor looks like


Its very small, isn’t it? I thought so too, and connecting this to Raspberry Pi is easy with the antenna for better signals.


The antenna looks like this, but you don’t have to take it with you all the time. Just leave the receiver outside to catch the signals and keep the wire inside with the GPS module!

 


The assembly is very simple, basically tighten the screws, and plug into the USB port.
But before we start, you need to configure your Raspberry Pi with the latest firmware and Pi OS from http://www.raspberrypi.org/ and copy that image on the SD card to boot up your board. Please Baidu/Google for more info on how to do that.  
When It is done, you can power your RP.
Oh but I almost forgot to show how to connect the power module for the RP. Its very simple, check in the picture below


The connections are important, but more important is how you configure the setup.
 
I googled all the steps that you must take to set up a GPS module, and I found out that there are so many! But I will share all the essential ones with you. You have to know what the key to the whole operation is. Under normal circumstances, the GPS is working with a serial port, which is connected to the USB and just reading data. So its not that hard.

On the system can even receive the data directly through the following command:sudo cat  /dev/ttyUSB0
First,  I turned on to the Linux SUPER APE program.

Danger ahead! Please prepare for some high level programming, but don’t worry I will provide all the codes!
1. I want to update my system, install GPSD services and gpsd-clients client components, and python-gps modules. Finish it with a command:sudo apt-get update && sudo apt-get -y install gpsd gpsd-clients python-gps


2. Restart the Raspberry and then log in, and implement the following configuration to manage gpsd service. If you are a genius, you can directly edit the configuration file, I will think highly of you by this!sudo dpkg-reconfigure gpsd


 


3. To start the gpsd daemon, you have to do the following:sudo gpsd / dev / ttyUSB0 -F /var/run/gpsd.sock
In fact, before using lsusb look  to see that the GPS is identified as a device on the Raspberry Pi. The GPS device that my Raspberry Pi has identified here is shown in the system as: / dev / ttyUSB0


4. If you need to stop gpsd service, you can use super killer to kill it in any emergency:sudo killall gpsd
As I mentioned earlier, if you are a technical or coding expert, you can easily use the vim.tiny editor to edit configuration files, you can edit /etc/default/gpsd, to the following configuration:
Then through the systemctl management process you can startup and shutdown, its much easier that way.
Enable GPSD services:sudo systemctl enable gpsd.sock
Stop gpsd servicesudo systemctl stop gpsd.sock
Disable gpsd service being automatically loaded at boot:sudo systemctl disable gpsd.sock
Then you have try to get GPS information. For this, you can use the cgps -s command:sudo cgps –s
Then you will see the following figure:


 

Time Stamp:
Then use latitude, Longitude, altitude.
The status, this information is the data we need.


PS:
Latitude: latitude
Longitude: Longitude
Altitude: altitude
speed: speed
Heading: heading?


That Status If 3D Fix shows that the 3D positioning is successful (as if to say it, the specific GPS terms is limited but you can find more in the link below to download it.)

http://www.dfrobot.com.cn/community/forum.php?mod=attachment&aid=MjkyOTN8ZTIxN2NkM2F8MTUwOTYxNTk3MnwwfDE1ODAw
 
The following is a simpler method of operation, but it also has its drawbacks.
Of course, cgps command has helped us to get the data typesetting, in fact, if you want to read the data directly with sudo cat / dev / ttyUSB0 can also get:


 

You can use awk, grep and other commands to perform filtering and output, and then get the results you want.
Here is my 7-inch screen with the Raspberry Pi on the steering wheel:


If you add Google earth,  with the interface it looks even better than that, but I will not.
So this is how to make GPS data look good on an interface. In fact,  there is not really any technical difficulty, we quickly can get done with our own GPS positioning system! Get making!