How to call odometer in neo m8n gps?

0
down vote
favorite
I am using neo m8n gps receiver to measure distance , as I read the datasheet of the device it has odometer function on it that measures distance being traveled. I keep on reading the datasheethttps://www.u-blox.com/sites/default/files/products/documents/u-blox8-M8_ReceiverDescrProtSpec_(UBX-13003221)_Public.pdf but can't still find the way on calling the odo. I'm using the library of the tinygps.

I hope someone can help me here, I guess this one would be the answer to my problem on geting the distance.

I'm using the library of the tinygps.

That library has no clue how to deal with the specific odometer sentence, IF you are even causing it to be sent.

I guess this is a continuation of this thread…

As PaulS said, TinyGPS cannot handle the binary UBX protocol messages that have the Odometer information. It would be easiest for you to just use the distance_between function in TinyGPS, passing a previous location and a current location. Just add up these distances and you’ll have your odometer.

AS DISCUSSED EARLIER, GPS isn’t that good for short distances. Since you said you have an IMU, you could stop adding distances if the IMU says you’re not moving. Well, an IMU only tells you acceleration (change in velocity), so those accelerations have to be accumulated to know your velocity. Some IMUs will do that integration for you, or you can do it yourself.

There are also binary commands you can send to the NEO-M8 that give it a hint of what kind of platform it’s on. That will help it filter out small changes. See the CFG-NAV5 message. You can also do your own filtering: if the distance < 5m or if speed < 0.5 knots, throw away the current GPS location. When the distance or the speed is great enough, accumulate the distance.

And there are other reasons that TinyGPS isn’t a good choice. The examples are terrible, and you will probably spend a lot of time trying to get them working. At a minimum, I would suggest reading the documentation for my library, NeoGPS, so you have a better understanding of the typical problems (see the Troubleshooting section) and how to structure your sketch (see the examples).

If your Arduino only has one Serial port, another problem is the use of SoftwareSerial. Don’t. If you can use pins 8 & 9, use AltSoftSerial instead. If you can’t use those pins, use NeoSWSerial on any pins.

Cheers,
/dev