Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Accelerometer code?! (http://www.chiefdelphi.com/forums/showthread.php?t=42607)

David55 25-01-2006 00:51

Accelerometer code?!
 
HI Kevin

I would like to know, what are the advantages of using the full-length accelarometer code found in your website? I was able to get the accelarometer working and printing values by simply doing

x=Get_Analog_Value(rc_ana_in01);
printf("%d\n",(int)x);

and then got to an equasion and finished up the story.

Joel J 25-01-2006 00:53

Re: Accelerometer code?!
 
Kevin's code is pretty much the same as what you are doing if you set it to average only a couple samples. If you bump that number up to, say, 16, then you have a much improved acceleration/angular_velocity value.

There's also a very good bias detection algorithm (its simple too!).

Kevin Watson 25-01-2006 01:15

Re: Accelerometer code?!
 
Quote:

Originally Posted by David55
HI Kevin

I would like to know, what are the advantages of using the full-length accelarometer code found in your website? I was able to get the accelarometer working and printing values by simply doing

x=Get_Analog_Value(rc_ana_in01);
printf("%dn",(int)x);

and then got to an equasion and finished up the story.

If all you need to do is take a voltage measurement from a potentiometer or an accelerometer (to calculate an angle relative to the gravity vector), then my code is overkill. My code was originally designed to wring out the best possible performance out of a gyroscope and then later modified to sample additional ADC channels while also sampling a gyro. My code also uses oversampling and decimation to gain measurement resolution and lower the noise floor.

-Kevin


All times are GMT -5. The time now is 01:02.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi