How Add GPS to the Raspberry Pi

You need to connect a serial GPS module to a portable Raspberry Pi and access the informationutilizing Python.  Today I show you how to How Adding GPS to the Raspberry Pi.

Components Required :

1.Raspberry pi

2.Breadboard

3. Connecting wire

5.Adafruit Ultimate GPS Breakout

The breakout is built around the MTK3339 chipset, a no-nonsense, high-quality GPS module that can track up to 22 satellites on 66 channels, has an excellent high-sensitivity receiver (-165 dBm tracking!), and a built-in antenna. It can do up to 10 location updates a second for high speed, high sensitivity logging, or tracking. Power usage is incredibly low, only 20 mA during navigation More information Visit   https://www.adafruit.com/product/746

This book will help you to gain more knowledge of Raspberry pi  Software and Hardware Problems and Solutions

Raspberry Pi Cookbook

Circuit diagram :

[caption id="attachment_641" align="alignnone" width="228"]Wiring a GPS to a Raspberry Pi Wiring a GPS to a Raspberry Pi[/caption]

A 3.3V serial GPS module can be connected directly to Raspberry Pi’s RXD connection.   shows how the module is wired. The RXD of the Raspberry Pi connects to Tx of the GPS module. The as it were other connections are for GND and 5V, so we are able to effectively just utilize three female-to-female headers.

Now you have yo need install some package

$ sudo apt-get install gpsd
$ sudo apt-get install gpsd-clients

The most important of these is gpsd. This is often a tool that reads GPS information from a serial or USB connection as well as other sources and makes it available for client programs to utilize by giving a nearby web service on port 2748. To begin the gpsd service running, issue the following command:

sudo gpsd /dev/ttyAMA0
cgps -s

Code:

from gps import *
session = gps()
session.stream(WATCH_ENABLE|WATCH_NEWSTYLE)
while True:
     report = session.next()
     if report.keys()[0] == 'epx' :
     lat = float(report['lat'])
     lon = float(report['lon'])
     print("lat=%f\tlon=%f\ttime=%s" % (lat, lon, report['time']))
     time.sleep(0.5

Run the program, and you should see some Look  like this:
lat=24.3745 lon=88.6042 time=2020-06-018T08:06:24.960Z
lat=24.3745 lon= 88.6042 time=2020-06-018T08:06:25.960Z

If you want to know more about raspberry pi then click on the link below

RASPBERRY PI TUTORIALS FOR BEGINNERS

 

No comments

Theme images by Dizzo. Powered by Blogger.