go_away

### Author Topic: Measuring the angle towards ground  (Read 2703 times)

0 Members and 1 Guest are viewing this topic.

#### mihies

• Jr. Member
• Posts: 30
##### Measuring the angle towards ground
« on: November 11, 2008, 12:58:30 PM »
Hi guys,

First, bear with me since I am a beginner and will probably have a bunch of (perhaps beginner's) questions
I am looking into Axon MC.
My first self imposed task is to build a device that measures the angle at which my mountain bike is inclined towards ground (I am sure that there is a better term) - the data will be transmitted to a pocketpc via bluetooth.
Initially I was thinking about a gyroscope just to find out that gyroscopes measure just angle changes and not absolute angle, right?
So, what would you recommend?

Thanks,
Miha

• Supreme Robot
• Posts: 11,673
##### Re: Measuring the angle towards ground
« Reply #1 on: November 11, 2008, 10:09:08 PM »

http://www.societyofrobots.com/sensors_accelerometer.shtml

And actually, a gyro will also work. You record the starting angle (flat level ground), and then just subtract it from any new angle (when on a hill).

An accelerometer will have error with vibrations, and a gyro will develop additive error (drift) over time.

#### mihies

• Jr. Member
• Posts: 30
##### Re: Measuring the angle towards ground
« Reply #2 on: November 12, 2008, 01:56:58 AM »
Hi,

Yup, saw that and that's why I am sceptic about this (great tutorial(s) btw). I am not that happy about that "drift over time" - when the binaries are involved there would be always an error that will grow over time.
But I guess there isn't a viable better way, is it? Like something that knows the level and the current angle from it (for ground vehicles that is) and it isn't affected by vibrations.
I saw that there are gyro/acc combos out there. Do they do a better job or just output both data?

Thanks,
Miha
« Last Edit: November 12, 2008, 02:17:26 AM by mihies »

• Supreme Robot
• Posts: 11,673
##### Re: Measuring the angle towards ground
« Reply #3 on: November 13, 2008, 01:48:37 AM »
Someone once suggested measuring the gryo drift error, and then subtracting it from the final results. I haven't tried it myself though, so not sure how predictable the error is.

Quote
I saw that there are gyro/acc combos out there. Do they do a better job or just output both data?
They just output both data.

You could consider a full IMU, but their priced in the \$1k's . . .

#### dunk

• Expert Roboticist
• Supreme Robot
• Posts: 1,086
##### Re: Measuring the angle towards ground
« Reply #4 on: November 13, 2008, 04:48:11 AM »
on a bike it is safe to presume that the average angle over a period of a few minutes is straight up. (unless you are riding round in circles...)
gyro drift is fairly slow so if you calculate the average angle of the bike over the last few minutes and assume any deviation from 0 is caused by gyro drift you will get reasonable results.

dunk.

#### mihies

• Jr. Member
• Posts: 30
##### Re: Measuring the angle towards ground
« Reply #5 on: November 13, 2008, 06:33:08 AM »
on a bike it is safe to presume that the average angle over a period of a few minutes is straight up. (unless you are riding round in circles...)

What about long ascends or descends?

#### szhang

• Robot Overlord
• Posts: 140
##### Re: Measuring the angle towards ground
« Reply #6 on: November 13, 2008, 10:41:47 AM »
If you want instantaneous angle reading, you need to be content to the limitations of accelerometers and gyros.  If you just need the average inclination over a fairly long period of time/distance, you can also trying using a GPS, and compute the difference in altitude measurements.  I used to bike with a bluetooth GPS and a PPC program that logged the data and calculated, among other things, average slope.  I would say it is fairly accurate, but this is one of those things where the more money you throw at it, the better the result become.  It is true for accelerometers, gyros, and GPS.
« Last Edit: November 13, 2008, 10:42:52 AM by szhang »

#### mihies

• Jr. Member
• Posts: 30
##### Re: Measuring the angle towards ground
« Reply #7 on: November 13, 2008, 12:57:43 PM »
If you want instantaneous angle reading, you need to be content to the limitations of accelerometers and gyros.

Yep, that's what I am after. I guess I'll use combination of gyro and acc. The current plan is to use gyro and calibrate it with acc (when it is stable for a certain period of time it should mean no vibration involved). At least that's my current plan :-)

#### HDL_CinC_Dragon

• Supreme Robot
• Posts: 1,261
##### Re: Measuring the angle towards ground
« Reply #8 on: November 13, 2008, 04:22:12 PM »
heres a simple* Idea that I think COULD work if you were willing to go that ghetto:
Get a uC and a potentiometer/rheostat. Have the pot sitting at the 50% mark with the maximum resistance and the minimum resistance arm locations facing upwards(basically put the pot on its head) and then have a small weight that resembles a small solid arm pendulum attached to the knob of the pot. Have the 50% mark be 0 degrees and then based on the resistance of the pot, youll be able to determine the angle you are at. You could mount the pot/weight and uC all in one tiny project box. Then hard mount the box to the frame of your bike, perhaps in between the two lateral support bars. When your level, the weight will be pulling straight down due to gravity thus putting the pot at the 50% mark. Lets say its a 10k pot for arguments sake. So your uC can convert the 5k ohms into a digital signal and then relate that signal to 0 degrees. Now lets say your going down a 15 degree slope. The weight change the pots resistance as it turns the knob so it can always be pointing downwards while the bike frame and thus the pot itself will be with the angle of the slope and just keep monitoring the resistance of the pot, converting it into the digital signal that the uC understands, and then relating that to the angle using some kind of equation that shouldnt be too hard to make up if you really really think about it. Very little error and no error buildup or anything, Wont get thrown off too much by vibrations, and is fairly easy to implement.

*I think the uC's can only convert a digital signal on a scale from 0-255? If you measure exactly how much the resistance of the pot changes for each degree that the pots swing arm rotates, you can just chop off the first and last 22 degrees worth of resistance(0-~735ohms and ~9265-10000ohms on a 10k pot) by setting the bounds in the uC(736ohms would basically equal 0 after an A2D conversion, 9265ohms would be equal to 255 after the conversion) and just subtract from 150(150 being 50% of the pots actual total resistance thus being 0 degrees with the weight pointing down due to gravity) whatever you get as a digital representation of the resistance of the pot which is changed by the weight turning the knob at different angles.

I hope I explained that correctly and understandably... And I also hope I didnt lose you too much... or scare you away....
Also I would like one of the smartness peoples on the forum to check my thinking... provided I spit it out properly.... >_<

I can probably explain it a little better if needed

-Dragon

-EDIT-
* It was simple in my head before I tried explaining it. It then looked a lot more complicated but it still is rather simple if you can grasp what im talking about >_<

-EDIT-
Im going to try to rig a quick sample up using my \$50 robot stuff and some things I have laying around. Ill try to show it in action and stuff and prove(to myself and everyone else) that it works :-p

-EDIT-
Note: Im not a very highly regarded (if regarded at all, lol) member of the forums so dont take anything I say into extreme consideration unless someone else who does have merits confirms it or whatever. Im not very up on the programming stuff as much yet.
« Last Edit: November 13, 2008, 04:34:36 PM by HDL_CinC_Dragon »
United States Marine Corps
Infantry
Returns to society: 2014JAN11

#### dunk

• Expert Roboticist
• Supreme Robot
• Posts: 1,086
##### Re: Measuring the angle towards ground
« Reply #9 on: November 13, 2008, 05:34:22 PM »
Quote
What about long ascends or descends?
heh. i misunderstood your first post. i thought you wanted to record how far you were leaning left and right.
how steep a hill you are on makes far more sense.

dunk.

#### ArcMan

• Supreme Robot
• Posts: 519
• Mmmm... Plasma
##### Re: Measuring the angle towards ground
« Reply #10 on: November 13, 2008, 09:22:59 PM »
lol.  You could sound a "road rash imminent" alarm if you were leaning too far left or right.

#### mihies

• Jr. Member
• Posts: 30
##### Re: Measuring the angle towards ground
« Reply #11 on: November 14, 2008, 04:28:22 AM »
Quote
What about long ascends or descends?
heh. i misunderstood your first post. i thought you wanted to record how far you were leaning left and right.
how steep a hill you are on makes far more sense.

No worries, perhaps I didn't explain myself too well :-)

#### mihies

• Jr. Member
• Posts: 30
##### Re: Measuring the angle towards ground
« Reply #12 on: November 14, 2008, 04:38:03 AM »
heres a simple* Idea that I think COULD work if you were willing to go that ghetto.

Yes, I think I understand your idea. And it might actually work, who knows.
Anyway, here is more info on my goal: record the data from biking (most importantly: current angle, I can retrieve other data from my edge 305). Then, have some sort of camera on my bike or helmet and record the video as well - you can see a lot of downhill videos on the web. The biggest problem of the videos is that you really don't know how steep is the descent and the velocity from watching the video alone. Thus I'd use my data to merge it into the video to get a HUD like effect with data shown as it is shown of fighting aircrafts.

#### mihies

• Jr. Member
• Posts: 30
##### Re: Measuring the angle towards ground
« Reply #13 on: November 14, 2008, 04:40:12 AM »
lol.  You could sound a "road rash imminent" alarm if you were leaning too far left or right.

#### HDL_CinC_Dragon

• Supreme Robot
• Posts: 1,261
##### Re: Measuring the angle towards ground
« Reply #14 on: November 14, 2008, 02:48:23 PM »
Yes, I think I understand your idea.

I hope so lol. All day at work today I was trying to guess how many "WTF?" replies to my post there would be If you need to me to I can clear up any details your unsure of or whatever.

-Dragon
United States Marine Corps
Infantry
Returns to society: 2014JAN11