SparkFun Forums 

Where electronics enthusiasts find answers.

Have a good idea for a new product for SFE or Olimex? Let us know!
User avatar
By sparky
#1731
Well there's some inherent problems with your question:

The ADXL output 'gravities' - or more accurately accelerations. You are wanting miles per hour - or velocity. To get velocity from acceleration, whip out your old physics books. You'll have to integrate accel once to velocity. Integrate again and you'll have distance.

Integrating (roughly speaking) with a PIC is not too difficult. You'll need to check the ADXL reading multiple times a second (100hz should do) and record the gravity reading (units are m/s^2 right?).

1G = 9.81m/s^2

so for every reading you take multiply by the slice of time. For example, let's say the ADXL is reporting .01G at a specific point in time:

.01G * 100Hz = .01 * (9.81m/s^2) * 1s/100 (this is 100 hz)
delta v (change in velocity) = 0.000981m/s
This is your change in velocity. You've just increased speed a bit. Add this number to an overall velocity variable over time.

There are tons of problems associated with using 8-bit micros to do floating point math and big ugly numbers that I won't go into but it can be done. Also, the ADXL has a tendancy to have reading shifts due to temperature changes. These small changes get magnified by integration.

It's a sticky situation,
-Nathan
By kt
#1762
Thanks for the infor about how to convert accelerations. I looked at the Firmware v2.1 source code and was wondering if the source for Delay.c and soft232.c are available for download?

Thanks for all your help...
By Guest
#1785
Most likely not, as they are probably libraries for the C compiler they used for the project, and hence belong to the compiler company, not Sparkfun
By UberSteve
#6250
I too am looking for soft232.c and delay.c so that I can further develop the SerAccel v3.

What compiler do these come with?

Cheers,
Steve