0

Angle sensor
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Angle sensor

by Juggler on Mon Nov 15, 2010 10:18 am

Greetings,

I'm interested in a project which will allow me to ouput the lean angle of a moving motorcycle as a digital/analog signal. Is anyone aware of a suitable angle sensor? This sensor would need to output 0-5V or 0-12V with a sample rate of at least 10Hz.

Thanks in advance!

--Alan
Juggler
 
Posts: 1
Joined: Mon Nov 15, 2010 10:12 am

Re: Angle sensor

by adafruit_support_bill on Mon Nov 15, 2010 1:38 pm

A gyro sensor is probably the best bet. They make them with both analog and digital outputs. The people at DIYDrones may be able to help you on that.http://diydrones.com/

adafruit_support_bill
 
Posts: 76160
Joined: Sat Feb 07, 2009 10:11 am

Re: Angle sensor

by stinkbutt on Mon Nov 15, 2010 4:26 pm

I was going to suggest an accelerometer, but since it's a motorcycle, pretty much the only reason it's leaning is because it's turning and an accelerometer will also end up measuring the centripetal acceleration at the same time, borking your readings.
Red M&M, Blue M&M: They all wind up the same color

stinkbutt
 
Posts: 593
Joined: Wed Feb 17, 2010 2:40 am

Re: Angle sensor

by zener on Mon Nov 15, 2010 6:58 pm

So with the gyro, I am guessing you integrate the output (add it up vs. time) and the total represents your angle. But it seems you would need to account for cumulative error over time generating an offset.

zener
 
Posts: 4558
Joined: Sat Feb 21, 2009 2:38 am

Re: Angle sensor

by adafruit_support_bill on Mon Nov 15, 2010 7:11 pm

Yes gyros do drift. Some applications use a combination of gyros and accelerometers to correct for drift, but I don't know the details of the algorithms involved.

adafruit_support_bill
 
Posts: 76160
Joined: Sat Feb 07, 2009 10:11 am

Re: Angle sensor

by mike31416 on Tue Nov 16, 2010 9:14 am

The trick is to use a gyro and accelerometer. I used an algorithm called a Kalman filter to combine the two.

Here are a couple of helpful links that explain the concept:

http://tom.pycke.be/mav/69/accelerometer-to-attitude
http://tom.pycke.be/mav/70/gyroscope-to ... ch-and-yaw
http://tom.pycke.be/mav/71/kalman-filtering-of-imu-data

Here is a link to the code I wrote for a two wheel balancing bot which includes the kalman filter that Tom wrote. This was developed for the Pololu SVP 1284 which uses the ATmega1284.
http://dl.dropbox.com/u/4184471/Blogger ... BalBot.zip

Here are a couple of videos:
http://www.youtube.com/watch?v=utgYAcucqes
http://www.youtube.com/watch?v=SnSt8FlbVHM

Hope this helps,
Mike

mike31416
 
Posts: 126
Joined: Wed Aug 26, 2009 12:06 pm

Please be positive and constructive with your questions and comments.