View Single Post
  #9   Spotlight this post!  
Unread 15-01-2006, 17:23
Goldeye Goldeye is offline
Registered User
AKA: Josh Hecht
FRC #0694 (Stuypulse)
Team Role: College Student
 
Join Date: Jan 2005
Rookie Year: 2005
Location: New York
Posts: 145
Goldeye has a spectacular aura aboutGoldeye has a spectacular aura aboutGoldeye has a spectacular aura about
Send a message via AIM to Goldeye
Re: Dual-Axis Accelerometer

Quote:
Originally Posted by naor52
I got the Acceleration sensor working (if people are still having problems with this, PM me, i'd be happy to help) but the values i'm getting are odd....

when sitting still the value returned by Get_Analog_Value(rc_ana_in09) is around 716-717, and can get to about 915 or so when shaked.....

is this normal?

how can i transofrm these to normal 0-255 values? should i?

Thanks!
No one here gave a particularly helpful explanation unless you have a good understanding of the inner workings of the code, so here ya go.
Get_Analog_Value returns an int value from 0-1024, rather than the unsigned chars. This is based on the voltage returned along the signal wire from the accelerometer.
The readings from the accelerometer pointing straight up with it resting on a nonmoving surface should be equivalent to an acceleration of zero.
When you turn the accelerometer onto its side, one of the values it returns should change. The difference between this value and the original one represents 1g of acceleration, and can be used to scale all the readings.
Precisely how to do that in code is for you to figure out.

By the way, using a timer and low level access to the ADC (Analog-digital converter), it is possible to sample the device more than once per loop, and closer to if not more frequently than the rate than device updates itself. The adc code on http://kevin.org/frc can help you do this. Use the gyro code as an example, or wait until kevin uploads his new accelerometer code. (Soon, please )

On a related note, the specs for the accelerometer have it working at 3V. Is there a way to change the power supply to that?
__________________
Team 694

2005 Championship - Galileo Semifinalist
2005 New York - Regional Chairmans Award
2005 New York - Semifinalist (Thanks 1257,1340)