How to use Neo 6M GPS module with Raspberry Pi and Python

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone in this video we are going to see how to use a neo 6m gps sensor with any update - berry pie so you will use as it by three and recipe by zero and also we will see how to write a simple Python code to process the GPS data so let's get started so let's let's talk about the hardware part so here I have an SVD pi C V Plus also you can use raspberry pi 0 and a new 6m GPS module and if you jump far west okay so let's let's talk about the new system sensor so as you can see there here is the VCC pin here is our explained exp Nanji indepen so we need to connect the VCC with the five holes of raspberry pi PX with the RX of raspberry pi because it will transmit the data and as if I receive the data and G into the genu it as verified now we don't need to connect the RX of this module because this module is not going to achieve anything also one thing to mention here is a blue LED light actually so after powering it up is the blue light will blink when it will receive the data so before writing any code make sure that the blue light is blinking okay so here I am just going to connect the jumper words so I am going to connect today the one with the VCC black coin with ground and this orange with the TX so as you can see I have factored t where's VCC TX and gene so now let's talk about the raspberry pi so in both pi 0 and PI 3 here it is the five poles this one also 5 volts the third one is ground the fourth one is TX and the fifth one is rx okay so we don't need the TX one because our as 3 PI is not user class mean anything to de module so here just connect the jumper where's so as you can see I have connected the PCC of the module to the 5 volts the ground of the module to the ground and TX of the module 2 dot X of length 3 5 so this is the connection in case of Raspberry Pi and here you can see in the GPS module okay so this is all about connection and here you can see the gear diagram of the connection now let us talk about the software one so basically before you do anything we need to connect to it as verify so to do so there are several ways basically so you can just connect usb deep eye-to-eye HDMI cable in that case you will get a screen like this here I'm using VNC viewer but if you just on cable you will also get a same screen so if you are using a diet HDMI cable you both here and open the terminal and now here you can just write all the codes and turn so I am going to use or if you doesn't have a hdmi cable in that is you can use putti so if you are using booty you just open it and here you write raspberry pi dot local and here for 22 so as we fight at local and for 22 and open and you will get a prompt like login s the default username is PI and the password is raspberry now I am only logged in here so here I am going to use booty for the whole demonstration but obviously you can use HDMI to in that is the process is almost same so let's start it so before we get the data from the GPS sensor we need to set up few things so first thing we need to do is we need to sudo nano boom and then figure out HD we need to edit this file now if you open this it's a very large file so you go at the end of the file and here as you can see so here we have few lines so I am NOT going to write this back so I just copy it from here so basically this is our website and I will just put the link in the description you go there and here everything is second and you just copy the code from here so that you don't need to write it and then just paste it at the end of the file so just write leaving the mouse if you're using booty and it will be wasted so just basically and influence control X then why and presenter and now it's it now the second thing is there's also another problem which is raspbian OS basically uses the UA ID as serial console so we need to turn on that functionality so so that we can use our GPS sensor okay so now to do so we need to change up file all CMD line but txd now before changing CMD line dot txt we should make a backup of it for just safety purposes so just write sudo CP mu and CMD line or HD and this is the name of the original file and now we will make at CMD line back or back up so this is our original file which is boot CML and txt and we'll make name the CMB line the upper case T okay so that even a thing goes wrong we can back to this so press ENTER and it will be done now we can edit this and then just this one and yeah basically so here this is the part pencil is equal to c dl 0 1 1 5 to 0 so you just what you can do you can just remove this part and save this file or what you can do in just remove everything from this file so I'm going to do this so here I am just removing everything so I have the file and site and from there you will get the power here you just copy the code from here and from here and paste it okay so now done now control X Y and enter now this step is also done now we are ready to test our GPA sensor so before testing this out make sure that your the blue LED in the GPS sensor is blinking because the blinking opportunity basically means that our GPS sensor is receiving data ok so make sure w it is blinking we Cho this we need to it was okay except that it is not going to work so this slips reboot and it will take few seconds to reboot this okay so just wait for few seconds and then just login again so as we fight on local 420 to open it and login with the same credentials and we are now we are ready to check our GPS sensor so to do so you just write sudo get x ET y a m0 so here the name of the port is actually TT yaa means zero and you click and you will get this data Alonso bed and so you pest control will see to stop this and now just look into a data so there are several tanks here GP everything is start with GP and there are several texts so if we use as a GP z GL we are basically bordered with this step so actually transistor land is your longitude so as you can see this is the data it is a raw data we need to get the format it takes actually if you want to know the meaning of this text you can go to this side okay and here you will get all that it is like GP GTL research it's basically means geo graphic position let you belong each okay so we are going to use EPG here so what we will do in Python will just get the CDL data then find the GG GP g GL line and then we parse the data okay so we have a library in Python using which will guard is so don't worry so now we know our sensor is working properly now we can write the Python code so before we write the python code we need to change another key in chile which is basically a sweetie pie uses a serial console log in so if we want to use the serial code to get a GPS data so we need to disable the console log so if you don't we just need to use view command so just LS in depth and you will get a long list here find serial 0 and serial 1 so serial 0 and C BL 1 as you can see so they are the reports and always remember city will support which is connected to the GPA of 14 and 15 so basically the pores where the TX and rx is so we need to use serial zero but as you can see cos 0 is entity to I am a zero so we need to disable this one okay so there are a few cases where icd-10 is connected with TTY is 0 in d SB 5 to 5 milli but in is V by C serials you find it follows connected with TTY a and n 0 so we need to visible e 2 I am in 0 now disabilities we have to use two commands now determines copying the commands they are quite long I think as you can see these two commands so I'm not writing it to save the time and systemctl stop CDL e and here is tty AME 0 so we are disabling this chip stopping the service so press ENTER and it will be done now another we have to let thing which is you just pop it sorry pop it is one or two poppy and like this so you just copy the previous line here and then uses instead of small you write disabled sorry this turn now we are ready to write ok so make sure that you have executed these two commands it's except that it's not going to work so let's try the Python code and I'm just going to write it in notepad so that you can see it is and just open notepad and Here I am just going to explaining the food so again I'm spying on you to save the time and testing it really so this is a very small correction now ok here one library is needed which is by in in EA too so make sure you have installed it so please install pi in m82 and it takes some time so when it is installing less yes let's say let me explain the port so at the first line I am this import in Syria - so that we can get the serial data we are importing time you are importing string because we need to process two strings and finally we need to import in PI in MPA - so PI in an A - is a basically a person library in Python you're using which we are generally first a Mindy a data so I am NOT going to explain you what in any eight steps up but basically you supers okay so fine and here we are just making I infinite - so that it would it will just shows GPUs data until which is the program now we are defining the Port St Apt I am a CEO and as you can see it see - I am a zero and in our last command we have just disable that okay so that's why we have to disable that because we are going to use that in our program okay now we are making a serial object using the CLO serial we are defining the ports at this one T - am a zero what it is nine six zero zero and in my case and given the time of 0.5 but you can give it as you need okay so and then we have a detailed object basically a fine enemy to enemy a streamer stream leader object so stream leader basically means that if you just go to our console these are the data these are the screen data basically so in any area will leave the streams of the data okay that's why we need to make object of that one because we need to we are going to read all this data now we have made this object and finally we are reading the serial read so serial basically means that it will lead lines from the serial connection so basically it will read each of the lines one by one and after reaching the line we will see that if the first five characters are GP okay I am Busey PRMC but you can G B G 0 that's what we do so we are going to use GP g GL GP g ll i think GG g p GL so and as you can see your GP g ll yes yoga we can position so we are going to GP g ll and we are checking if the new data is GP g ll so what like as you can see the first five zero two six Oh bye thunders in includes equal to five so zero one two three four five so when the line starts EGP gll then we are going to posit eight so basically we are having each of the lines then we are checking if the first five characters a GP gll then we are going to purge this line now how they are going to persist we are just taking a new variable new message and here we are passing it to by any near to the first function and then from that new message we can easily get the letter U along with you attribute okay and we are saving this in latitude and local in Latin islands so now in Latin LNG we have the latitude and longitude data so they are generally plot data so while printing actually i'm concatenating it so that it looks good like I am GPA latitude is equal to I'm just doing this so that it looks good okay and there so I am converting the load travels into inter string so that it concatenate and finally I am printing it okay so it's quite easy now just copy it and come here and make a new file GPS dot fine and two because today as we buy generally comes default with Python but easily parallel in Python G so saving it and now with Python GP cheap yes bye and then as you can see we are getting the data that is you visible do this and do this okay so as you can see in fuse against our GPS sensor has lots of data and it's not going to stop until each phase cancel control C s doctor program so as you can see the here the latitude and longitude isn't changing because I am not moving the device so but if you just move the device you will see that the latitude along it you will change so in this video we have learned how to connector as we buy you new six and GPS sensor how to set up things how to write a Python code to get the data and in the next video we will see how to make the live GPS tracker using this device so basically you can drag this device from anywhere in the world so for that please subscribe to our channel like our videos and thank you very much for watching so see you in the next video [Music]
Info
Channel: SPARKLERS : We Are The Makers
Views: 66,724
Rating: undefined out of 5
Keywords: raspberry pi, neo 6m gps module, python, gps tracker, gps module, gps sensor with raspberry pi, neo 6m module with raspberry pi, raspberry pi gps tracker
Id: N8fH0nc9v9Q
Channel Id: undefined
Length: 16min 25sec (985 seconds)
Published: Tue Jul 23 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.