BYOAQ-BAT VIII: Calibration

If you haven’t already, please read the previous BYOAQ-BAT articles first – just search for the BYOAQ-BAT tag.

Calibration used to warrant a vast article, needed special equipment and electronics and took at least an hour as HoG had to be separate from her frame.  With the discovery of 0g offsets the other day, calibration is quick, requires only a flat vertical wall and horizontal floor, and assuming your quad frame is sturdy and the PCB is horizontal, the calibration can take place with the HoG in place in her frame.

HoG sits on the most horizontal surface available.  Use a spirit level if possible, otherwise use a hard floor or kitchen worktop (not a wobbly table and not carpet). Run

sudo python ./ -g

Do this a few times, and then look in There are 3 columns representing acceleration in the X, Y, and Z directions respectively. What we’re interesting in are the zero-gravity offsets: with HoG sitting on the floor, with her Z axis aligned with gravity, the values in the first two columns are the X and Y zero-gravity offsets. Change the code to use these values.  Here’s what I got for HoG in her test on the floor after averaging several readings.

 self.ax_offset = 1166.28
 self.ay_offset = 654.5
 self.az_offset = 0.0

Next do the same, but with HoG held against a wall – i.e. a vertical surface where the Z axis is in a 0g environment. Update the offsets above with the Z axis offset:

 self.ax_offset = 1166.28
 self.ay_offset = 654.5
 self.az_offset = -2688.76

That’s it, job done. These values are specific to each IMU – do not use these values for your quad – all hell will break loose!

Leave a Reply

Your email address will not be published. Required fields are marked *