Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Calculation trouble!!

Status
Not open for further replies.

Monkeyman87

New Member
I have my accelerometer project working now. I can get 10 bit acceleration values from the PIC Excel succesfully. Since my project is for a science fair I need to do an error analysis. I have to run the accelerometer along a marked path of one 1 meter then do calculations in Excel to find the distance. I'm using the time and the accel value to calculate the distance. D = t*t*a So if my sampling rate is 1 hz I use 1s as time and the acceleration value and calculate distance. The real problem is in my derivation of the acceleraton value. The PIC inputs a value to the PC from 0 to 1023 corresponding to the acceleration. When I get the data in Excel I take the value and subtract it from the value for zero g. If the number is below the 0g value then the accel is negative and if above then vice versa. If thats clear enough my problem is what value to use for zero. If the data deviates 1 count for 1s at a 1khz sampling rate it adds up to alot of error. Any thoughts or suggestions? Also I thought maybe if I took an average of the values when it is sitting still, that would work as a 0g value.

Really, thanks for your help I can use it!!
 
Taking the average with no acceleration should give you a decent 0 value. The easiest way would be to have your axis of acceleration in a direction that gravity has no effect - parallel to the ground. Most accelerometers output 1/2 the power supply for 0 accel.

The biggest problem with using acceleration to measure distance is just the problem you mentioned - tiny errors build up over time until your position is really off. If you added a simple experiment you could measure thiss error over time. Just have your setup move back and forth. If the measurement is perfect it should read 0 position each time you reach the initial position. You will be able to measure the error at 0 position over time to see how fast the error accumulates.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top