Extract GPS location in Arduino with NEO-6m module

Ublox Neo-6M GPS module to extract Latitude and longitude using Arduino this is made by Ublox. this piece. Somebody put on this board and selling ON the internet for cheap. There is not datasheet or information They are selling it with a relatively small antenna. this is standard antenna usually comes with GPS module with different housing. It has a battery to hold setting and some data. It has 4 pins. There is VCC which is the + terminal, RX, TX, GND RX is the input to receive commands to set parameters, clock of the GPS module Or UART or other way to communicate. This is TX this is the output pin of data. and then the GND is the ground pin of power supply.
I put a 4 pin header Let me plug it in the breadboard . I have a video on how to use Breadboard. Link is below this video. and this is the antenna. I am setting close to the window about a meter (100cm) away from the window. Hopping to get GPS signal here. Let’s have a look at some other other specs of this device Let me just open the actual data sheet. This is the Neo-6 GPS module the module size is 16x 12.2. x 2.4mm This the size of this module. Neo-6 had different variations. G, Q, M, P, V and T So we are looking at Neo-6M This has a type number 001 which is printed on the actual module here. the most important data for Neo-6M here is the supply voltage on this bullet show 2.7 to 3.6V so this is the voltage range and fortunately on Arduino we have 3.3V here so you will find the 3.3V output on Arduino on this side.
There are so much information which are not of our concerns. for new design you will need sensitivity and other characteristics. the most important parameter to use this module is the navigation update rate which is 5Hz. so 5 times in a second it updates the information. this quiet fast comparing it with this which 1Hz But without any configuration it goes to 1Hz which I am gonna show you soon. On my oscilloscope and on the screen Position accuracy is 2.5 meter so whatever information you are getting it might be up to 2.5 meter off the actual location. so + or – 2.5 meter it has tones of inf oration for programming and configuring so I am looking at blink sketch uploading it The LED is blinking. if we connect external LED to pin 13 we also will see that. for initial test the Arduino should not have anything else. Specially to connect it connecting a wire from TX of GPS to TX of Arduino board through a 300Ω resistor.
I just put this resistor to eliminate the current between two devices after the resistor there I am connecting it there Now for the ground , one of the ground GND pin from Arduino is enough I just plugged into the GND .These lines are connected if you want o know. Here serial monitor is opened (Click on Tools Serial Monitor, to open it) Okay, now you can see both wires. I am just connecting the VCC to 3.3V You can see the data is coming. This is automatically sent without any programming to your screen. The actual data will come when the blue LED turns ON or it shows locks to the GPS Stream of data Then we will get actual latitude and longitude so it will take about a minute for GPS signal to lock.
Now look at my oscilloscope here I am conning the Ground of my oscilloscope to the Ground on breadboard to GND of Arduino and also I am connecting the oscilloscope probe to output of this as you can see that is the data coming from GPS . This is still missing the latitude and longitude now the signal have been synced. Blue LED is blinking. on the screen you see the data is coming. let me click on “scroll pause” this field has the latitude and the longitude and also the latitude and the longitude is shown in GPRNC here is the latitude if you watch this video in HD, you will be able to red the text. it is shown in multiple places some of these codes number of satellites for example if you got with GGA, then yo will get the number of satellites you can get from 00 to 22 let me just look here so GGA, this shows here 3 this 4 is number of satellites.
For example I am getting signal from 4 satellites. it has altitude, it has tones of information which we don’t need them all. to decode this copy portion of it. After highlighting it, I’m pressing CTRL with C key and there are tools online which I am going to provide you the links in the description for example this website has free NMEA net decoder. I am just pasting that data here (CTRL +V) and then pars it and it shows you all for example the time 16:20 UTC time this shows the actual GPS latitude and longitude and if you click you will be able to see it. also in GPS world also has details of those codes that I just mention. you can get further information from there. okay this is my oscilloscope showing the signal form satellite if Is stop it (capture it) you will see the actual signal Now I am removing this and connecting it to RX now I am loading my code the sources code for this video is provided at Robojax.com and below this video under the description to the Arduino as you can see the light is there and GPS is locked. when loading the code to Arduino, disconnect the RX cable from the Arduino board.

I forgot to mention to disconnect RX cable from Arduino i just reloaded the code. now connect the cable to the TX from GPS to RX of Arduino As you can see we are getting latitude and longitude and I put big dividing line here which is printed by this I am going to explain all of this. watch it in HD to read the actual data let’s go to the explanation of this this is one of the line that I am trying to use and explain I am looking at GPGLL line the line that starts with $ sign and then GPGLL this is the latitude and after comma it has N, this refers from North and then we have this value which is longitude this is West.
This is the time so we don’t need then all . We are concerned with latitude and longitude in the code here we have all these Click on link in the description of this video which will take you robojax.com/learn/arduino let me explain it in a bigger text. Sorry one more thing I have to mentions at the bottom of this code I got this function from Arduino website. So what it does is When this code runs and if there is data in the Serial Input, if Serial is available Then this will set this STRING called “COMPLETE” equal TRUE which I am going to use at the top of this code. This code have been taken from here Arduino.cc the Serial Event function It has been described here. and I copied and pasted exactly here. and added my code in between if you want to start from scratch, get it Serial Event from Arduino.cc website and my code goes here and some other information which I am going to show you in the setup() function. okay. these codes are above the setup() function. I just put STRING input String as blank.(without any data) string Complete BOOLEAN these two are alrady there. I have just added mine here STRING SIGNAL so I want to target only $GPGLL data from satellite .
So I stored this string here inside the setup this was already there and I have not changed it. it works perfectly as my Serial Monitor is set to 9600 Baud and here if string Complete is TRUE this will be set to TURE when signal from GPS module is coming. Then we can do all these calculation .So first things. We pick 200 bytes of signal using this line so this is holding our signal. The whole line. This is holding all of this from here to here. so this will be saved (in the iinput String ) and here we say go inside the input String and start from character 0 and get only 6 character of it and save it in BB we check if BB is equal signal ans signal is this We are looking for the line which starts with GPGLL We ignore the rest of data. we say if it is found, As we are getting so much of other information. when BB is equal this signal GPGLL then we extract 17 character starting from character 7.
Now if you look at the signal, and 0, 1, 2, 3, 4,5 6 and this “4” is the character 7 then 8, 9,….16 up to 17 so we get up to 17 character and stare it in LAT which is latitude and then we want to get the character “period” or the dot. from character 7 to 17 is stored in LAT variable. then in LAT we want to find the position of dot or “period” then we wan tot find the position of any zero at the begining of LAT string and that position is stored in LAT zero variable then we check it if LAT zero is equal zero in some latitude in the world we will have zero in here. That zero in google map will give issue so so we want to make sure if there is zero, just remove it. for example in my location here we have a zero. if the zero is at the beginning if first char is zero, then we say take the latitude and start from 1. and not from zero.
So if it has zero, it will be removed. so we do the same for we start from 20 to 31 that is for the longitude. and this line prints –LAT– and the next line prints actual LAT value and then which was this one and this is a text again for –LON– and value for Longitude and then w and we print. so we know reading is ended. then we empty the input String because making sure it is ready for the next reading and we set string Complete to FALSE so when the loop goes again, inside the loop this should be fresh data as you can see we got latitude and longitude so you can do many things with this and applications are countless you can program this to something can be triggered or SMS can be sent using GPRS module if this device is in a certain location. you can program it for Geofencing so you can create a fence area and put all the coordinates of 4 points and if the data is beyond those points, it should trigger some event or take picture or send SMS or do something. that is it. I will have more project related to this.
Average Rating