0
\$\begingroup\$

I have an Adafruit feather sense that I'm trying to code to get direction from according to the LIS3MDL magnetometer inside of it however rotating around the up-down axis it refuses to give an accurate response. Turning the chip around the different horizontal axis' seems to give me the full range of rotations but I need it to work around any axis. Ive tried it with other peoples code around but can only find it specific to the LIS3MDL rather than the feather sense and theres has the same effect as well. I'm new to this sort of thing so let me know if I need to explain something better or even if it's worth putting the question somewhere else. It is worth noting that I'm using Ardiuno code and also that I am in fact calibrating (as far as I can tell) using the Adafruit_Sensor_Calibration.h header.

float get_angle(vec3 vector) {
    return atan2(vector.y, vector.x) * (180 / PI);
}
\$\endgroup\$
2
  • \$\begingroup\$ How does it "refuse" to give an accurate answer? \$\endgroup\$
    – Antonio51
    Commented Jul 31 at 11:13
  • \$\begingroup\$ @Antonio51 It wasn't doing a full spin, just oscillating back and forth. Should have explained that better. I worked out what I was doing wrong anyway. Thanks for your reply \$\endgroup\$ Commented Jul 31 at 13:15

1 Answer 1

0
\$\begingroup\$

Turns out I was not calibrating it correctly. If anyone is interested this was a rather useful reference.

\$\endgroup\$
2
  • \$\begingroup\$ Can you describe how you were not calibrating it correctly? \$\endgroup\$
    – Voltage Spike
    Commented Jul 31 at 15:14
  • \$\begingroup\$ @VoltageSpike I just wasn't calibrating it haha. I called the function but I hadn't actually loaded any calibrations into the memory \$\endgroup\$ Commented Jul 31 at 16:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.