Please be positive and constructive with your questions and comments.

Angle sensor

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.

--Alan
Juggler

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

Re: Angle sensor

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/

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

Re: Angle sensor

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

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

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.

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

Re: Angle sensor

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: