Paul McWhorter arduino lesson 24

 


 
And if you remember, our circuit is using an Arduino microcontroller, an Adafruit ultimate GPS, breakout board and a virtual boat X, SD card reader writer and, in the last lesson, lesson number 23. We got all this hooked together where it was taking data and if I took it outside and got a fix, it was recording on the SD card, all of the data that was coming off of the GPS, and then we were able to look at that GPS Sentence that nema sentence coming off of it, and then we could see that that was showing us our position on Google Earth and it was sort of like just reaching out and grabbing one of the data points in the file and seeing that we could see it On Google Earth, the truth is, is that we got to pause here and what we’ve got to do is we’ve really got to go in and we’ve got to understand this data coming off of the GPS, and this is something that we just got to take the Time in this lesson to understand what that data is because we’ve got to be able to to move forward in the Arduino we’ve got to parse the data and in order to parse the data, we’ve got to kind of understand what it is and what it, what It means the challenge is, is that it is pretty confusing and most of the things that you do in the high tech world.

Everybody kind of talks together and plays together nicely like that computer talks to the printer and the email works and in everything you know the you know everything works together well and plays together world well, but it’s kind, it’s kind of a different world. When you get into these GPS, is this like everybody speaks a different language and everybody is using a different file format and there is just a dizzying array of different formats, and so it turns out to be kind of a challenge. Is it yeah it’s just like in a few minutes, we can get this GPS hooked up and hook up to the Arduino and we can get it stringing data at us, but it’s a whole different thing to get that day into a format that, like let’s, say We want to do something like create a track on Google Earth tracks where we are, or for my case, where I’m working on high altitude ballooning. What I want in is real time to display on a Google map where we are, and you know this would be on a balloon – is going very high up. You know right up to the to the edge of space and to be able to create a live track on Google Earth with that it’s doable and that’s the direction we’re going, but in order to do it, the sort of step that we have to take here Is we have to understand what those those that data coming off of the GPS mates and what we have coming off of the GPS? Let’S just come and just look at it that if we just went and hook this GPS up and looked at the data coming off of it, you’re likely to see something like this.

Where you have a lot of dollar signs and characters and then just a whole bunch of numbers on this one, you can see that I got a bunch of commas in this and that that’s because I’m just sitting right here with it on my desk and it Doesn’T have a fix and when it doesn’t have a fix, it’s, just basically spitting out empty NEMA sentences, and I pronounce it NEMA it’s in M II, a these are in M EA in and the terminology is NEMA sentences come off of your GPS. Okay, the thing that gets confusing is there’s a whole bunch of different types of NEMA sentences and the first characters that you see on a line. First of all, one line is one NEMA sentence. There are different types of NEMA sentences and the type of NEMA sentence is indicated with this first group of characters, and so this is a GP RMC NEMA sentence. This is a GP GS, a NEMA sentence. This is a GP vtg sentence, so you can see what is confusing run off. The bat is there’s a whole bunch of different types of NEMA sentences. The good news is, is that the first thing that I will tell you is almost all of the data that you will need is contained in two nema sentences. The two nema sentences that you are concerned about is the GP g g, a sentence and the GP r MC sentence and a lot of times.

These are just called the G G, a sentence and the r MC sentence. A whole lot of information is in the r MC sentence and then there’s a couple of things, though, that you need from the g g a sentence. So the first thing when you’re working with the GPS is, is that if there is an option to turn off all this other nonsense, turn off all the other nonsense, and so what you want to do is you can program your GPS to give you just those Two sentences program it to give you just those two sentences, if you can’t turn them off, then, when they’re coming in just ignore them. Let me see if I can find a example here of our program from the last lesson where we were when we were working with this add a fruit sensor. I believe this might be it on this add a fruit sensor, GPS sensor. It was this line here that we sent this command to the GPS and the void set up if you’ve got a different unit. I can’t help you’re just going to have to jump into it. If you want to follow the sequence of lessons, please, it will make it a whole lot easier if you, if you develop, if you are, if you get the add a fruit at a fruit sensor. But if you look here in the void set up on Arduino, if I send it this command GPS in command, this PT PMT case set NEMA output, and then you see I have our MC GGA.

What that is telling the yes is to only send me, the our MC and the GGA sentences and don’t send all this other nonsense and so it’s a lot easier when you turn off all these other ones. Okay, so now laughs a lot simpler. We have two sentences. Point now is how do we make heads or tails out of all of these numbers, they’re very confusing, so let’s take the most important sentence and the most important is the art MC sentence and let’s break it down. Okay, in fact, let me ah, let me see if I can kind of zoom in on this all right I’m going to zoom in here for a minute okay. So if you look at it, the first thing is the dollar GP RMC. What is that that is telling me what the sentence type is on that line and it’s an RMC sentence, the recommended minimum sentence and that’s really what I want: okay, that’s, the type of sentence that I want. What is this next thing? The next number is 1945. 30.000, that simply is the universal coordinated time and it’s called UTC, and that would be it’s 19 hours, 45 minutes and 30.000 seconds. And if you know what time zone you’re in it’s very easy to convert from UTC to your time, google, it it’s very easy to to there’s tables all over the internet. That show you how to convert from that. But you can see it’s like a 24 hour time, so it’s in 19 hours, 45 minutes 30 seconds.

Very, very, very easy. What is next this letter? You will have here a letter a or you will have a letter V if you have a proper fix and are getting proper data. This will be an A for active if you don’t have a fix or something’s wrong. This will be V for void if you’re sitting. Looking at this sentence in your software in your program, you can be checking on that. You need to be seeing that, if an a, if you have an a everything’s good, okay, now let’s get to some real data. This number thirty, fifty one point: eight: zero, zero. Seven is your latitude okay, but it is a goofy format to tell you latitude and let me explain: the 30 is 30 degrees. The 51 point: eight zero, zero seven is the minutes, and what you just got to remember is is that there’s 60 minutes in a degree, and so if I have 51.80 zero seconds, that’s almost another degree, and so this would be almost like 31 degrees, but instead Of saying something, like thirty point – nine degrees, they give you thirty degrees in 51.80, zero, seven minutes so we’ll deal with that, a little bit more into how to break that down and parse it in a minute because we got to get it into some. I like to get things into Google Earth, so we got to get this thing wrapped around in a way that Google Earth will recognize it, but for now, just in your mind know that this is 30 degrees.

Fifty one point: eight zero, zero seconds and the end means you’re in the northern hemisphere and that’s very important we’ll talk about how to how to deal with that in a minute. Let me, let me say a little bit a little bit more here when you’re parsing. This you’ve got to be really careful because you can’t just say: okay, let’s, take the first new two numbers and let’s call that degrees, because, depending on where you are, there might just be one character, four degrees or there might be three characters: four degrees or two Characters four degrees. So when you’re, you know, because you could, you could be, you could be at a latitude of two degrees, you could be a latitude of 220 degrees or you could be a latitude of 200 degrees, and so this will be one two or three characters. But what is always true is this decimal point, and these two numbers are always minutes, so you come to the decimal point and then you put and then you take the two numbers to the left of it, and that will be. That will be minutes. So you go to to the left of the decimal and then you go all the way to the comma and so 50. 1.0. 0.8. 007 is always the degrees. I mean it’s, always the minutes. Okay, so you remember that and then whatever is to the left of that to the other comma that’s going to be degrees and so I’m.

Sorry, if I’m, just repeating myself, but this is 30 degree. These 51 point. Oh point 800 minutes in the northern hemisphere and you can sort of see the point that I’m trying to make here. If you look at the next one, this is our longitude. Okay and our longitude is how many minutes thirty five point: nine nine, eight nine minutes. So I come to here four minutes that is the minutes, and then the what’s to the left of it is degrees, and so our degrees in longitude is a hundred degrees. So what you can see here is here. Degrees are three numerals and here degrees or two numerals, but in both cases that is minutes, and that is minutes does it make sense? What I’m saying I hope it does, and so this is 30 degrees, 51.80, zero, seven minutes in the northern hemisphere and on longitude I am at a hundred degrees. Thirty five point: nine, nine, eight nine minutes in the Western Hemisphere, all right, so hopefully that makes sense. So now what do we do with the next number? The one point, four, nine. Okay, the one point, four nine. Let me come down here because I don’t want to tell you wrong. Okay, the next number one point: four: nine is your speed and knots. Okay and that’s a very useful piece of information, and so this is some pretty rich data that we’re getting here: latitude, northern hemisphere, longitude western hemisphere, and then this is our speed and knots that’s like our ground speed.

So your GPS is moving and it’s keeping track of the speed for what I’m doing with the high altitude ballooning. It is extremely powerful to just be able to go out there, reach out there and grab a grab that speed at that speed indicator. Okay, the next number 111 point: six: seven, when we look down here to make sure that I do not tell you wrong: okay, okay, that is okay. That is the track angle and that’s, not something that I use and that’s, not something that is really very useful. What’S useful here is the velocity and then the next thing, the track angle it’s, not something I use it’s, something that if you really want to understand it, you can go and google it, but it’s, not something that I use alright. So what is this next number? This next number is basically the date: okay and here’s how this works. This is saying that it’s the 31st day of the seventh month of 2014, so it’s sort of like day day and then it’s month month and then it’s year July, 31st. 2014. So you get the time you get the date, you get your latitude, you get your longitude, you get your velocity, and so all of that is most of the stuff that you need from a GPS now there’s some GPS is that will report some other stuff between These commas, and then this goofy thing here is different. Every time, it’s like a checksum where the GPS is just sort of like self calibrating itself, is everything okay, so we don’t worry about that.

This is the stuff that’s really sort of golden to us. Is this stuff in here, okay, it’s, the latitude longitude and our velocity, okay, so that’s some very, very valuable stuff? That is the GP r MC sentence. Let me talk a little bit more now about what what do we do with this number here so let’s say that we have this okay, let me see if I can copy it down here: I’m, going to I’m going to come up to Google Earth, so you Guys go ahead and call up Google Earth and let’s play with this a little bit all right, I’ll try to get it where you can see it here, it’s going to be kind of a mini will earth here. So this is where we would put something in the search bar, so let’s say that I just come up here and ah, if I got this ah like this, which was I need to see if I can get these both showing at least sort of okay. So let’s look at our latitude. So what? If we just came up here and put our attitude in here? Okay, this is getting formatted text, but what I can do number fear. What I can do is, let me just get it from the Nima sent nzile and so let’s say that I came in, and I just got this like this right off of let’s – get it off 4c, because that’s, what we’ve been talking about, let’s get this off.

The RMC sentence – and I came up here to Google – and I told it see if I can scoot this, where you can see the whole thing: I’m at 30 degrees, 51.80, zero, seven minutes in the northern hemisphere all like this, and if I just click search, puts Me up here in Iran, it looks like or turkey okay, I can assure you I’m, not in Turkey, so somehow it is not unto ending this data. Let me show you the easiest way to make GU birth, understand portion of the RMC sentence. That’S coming off. You need to get rid of that comma and you need to get rid of that comma, okay and now let’s. Try it and see what happens. Okay, still putting me over here, so it still doesn’t like it. What it wants is it wants you to tell it. What the degree so you put a space, 30 degrees, space, 51.80, zero, seven north, nothing between the last digit and the end. But you have to have a space between the degrees and the minutes. And similarly, here a space between the degrees in the minutes. And so now, let’s search and oh look at this. We are coming back to the Western Hemisphere, we’re zooming, in on Texas we’re, coming in on the propolis of Colorado, Texas, where I teach high school and if we zoom in you can see the school, you can see the track and football, so we will continue to Zoom in – and you can do that particular sentence that showed right where I was.

I guess it held the fix for a little while normally it doesn’t work inside, but I sort of went outside got a fix I walked around and then I came back inside and it’s showing you within a few feet of where I am sitting in the classroom. Okay, so let’s go back and look okay, where we were we take the or on the RMC, and we come over here. Thirty point: five one: we need to put a space between the degrees in the minutes and then we need to get rid of this comma. We need to put a space between the degrees in the minutes and then we need to get rid of this comma, and then we at least have something that for a single data point we can put into Google Earth or Google Maps and we can sort of See where we are so that is a really that’s a neat step forward that we’re able to make here, but the problem is: is that, like when I went outside and walked around, I don’t want to just see a single pointer put this point in that point, I want to generate a track and I want to see this track on Google Earth. That shows not only where I am, but where I’ve been in order to do that, we’re going to need to generate a KML file, and I can’t talk to you about all the things of KML file in today’s lesson.

We will be doing that in the next lesson, but today, while we’re dealing with coordinates a GPS coordinate, we have to understand what coordinate format the KML file is going to want. You know the the Google Earth is pretty forgiving and if we just put latitude and longitude like this, it’ll figure it out. Okay, the KML file is much much much more particular and what it wants is it wants. It wants things in terms of decimal degrees, and so, if you see here, we kind of got it to the point that I’m at 30 degrees in minutes and what we don’t want to hear about minutes. It wants degrees okay. So how would we do that? Conversion? Let’S see if I can zoom in again and ah let’s see if I can sort of show it here. Ah, what you want to do is you want to recognize that there are 60 degrees in a minute. So what you want to do is you want to say: okay, I’ve got 30 degrees. Well. 50. 1.000. 7. If I divide that by 60 I’ll end up with some fractional degree – and I add that to the degrees and so let’s see if I take fifty one point: zero zero seven get out. My calculator 51 point: zero, zero, seven minutes divided by sixty okay, because there are 60 minutes in a degree. What I get is 0.85, oh one one, and so what I want to do is that point: eight five, oh that’s, my fractional degree or my decimal degree.

So this would become 30 0.8. 501. All right. Similarly, here of what I want to do is this 35 point: nine, nine, eight, nine! I want to divide that by 60, so I say: 35 point: nine, nine, eight, nine! I divide by 60 and I get 0.599 nine, and so I want point: five, nine, nine, nine added two degrees, and so that would be 100 point: five, nine, nine nine degrees so I’m converting minutes to a fraction of a degree and adding it back to degrees. Okay, and if you go through this lesson, it sort of shows you it shows you how to do it, and so let’s come down here and look at this okay. So I take the minutes on on this one. Fifty one point: eight minutes. I take those minutes and I divide by 60. I end up with this as a fraction and so then added to the thirty thirty point at thirty minutes. Fifty one point: eight degrees becomes thirty point, eight six, three three five degrees, okay, and we can do the same thing with the with the other one with the longitude. Okay, the only other thing to understand so a KML file wants these to be converted to decimals. The other thing that you have to do is you’ve got to deal with the north south east west, and this is the way those work okay on latitude. If you have a north leave latitude positive okay, if you have a south, make your latitude a negative number.

If you on longitude, if you have east leave your longitude positive, if you have a West, you have to convert your longitude to a negative number, so North and East would be positive in south and west or south or west would be negative and you’ve got to Convert that, because you see Google Earth for a KML file, doesn’t deal with this North and West okay. So because this is north, when I converted it to a decimal I’m going to leave it as a positive number, because this was West, the longitude becomes a negative number. And so you see when you do that. You drop the N and the W, and you include that information e in the sign, and so this would be positive and this would be negative. The one other thing that I will say about a KML file that you have to understand is is that when you generate a KML file, everybody’s going to do things differently, it wants longitude first in latitude. Second, so if you’re loading a KML file into Google Earth, where you have those where you have those coordinates longitude first comma latitude, when you put it in the search bar up here, that wants it the other way. Google can’t even agree with itself. Here it wants latitude, comma longitude, and so this one is in latitude, comma longitude, and the neat thing is is that Google will also understand this decimal degree. Ok, this decimal degree and so let’s come up here.

I think I am going to map again because that is just going to get annoying. So if I come here – and I put just the two decimal degrees – 30.8, 633 and bodice 100 and then do a search look at that – you see it still, you see it still, it’s still working. Ok, so you see that’s that’s, that’s kind of that’s kind of neat that the Google search bar will take either one, but the Google KML file wants it longitude, comma latitude in decimal degree format. Does this make sense? I buzzed all right. We still have one other little bit of business to take care of what we need to do is we need to go in and we need to now look at the other sentence because for things like high altitude, ballooning or or unmanned aerial drones, which are two Things that I’m really interested in working on this GP GGA sentence has some really really valuable information and so let’s go in here and see if we can break it down again. Ok and so let’s start here. We’Ve got the 19 4 5 30.000 and you can probably imagine that, like before in the RMC sentence, that is the universal coordinated time, so that’s a UTC, and that is 19 hours, 45 minutes in 30 seconds no problem. Other good news is we’ve, got latitude and longitude. Just like the our MC sentence. I don’t have to go through that again so I’m in the northern hemisphere, western hemisphere.

I do not have to go through that again, okay, so what is the one? The one is there, the next number after the W, or it might be an e there, but this next number represents the fix quality. Okay, a fix of one means, you have a fix and a fix of zero means you don’t, have a fix. A fix means that you’re in sync, with the satellites, the satellites are giving you data and you’re able to create a valid nema sense. That means that you have a fix. You know where you are the the GPS. Module knows where it is a fix of one. A fix of zero, no dice, if you have something other than a one, it’s like just a little more detail about what type of fix you have on this adafruit. All I ever see is a zero, no fix or a one yesa fix. So those are the two things I the only two things that I ever see. The next number tells you how many satellites you’ve locked on to for here, the more satellites the better for is kind of a low number, not a real good number. But you can see I just stepped outside. I wouldn’t a real good place to see this guy will, and I only had four. I only had four satellites. The next number 2.18, in my case is, is called the horizontal dilution of position it’s, not that important it’s, not something that I use or fool with, but you can look it up if you’re interested in it and this next one is really really really important.

746 point for that is your altitude above mean sea level in in meters, so I am seven hundred and forty six point. Four meters above mean sea level. Okay, now, if you start getting into what is mean sea level versus what is sea level, you’re, just opening up a big old, huge can of worms – and you can go – and you can look at that. But the easy thing to do is to just understand that for most applications and for most people and laymen – and you know good enough for for most things – would be just consider this – your altitude, I’m 746 point four meters above sea level. What what this next number is is that, where you are on the earth, what is mean sea level and that’s, assuming that the earth is this ellipsoid and it’s, this mathematical description of the earth – and where are you above the mean sea level, where you know where Is mean sea level versus that ellipsoid where you are and it’s minus 22, and so, if you were doing some real real precision stuff, you would need to go in and understand what that ellipsoid was and and start dealing with that. But for things like the high altitude ballooning or for the unmanned aerial drones, I simply look at this, as you know, simplistically, look at it as the elevation in meters above sea level. Okay, some things will give you like some magnetic information in between these next two commas, but my GPS does not report that and then back to the checksum okay.

So what do we really get out of this sentence that we care about what we got out of this sentence that we care about is well. I do kind of care how many satellites I see and so that’s something really useful and what I really really really care about. Is this nice simple measurement of a nice simple measurement of altitude? Okay, so those are your two nema sentences, that’s how to parse them and that’s sort of gives you a heads up about what Google’s. Looking for what we’re going to do in the next lesson is we’re going to develop some software down here that will kind of bust up that nema sentences and nima sentence and start generating a file. I want to generate a KML file that I can actually bring into Google Earth and that’s what we will be doing in lesson 25, thanks for tuning in guys, subscribe to.

 
 

Paul McWhorter arduino lesson 24 Video

 

 

 

 

 

 

Paul McWhorter arduino lesson 24 news

 

 

 

 

 

 

 

Paul McWhorter arduino lesson 24 Social

 

 

 

 

official.arduino
2019-10-28T18:46:20+0000

We’re opening the Arduino IoT Cloud to other platforms, starting with the ESP8266 by Espressif Systems — NodeMCU, SparkFun’s ESP Thing, ESPDuino, and Wemos (to name a few) — along with other inexpensive, commercially available plugs and switches based on this module.
safe image.php?d=AQB6YIkvOaOwGAQg&w=720&h=720&url=https%3A%2F%2Fblog.arduino.cc%2Fwp content%2Fuploads%2F2019%2F10%2FDSC00029 - Paul McWhorter arduino lesson 24
official.arduino
2019-10-28T17:47:41+0000

How fast can you run the 40-yard dash? Find out with your own wireless timing gate system.
safe image.php?d=AQDAnlSUYJivJY5S&w=720&h=720&url=https%3A%2F%2Fhackster.imgix.net%2Fuploads%2Fattachments%2F1008638%2Fblob mOWHBn2WBw - Paul McWhorter arduino lesson 24

 

 

(Visited 23 times, 1 visits today)

About The Author

You might be interested in

Comment (17)

  1. Good work!
    It helped me with a job using a Arduno Nano and a old Holux GPSlim236, there is still some work to do on my quadopter.

    Thank you.

  2. Thank you for your series of lessons. Whilst you may have the intensions of training high school students, I am aware of several electronic engineers including myself, that learned so much in a short time from all your modules.
    I live on my yacht, and your lessons on NMEA, GPS and arduino are helping me to connect all my devices together, one i work out the NMEA hardware side of things.
    Thank you again for your time.

  3. Does not Latitude always and only have 2 digits (90 degrees is North- or South Pole; single digits get leading zero), and Longitude always 3 digits (max 180 degrees, not 200 as you said somewhere half way 😉 )?
    Or is that a different version of the NMEA protocol definition that I’m looking at?
    A fixed format makes decoding a good step easier…
    By the way: compliments on your GPS lessons! Easy and clear, even for a “nuts and bolts” mechanical guy like myself 🙂

  4. So, the only reason, for your use of both, the GPRMC, GPGGA sentences, is for the amount of, satellites count, speed, and altitude; everything else is redundant, for your purposes, correct? I am really enjoying your lessons, and only wish they had something more than Estes, like this, back in my day! $GPRMC, $GPGGA $GPRMC, $GPGGA

  5. Hi Paul. Thanks for the informative video. I have a question about assisted GPS? Not sure if you would know but I thought I’d give it a shot.
    Is it possible to get that feature in any GPS such as the ultimate GPS or is that more of a software stack thing enabled with the GPS receiver? I’m guessing it would not be possible in ultimate GPS but wanted to make sure.
    If I am buying a cellular module and GPS module, I would have to make sure that both these modules have software to enable assisted GPS right?

  6. Hi.Mr paul…I wish all the Good thing in the wold happen to you..may I ask you Sir a question.bugging me since I started watching you lessens .how we can used these converted coordinates from NEMA sentence to control a robot based on arduino here on earth?? thanks alot in advanced

  7. Paul, you are by far the best teacher I have came across so far. I really like how you take the time and effort to explain whats going on, especially on the confusing topics. Thank you!

LEAVE YOUR COMMENT

Your email address will not be published. Required fields are marked *