Concerns With the Memsic 2125 Dual-Axis Accelerometer
Hengel
Posts: 1
I'm currently involved in a design project with my Principles of Engineering class which relies on the use of several (to be specific, three) of the Memsic 2125 Dual-Axis Accelerometers, and we've been doing pretty well for ourselves in terms of the programming code.· On a whole, the individual pieces·are functioning well.· However, as·no matter how well we get them to work·individually, we've realized that for the whole project to work as planned we need to be able to average at least two of the three outputs together.· And in trying to figure out how to do that, we've·run smack into·a metaphorical brick wall.
When running multiple accelerometers on the same board (or even on seperate boards) , is it possible to average the data they output?· If so, what sort of code would be recommended and how would it fit into the basic source code?
Many thankes in advance,
Holly
When running multiple accelerometers on the same board (or even on seperate boards) , is it possible to average the data they output?· If so, what sort of code would be recommended and how would it fit into the basic source code?
Many thankes in advance,
Holly
Comments
Perhaps I don't understand your question, but could you not simply take the raw X axis value read from Chip A, add it to the raw X axis value read from Chip B, and divide by 2? same for Y axis? I'm getting the uncomfortable feeling I'm overlooking something simple here, but I can't figure out what...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Shawn Lowe
My last words shall be - "NOT YET!!!"
In your loop where you’re reading the RAW values, if you have two values for the RAW value, one for the A sensor and one for the B sensor, you can average the two by adding them and dividing by 2. Then store this in another variable. This can be done in one line. This is basically a running average and I have posted this concept and example code on here before for various possible solutions. It can also be applied to more than 2 readings. How this is implemented depends on the ranges of the RAW values. Of course you would do this twice for each unit…Once for each axis. I hope this helps. Take care.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
of a microcontroller. It would save time and money if you just programed a microcontroler to do it.
It would only take one line of code to do; but like LSB said, I don't think I'm understanding your question.
Good luck,
Joshua Terrasas
you can build a low pass filter in software fairly quickly and easily that will even out readings over time.
If A and B the latest readings from two sensors,
Average=( A+B +( 8* Average))/10
weights the last readings heavily towards the most recent, but preserves some memory from the previous readings.
after 10 or so readings, the influence of a previous reading is statistically insignificant.
Tune this formula for your application.
Look at the memsic datasheet. It has a couple circuits in it, one of which shows how to convert the PWM reading to an analogue reading with a resistor and a capacitor.
This circuit has the added effect of integrating the readings over time. You'll have to figure out how to do the ADC conversion of course, but an A to D converter or a clever use of RC TIME could do it.
Hope that helps
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Post Edited (Larry) : 2/9/2007 9:55:05 PM GMT