Shop OBEX P1 Docs P2 Docs Learn Events
GPS altitude accuracy good enough to calc road grade? — Parallax Forums

GPS altitude accuracy good enough to calc road grade?

LarryGLarryG Posts: 50
edited 2010-07-21 14:51 in General Discussion
I have heard from several sources that altitude readings from GPS sensors are not very accurate and should not be relied upon. I also read that some of the new chips (such as those made by Locosys) are pretty good.

I do not necessarily need total accuracy on the absolute altitude. I am looking more at the change in altitude. What I want to do is measure the grade of the road I am traveling on. Accuracy of about +- 2% of grade would be good enough. (not 2% of reading, 2% of grade)

-I figure I could take a base altitude reading, say 800 feet.
-Then travel up the road 100 feet. Measure distance traveled of 100 feet with the GPS.
-Take another altitude reading, say it is now 805 feet.
-The change in altitude is 805 feet - 800 feet = 5 feet. It took 100 feet to get there, so the grade of the road is 5/100 or 5%

Is a good GPS chip accurate enough to do this? Or should I stick with my original plan to use an accelerometer and calculate using g's of gravity (I already know how to do this, but I am finding mounting the accelerometer on edge somewhat of a challenge).

Thanks for any insights.

-Larry G.

Post Edited (LarryG) : 7/18/2010 1:48:46 PM GMT

Comments

  • dredre Posts: 106
    edited 2010-07-18 15:03
    Hi Larry,
    In my research a GPS reading is not accurate enough to determine road grade. I have
    gotten readings which, in the short term, varied as much as 50 feet!

    I am very interested in your application and have tried, without much success, to build a
    Stamp based road grade meter. The closest I am have gotten is using a very sensitive
    barometric altimeter. However the model I have outputs via USB and I haven't found the
    expertize to tell me how to input ascii code via USB into the Stamp.

    I plan to calculate the change in vertical velocity [noparse][[/noparse]fps] from the change in altitude, and
    then divide by the 'horizontal' velocity obtained from the GPS. By-the-way, if your road
    velocity is 68 mph [noparse][[/noparse]=100 fps] then a change in vertical velocity in fps gives road grade
    directly. My altimeter does present vertical velocity in fps but one just can't depend on
    driving at exactly 68 mph wink.gif.

    If you find all this of interest please let me know if I can be of further help.

    cheers, David
  • LeonLeon Posts: 7,620
    edited 2010-07-18 15:07
    I'd use a inclinometer, based on an accelerometer. Have a look at the ADI and Freescale web sites. Software will be tricky, because of vibration etc.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Leon Heller
    Amateur radio callsign: G1HSM
  • dredre Posts: 106
    edited 2010-07-18 15:18
    Hi Leon,

    An accelerometer would appear ideal. However the inclines relating to road grade are small: therefore the acceleration change is small. This is ok for a nonmoving or slow moving application but I have found that vehicle acceleration/deceleration overwhelms the incline measurement.

    Or, have I missed something. I did run across a technical paper which showed that you could account for vehicle acceleration but I couldn't figure how to apply the measurements [noparse][[/noparse]Measurements canceled each other out and I didn't get any readings.].

    cheers, David
  • ercoerco Posts: 20,261
    edited 2010-07-18 15:41
    A lot of the guys I road bike with are techno-geeks (not me!) and they all have various types of expensive computers on their bikes that can measure altitude and % grade, in addition to speed, time & distance. Some are altimeter-based, others are GPS-based. Some are Garmin units, not cheap stuff. Many times, riders will have wildly different stats after doing the same ride. I think many electronic measuring techniques are best guesstimates.

    Another manufacturer makes a curved bubble-level-type inclinometer that gives accurate gradient readings when properly installed & calibrated on a bike. Can't argue with old school!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
  • LeonLeon Posts: 7,620
    edited 2010-07-18 18:08
    David:

    Those problems can be overcome, but will need quite a lot of work. You might even need to use something like Kalman filtering.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Leon Heller
    Amateur radio callsign: G1HSM
  • LarryGLarryG Posts: 50
    edited 2010-07-18 19:03
    @dre-

    I have been testing a few different accelerometers for my bike computer lately. Here is what I have learned:

    1) A basic 2 axis chip works fine, but can find a 3 axis cheaper at times.
    2) One of my favorite 2 axis is the Analog Devices ADXL213
    3) You typically will be looking for the grade of the road instead of how many degrees of tilt. But it might not matter for your application. (Grade is rise over run, tangent of the angle)
    4) There are about 16mg in one degree of tilt
    5) Bouncing was not too bad due to rough roads. I take 10 samples then average them.
    6) You only need to do the calibration one time. In a 3.3v application, level is going to be pretty close to 1.65v. (Over 1.65v you have a positive grade, below that you are going down hill.) You will need to figure out what margin you want to use for level. For instance, if tilt is one degree either way, then it is basically on level ground. Use a level at the time of mounting the sensor. Get the offset value and plug that in to your equation to set that as a level value.
    7) For item #6, the further you are off of level for the offset, the less accurate you will be in higher readings. This mostly comes into play when you are over 6 degrees of tilt.
    8) I have also used the 3 axis Freescale MMA7361L. Mount it on edge. You do not need to look at the Z, only X or Y depending on how it is mounted. Z is not going to tell you if the road is going up or down, it will only tell you it is not level


    Some good resources on measuring tilt:
    -Analog Devices app note AN-603
    -Memsic app note #AN-00MX-012
    -Freescale AN3107

    This stuff was good enough to work on my bicycle where I did not take into account acceleration going up the grade (I usually do not accelerate going up hill, I am lucky to just get up the hill). You can use both X and Y readings to negate the effects of acceleration. You have to mount the sensor at a 45 degree angle. This is shown in the Memsic app note mentioned above.

    Hope at least some of this helps.
  • dredre Posts: 106
    edited 2010-07-18 20:01
    Larry,
    Thanks for the information on using accelerometers. The 2nd resource you listed,
    Memsic app note #AN-00MX-012, is the reference I used to code the Stamp. However
    when I coded the general form equation given it canceled the signal. Maybe it's as simple
    as my lack of understanding of translating the equation into PBasic. It has been some
    time ago that I played with Parallax's accelerometer so I can't, offhand, find the code I
    derived.
    Will, sometime in the future, try to redo the experiment.
    Thanks for the instruction.

    cheers, David
  • soshimososhimo Posts: 215
    edited 2010-07-19 22:11
    If you have access to the internet you can always run a GIS query and find everything from magnetic bearing, to road inclination, and even road impedance (i.e. dirt road vs paved road). All based on an address point or lat/long pair. This assumes you have access to the internet or some other machine that has the horsepower for the geo spatial analysis.
  • David BDavid B Posts: 592
    edited 2010-07-19 22:43
    In case it's any help, here are two sets of lon/lat/alt data, 90 minutes each, one day apart, over a 20 mile route I took about a year ago with a propeller-powered GPS logger that uses a very old Garmin GPS sensor.

    Maybe you could run some averaging and noise statistics tests on this data set and see if it might be good enough for your purposes.

    This is over a bike trail with practically no hills at all, so any large altitude change in the data is a glitch (there are a few bridges with a meter or so of altitude change).

    I have occasionally seen jumps in altitude data, but in general, my altitude readings are very good most of the time, as this data shows.

    Here's a visualization of the second of the two tracks:

    http://www.everytrail.com/view_trip.php?trip_id=205432

    I don't think you'd want to just take two readings. You'd be better off continually tracking the altitude reading, keeping a running average, discarding or flagging values that are wildly out of range. If you did that, my experience would be that you'd usually get useable readings.
    iron.zip 125.9K
  • HughHugh Posts: 362
    edited 2010-07-21 10:48
    GPS Altitude is notoriously inaccurate compared to the accuracy for position.

    In the past I·have logged GPS altitude with the receiver stationary and it wandered all over the place - a result, IIRC of the geometry of the satellites...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Hugh - the thinking woman's Geoffrey Pyke.
  • LarryGLarryG Posts: 50
    edited 2010-07-21 11:41
    Thanks to all for your input. I think the general concensus is :
    -GPS altitude cannot be relied upon
    -Accelerometer can be used as an inclinometer, but forward and reverse g-force along both x and y directions need to be negated.


    So, I will mount a 2 axis sensor at a 45 degree angle, so x and y point up to make a "V". This is mentioned in the Memsic app note #AN-00MX-012. The angle of the road then is cos-1(.707[noparse][[/noparse]Ax+Ay]/g). Calibrate that to zero. It is worth a try. But I don't think the acceleration of a bike going up a hill is going to throw off the reading by much anyway. But I do want to make this somewhat accurate and consistent.
  • dredre Posts: 106
    edited 2010-07-21 14:51
    Larry,
    You're quite welcome. As mentioned I also have a interest in making a Stamp based road
    grade meter. As a result of your query I have again read the app note. However the vector
    math of the equation and it's translation into PBasic escapes me. I thought about writing
    Andy at Parallax to see if he would be interested in adding a snippet of coding to his mini
    course on the Memsic accelerometer. But I noted that the course had been drafted several
    years ago and his interest may have waned.
    I wonder then if you might be interested in adding your thoughts on this coding to Andy's
    thread; as I feel it might help others?

    In any regard, thanks for your thoughts and renewing my interest.

    cheers, David
Sign In or Register to comment.