GPS Module With Raspberry pi | How to Interface GPS Module with Raspberry pi

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello friends in today's video we will learn how we can connect a gps module with raspberry pi we will see the complete hardware designing of this project then we will see how to do the programming part so that we can easily access the gps data in raspberry pi then we will see how to monitor how to monitor whatever the gps data receive from the gps model to actual google map so that you can find your location on actual google map and after that we will see the programming part of this project so i request you please watch this complete video so that you will get idea about each and everything about the gps model and raspberry pi connection [Music] so before start the next part i request you please subscribe my channel currently you can see i have 1356 subscriber and my watch hour is 3888 so my uh to verify my channel on youtube i require 4 000 watch hour 1000 subscribers already completed thanks for your support but please watch my complete video so that this watch hour gets completed easily within one year so once you click on the subscribe button it is not only beneficial for me it is also beneficial for you because i have uploaded the more than 40 to 50 video on raspberry pi on arduino and all projects are very unique and and you will definitely learn from me so please subscribe my channel please watch my complete video thanks for the support so whenever you plan to start the hardware part make sure you have raspberry pi 3b or 4 you can use any raspberry pi in my project i have a raspberry pi 3 so whenever you buy raspberry pi for raspberry pi 4 or raspberry pi 3 you can see this pin is open and you can not able to find out the pin number of this raspberry pi so i will provide a basic idea behind this pin number so first pin that is the uh you can see this is the led and led side first pin it is nothing but the one number pin then second pin is this one then third and then four so all number 10 should be connected at this row uh this column or this column and even number pin at connected this column so it is very difficult at the run time you can find out the number so it is very easy you can take the one paper and you can draw this pin pin name as it is like i have did one two three four five six seven eight and plug this pin on this raspberry pi is so that you can easily find out the pin number of raspberry pi so now you can see i have placed my uh paper on the raspberry pi pin so you can see easily i can identify the pin number of raspberry pi and during hardware connection i can easily find out which pin is connected at which which point now second hardware is gsm uh gps model so this is the gps model you can see on the screen so this is the gps model you can see on the screen whenever you buy the gps you will get a antenna also with the gps you have to connect that antenna at this point by manually then after that on the gps module you can see there are four pins uh vcc rx tx and ground so we need to connect this four pin with raspberry pi pin so basically this gps model work on the five 5v power supply when you connect to the raspberry pi and if you want to connect this with arduino you can use a 3.3 volt power supply from the arduino but for the raspberry pi it's work on the fire 5v power supply so raspberry pi uh second number pin that is the this pin second number pin and this first pin is work as a five volt power supply and the six pin is work as a ground so we will connect second and six pin to vcc and ground respectively then after that eight number pin of raspberry pi work as a tx pin uh that should be connected to a gps model of rx pin and 10 number pin of a raspberry pi should be work as a rx pin and that should be connected to tx pin of gps model so you can see on the gps model we have the tx and rx pin also and this will be cross connection because uh when our gps model sends some data this will send to the tx pin and then tx pin raspberry pi should receive that data and raspberry pi only receive the data if the tx pin gets connected with the rx pin of raspberry pi so that's why it is cross connection so and some hardware part you require some jumper wire that is female 2 female jumper wire you can uh you can buy the jumper wire also from the amazon or flip card okay so after that first we connect the raspberry pi with the gps model so first point is you have to connect the vcc pin first so i am taking the vcc pin of the gps model you can see uh on the screen uh the vcc pin that is the first number pin is vcc pin and that should be connected to a five volt power supply of gps model that is a two second number pin of raspberry pi so vcc pin this i connected [Music] and this should be connected to second number pin of raspberry pi then after that uh next pin is rx pin so rx pin of gps model should be connected to tx pin of raspberry pi that is the 8 number pin of raspberry pi then after that you can see there is a tx pin of gps model and this tx pin should be connected to rx pin of raspberry pi that is the 10 number pin of raspberry pi then after that last pin is ground pin that that should be connected to ground pin of raspberry pi and it should be the six number pin of raspberry pi so connect this to six number pin okay so in this way the connection is completed it is very easy connection then after that you can plug your hdmi port then power supply the power supply should be 5 volts 2 ampere power adapter that is a mobile charger also you can use at this side then we will connect the usb to and to access the keyboard and mouse and yeah yeah this enough is a connection of gps model with raspberry pi now we will see the programming part of this project so before start the programming part make uh we have to install some library into raspberry pi to access the serial port of raspberry pi so how to install that library how to install the raspberry uh how to configure the raspberry pi for the serial communication we will see first now so uh first you have to download this nodes file not es node file from my world driving uh also the final gps code from my google drive link to access the gpa gps program and in node file uh once you open double click double click on this nodes file this node file will open and in this node file i will add added some steps to execute that is command that should be executed to configure the uh config or to configure the serial communication port in the raspberry pi module so in hardware part we will see that we have connected the 8 and 10 number pin as a rxtx or raspberry pi so how how i did know it is this is eight number pin or this is 10 number pin so basically if you want to see the pin diagram of raspberry pi connection of raspberry pi just go to the terminal window and here you have to type the gpio oridal command gpio read all and after that press enter so once you press enter you can see uh here 8 number pin and 10 number pin after the tx and rx pin you can see this one is 10 number pin and this one is eight number pin so that we have we have considered the eight and ten number pin as rxtx in the hardware part so this is the basic reason behind this uh number at 10 number pin after that to configure uh serial communication raspberry pi we have to change some file the file name is first is cmd line we have to change and config txt file we have to change and uh uh how to change that file i uh there is on already one uh article on the stack uh stack exchange uh this is the link for that article if you open that article you can see i have followed this six step uh please follow the six step i also follow the same step and with this step uh i easily able to configure the serial communication in raspberry pi so in video i will explain that step one by one uh each again so first steps you can see in the note i also configure uh i hotel that sudo raspberry pi config so basically this is used to enable the serial communication you can use the same command or you can copy this command just go to the terminal window and type here paste after that press enter so once you paste up press enter just go to the advanced interface option and once you go to the interface option uh go to the serial communication this one and after that click on yes button and click on okay and again go to the finish just select the tab once you press the tab and click on finish so uh it will ask the reboot system i will not do reboot because i already configure this area but in in your case if you configure the first time click on the yes button in my case i will click on no so in this way the serial communication enable if you want to check the serial is enabled or not just again go to the raspberry pi here and go to the preference then after that go to the configuration so once you go to the raspberry pi configuration go to the interface option and you can see serial communication is enabled if it is not enabled you cannot see in configuration it is disabled manually click on enable button on serial port and serial console and after that click on ok button in this way also you can enable the serial communication so this is the first step and after that uh after that first step go to the again terminal window copy the second comma sudo apt-get update first go go to the terminal window again and paste the command and press enter and once you press enter raspberry pi start updating i already updated so i will not execute this command now next command is raspberry pi upgrade so copy this comma again and go to the again the terminal window and uh control paste and press enter so once you press enter raspberry pi starts upgrading i don't go upgrade because it's already upgraded in my system so once you press enter it start agreeing and it will ask yes or no press enter press y in that case and it will take 15 to 20 minutes then after that after this command next command is sudo this one's copy so basically what this command will do it will create a duplicate copy or command line create a duplicate copy of config uh file a config backup file config sermon line backup file and config backup file in your boot folder so in case by mistake you change something in future or by mistake you change something config file and because of that your raspberry pi not start rebooting it will use some reboot errors then that time you can do one thing just remove your memory card take one memory card reader and attach this memory card into your laptop and delete this whatever the command line whatever you have changed and again uh use this backup file after rename this with command line and remove the bp so in this way you can create a backup file so this is the safest way because in my case uh two three times i have removed something and because of the raspberry pi not start working and now with this two lines it it save my raspberry pi os because i manually removed in command line by laptop and again recover my command line with this backup file you uh please focus here if you want to recover your backup file just remove bp and your command line should be this one only uh the file name this will be this one so whatever the file you have that should be delete and you should use this uh this file back often so basically we have created one backup file after that what you have to do you have to change uh add some uh this line into the config file so to open the config file just go to this sort of nano first you have to create the backup file with this soda copy before change anything in config backup file in command line file just create the backup press enter and it will create the backup file again execute the second command here copy this command go to the again terminal window and paste here and press enter so once you press enter it will create the backup file i already created the backup file now once you create execute this command till here next command is this one sudo config txt so copy this command just go to the again raspberry pi window or terminal window paste here so once you paste here you can see new file will be open and at the end of file just cursor down at the end of file you have to add this line i already already added so at the end of file you have to add this line you have to copy line from here from this node file copy and go to this file again and paste here so right click and paste so right click and paste will work here so this line should be add at the end you also see enable your should be is equal to one at your case this two line is very important if it's not there manually type this line or copy from here and this line will be created automatically when you configure the raspberry pi uh enable serial port through the configuration so this line should be there and this line should be there so okay you are added manually here then after that you have to do the control x so once you press ctrl x it will ask save and then uh it will save your data so i will show you once again uh open this file just for your information again uh what i will do i will change some file here is remove and again t i have added then ctrl x then it will ask me for the save then click on yes button yes and then after that press enter so once you press enter again check that file that this line is added or not at the end so how to check again open that file and once you open you can see this line is added here so in this way you can update your file so next file is you have to configure your to [Music] reboot your system so how to reboot system copy this comma copy this sudo reboot go to again the terminal window and after that uh once you go to the terminal window then after that then after right click paste press enter so once you press enter it start rebooting your system again i already rebooted so i don't uh don't uh i will not do same okay once you configure once you added this line uh disable uh disable bt into the config file by uh using this command next time you have to reboot the system by using this line now after this one you have to change uh cmd line dot txt file so what you have to change you have to remove console serial zero zero line uh from the command line so how to remove just open this command line you can see i have open this command line by using this command press enter so once you press enter at your side after this enable zero you will find this one console serial zero or console t my zero so till all the all till all in the file if you find these two lines just remove uh this syntax completely from the command line so this is the way to do so what i have remove i will show you from my backup file so this is my backup file so i will open the backup file so [Music] this is my this is my current file that i am using and this is my backup file [Music] so you can see after enable 0 there is serial 0 in my backup file uh this one console serial 0 so i have removed that completely remove console 0 from my main file so after that you will get this file so you have to do same thing in your command line and then and then only your serial will start and after you remove just save the file by ctrl x y enter and after that what you have to do copy this reboot command again go to the terminal window and paste and press enter so once you press enter serial will be execute or serial communication will start in your raspberry pi code so this is the complete uh complete uh syntax or complete command you have to follow if you want to execute the file if you want to understand the article just read this article so for your reference i have given my command line and config file in the google drive link so whenever you've done your changes just compare with my config file in command line with your config file and command line so your config file and command line present inside this one slash then boot and here you can find your command line and the config file and my config file and command line will be present here command and config file so you can compare this to file with your file so that you will get idea about what i have changed so okay once you configure the serial port in raspberry pi next uh next library you have to install this pi uh pi nmea2 so basically this library used for to capture the latitude and longitude from the gps so how to install this library just copy this library then go to again the serial terminal and type here sudo pipe 3 install and that library control paste then after that press enter so once you press enter this library start installing in your raspberry pi so once it install it will give the successful message so this this is again the second most important library you required to install in your raspberry pi i will copy this command because a requirement already satisfied it it is giving this message because that library already installed in my raspberry pi so i will copy this command again and add in the node file [Music] so in this way you can update this library now we will say the importance of each and every line from the code how to open the code it is very easy just download my code final gps dot phi and double click on this code so once you double click on this code this will open in tony browser so you have to uh you have to open this in same browser now we will see the importance of each and every line from the code so first line is import serial basically if you want to access the serial port in raspberry pi require this library then time if there is any delay in your code then you require this time library then import string so basically whatever the data coming from the gps to the raspberry pi it is in uh byte format to convert that byte into string you require this library then uh input pi nm ea2 so basically this library used to capture the latitude and longitude from your whatever the gps data uh so that so lat long will be calculated by using this library then while true so basically whatever the code inside this white row it will execute infinite number of time so first line is serial dot serial then port name we will use this port name of raspberry pi it is serial port name number name then boarded it nine c double zero and timeout is one so this is the basic setting when you access the raspberry pi serial communication then or to accept the various serial uh serial function we require this variable so to create that variable we will use this line then after that they are data out pi num nm reader so basically it is it is a package and we will use data out it is nothing but the you can see whatever the data reading from the gps it will collect here and this will read out then after that it will transfer to the serial pin and how to read the data from the serial kit by using this line serial.readline and whatever the data coming from the gps store into the new data then after that all the gps signal having the different types of data so and whatever the latitude and longitude data coming in the gp rmc screen so whatever the 100 line of code whatever the hundred line of data uh we have to we have to serve the gp rms rmc stream so how to search that string if common we will use if jprmc that is the it it is string found inside this new data or not new data means whatever the data received from the gps so yes if it's frowned then or we i will i will tell you the importance of this line when we execute the real time hardware uh however that point in the next chapter so then after that next line is pi nm so whatever the data coming from that whatever gps code whatever the select combination that should be decoded into latitude and longitude so for that we require this variable and with that new message dot latitude is given the latitude number new measure dot longitude it will give longitude number you will store into two variable and we have we are just printing that one so very important line from this project is this one print this nmd code so what is use of this line i will tell you so whenever the data capture from the gps model that gps module having the thousand number of data and the thousand number of data the gprm string now whatever the data starting from the gprs team it actually related to longer data and to find out your exact location through the google google map we will use the gprm string and how to find out that string by using this line so whatever the data we will print use by using this line we will copy that data and paste into one website that website is nothing but this one encoded men decoded website so in this dex website i will open that one it is very important website so for example i can show you one when we run the gps model at this line we will receive this kind of data gp rmc like this data so whatever data you receive you have to copy that data from this sony browser from here i will show you later how to copy that one and after that you have to paste that line here so you can see this already the data some icon figure and paste here uh so once you con get the data you have to paste here i will show you later also so this data should be like this line jp rmc and some data so it will give you some idea and it will decode this line and this line contains the latitude longitude with your timestamp with your date also so for that reason we have used this this line to decode the data in python program and here we are decoding data by using the web page so this line is basically used for decoding the data and then we will get latitude and longitude and we are printing so later we will see this part in actual practical demonstration and here you can find then your actual location so this is the complete idea behind this code behind this project now in the next in the five minutes we will see the actual data and we will check the actual connection actual actual position of my location using this website so you can see raspberry pi is connected with the gps model also i have connected the antenna to gps model so basically this gps module having this led and this is not a power led it is a power status led it is actually signal led so once you give the power to from raspberry pi to gps model then this led will not blink uh it will wait for the signal from this antenna so once the antenna track the satellite then and then only this led will start glowing so in case if you have new gps model then it will take more than 15 to 20 minutes to capture the signal and signal only capture uh at outdoor only not indoor so make sure your gps mode and raspberry pi setup must be outdoor or on terrace or something out of home so this is the idea behind the gps so i am waiting for for the signal capture by this antenna so that this led start blinking so once the led starts blink uh we will i will show you how this antenna will capture the signal so you can see now once uh mayan so you can see once my antenna got the range from the satellite the red led start blinking now you can see here now you can see here the led start blinking that means antenna got the range so now we will connect our monitor to raspberry pi to see the actual latitude and longitude now i have connected my the monitor you can see i have connected my monitor to my raspberry pi through hdmi port and also there is a keyboard and mouse also connected now i can see range also uh taken by the gps antenna so i will run my code now so first of all so first of all you have to download my this final gps code from my google drive link and double click on this code so once you double click on this code this code will be open and if you want to run the program just click on this run button so once you click on this run button you can see latitude and longitude also there and one string is there so what is important of that thing i will show you i will stop the code now now in the so after we run our code you will find these two uh output latitude and longitude what is a this is the current location and this one string it is printing from this line print new data so what is important of this thing i will show you so in programming explanation i i already told you this is one website in which you can find your current location just go to that website [Music] so once you go to that this website uh here you are that website asking for this string so this string you have to pass so i already copied that string uh what is my current location and the current date so i will copy this one and you can see once i go to here and paste that string and press enter decode so you can see current location is shivaji nagar and current data also 8 april 2022 so this is the current location and time and the location also you can find here this is my current location in pune so it is giving the actual data actual location of my home so this is the important of this line uh this is the important of uh this line and this is the attitude longitude so in this way we successfully complete the gps model with raspberry pi
Info
Channel: Rahul Jadhav
Views: 7,640
Rating: undefined out of 5
Keywords: gps module raspberry pi, location tracking using python, location tracking google maps, gps module, gps module with arduino, gps module working, gps module not blinking, gps module not working, gps module in proteus, gps module interfacing with arduino, interface GPS module with raspberry pi, gps neo 6m interfacing with raspberry pi, gps neo 6m module, gps neo 6m not working, gps raspberry pi, gps raspberry pi 4, gps raspberry pi zero, gps tracker raspberry pi
Id: OWP3D-51vIc
Channel Id: undefined
Length: 27min 26sec (1646 seconds)
Published: Fri Apr 08 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.