View Single Post
  #10   Spotlight this post!  
Unread 16-01-2006, 14:19
Tatsu Tatsu is offline
Audiophile and Physicist.
AKA: Tatsu Hashimoto
FRC #1072 (Harker Robotics Team)
Team Role: Leadership
 
Join Date: Jan 2006
Rookie Year: 2004
Location: Woodside
Posts: 49
Tatsu will become famous soon enough
Send a message via AIM to Tatsu
Re: Dual-Axis Accelerometer

Quote:
Originally Posted by Goldeye
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?

I dont think you need to "change" it to v3.3.. thats what U1 on the board is for i think, cant find the datasheet for it its a MCP something something (microchip power IC probably) anyway.. if you want to "change" the 5v output to 3.3, or 12 to 3.3 just use a voltage divider.