Skip to main content
Topic: MMA7455L C Library and Arduino Example (Read 23283 times) previous topic - next topic

Re: Re: MMA7455L C Library and Arduino Example

Reply #15
Yes, IIRC, I also tried some automatic calibration routine, but had the same problems as you for which reasons whatsoever.  In the end I decided to hardcode my offset values in a static call to mma_calibrate_offset() as can be seen in the example file MMA7455L.pde.


Re: MMA7455L C Library and Arduino Example

Reply #16
The calibration routine is incomplete.

The XYZ values should not just be written to those addresses.

This is what should happen, if I remember correctly...

    Read XYZ values from sensor.
    Multiply those values by 2 as the offset register has twice the resolution of the G readings.
    Read the current XYZ offset values out of the chip.
    Add the current offset values to the newly calculated values.
    Write the combined values to the offset register.

Also note:
The value for Z should be offset to 64, not 0, so use (Z-64) as the value for Z.
I can't remember if the XYZ reading should be negated before being added to the old offset value.