QST QMC5883L 3-Axis Digital Compass and Arduino MCU - The Details (3)

แชร์
ฝัง
  • เผยแพร่เมื่อ 25 มิ.ย. 2024
  • Calibration basics, min/max calibration, azimuth calculation …
    ↓↓↓ Complete description, time index and links below ↓↓↓
    In part 2 (link below) we read every bit of raw data, respectively, status information the QMC5883L provides and used its interrupt pin instead of just polling the data in fixed intervals. We’re ready now to do something useful with that data.
    As we learned in “The Basics” (link below) you need to calibrate your 3-axis magnetometer. So we start with some calibration theory and implement a simple calibration method. And in the end we calculate a compass direction (azimuth).
    00:00 Intro - calibration and azimuth calculation
    00:48 Axes revisited - three orthogonal magnetic sensors
    03:18 Why calibration - sensor, hard iron and soft iron errors
    06:28 Goal of calibration - a certain flux creating a perfect sphere
    08:46 Correction matrix - sophisticated calibration, hard to do
    11:47 Scaled biases - an easier, good enough way to calibrate
    14:00 Fourth version - scaled biases calibration for X, Y and Z values
    19:03 Experiments - underwhelming for 3 axes, kinda usable for 1
    23:30 Azimuth calculation - two values, trigonometry and arctan2
    31:37 Fifth version - compass direction around Z-axis (up and down)
    35:00 Wrap-up - we’ll have to revisit the correction matrix, bye
    Tutorials • Tutorials
    QST QMC5883L 3-Axis Digital Compass and Arduino MCU - The Details (1) • QST QMC5883L 3-Axis Di...
    QST QMC5883L 3-Axis Digital Compass and Arduino MCU - The Details (2) • QST QMC5883L 3-Axis Di...
    QST QMC5883L 3-Axis Digital Compass and Arduino MCU - The Details (4) • QST QMC5883L 3-Axis Di...
    QST QMC5883L 3-Axis Digital Compass and Arduino MCU - The Basics • QST QMC5883L 3-Axis Di...
    My code drive.google.com/drive/folder...
    Advanced hard and soft iron magnetometer calibration for dummies diydrones.com/profiles/blogs/...
    How to Calibrate a Magnetometer? appelsiini.net/2018/calibrate...
    Simple and Effective Magnetometer Calibration github.com/kriswiner/MPU6050/...
    #arduino #compass #magnetometer #i2c #microcontroller #tutorials #tutorial #how-to #robertssmorgasbord
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 12

  • @mikelopez9893
    @mikelopez9893 2 ปีที่แล้ว +3

    As always, thanks for your efforts in preparing these videos. For me, this is very much "a touch of nostalgia for the old folks." It takes me back to doing my first degree (Maths) in the UK in the 1960s. The language of choice then for all the cool kids was FORTRAN IV and the space race was very much in the public eye. Naturally, we did a lot of calculations calculating orientation and motion in 3D space. In addition to Matrices and Vectors, Quaternions were an important part of the toolkit for efficient calculation. It is strange for me to realize that the 1960s are more that half a century ago. Nowadays, of course, I'd use C++ for such calculations, but that hadn't been invented then (not even C or its predecessor BCPL). Moreover, an Arduino could easily out-perform most of the main-frame computers of that era so it's easily up to the job of what you are doing. Thanks again for taking me on a trip down memory lane!
    Regards,
    Dr Miclael (someone born in the first half of the 20th Century)

    • @robertssmorgasbord
      @robertssmorgasbord  2 ปีที่แล้ว +1

      As always, you are very welcome! And I have to thank you for your most interesting and extensive comments! In part 4 I will cheat a little bit and do the calculations for the matrix calibration on a PC. At it's core it's taking a calibration dataset (in my case 3512 points, created by doing 14 360° rotations in 14 different orientations) and spits out a bias matrix and offset vector. After applying those your data should approximate a sphere in 3-D space. A bit too much computation for the Arduino and a bit too much math for TH-cam (though there are specialized math channels). But ... in part 5 I will do some kind of circular (modulo) median calculation on the Arduino for filtering purposes (at least that's my current plan).

  • @gabriellopez785
    @gabriellopez785 5 หลายเดือนก่อน

    Thank you, good video, and very good explanation

    • @robertssmorgasbord
      @robertssmorgasbord  5 หลายเดือนก่อน

      You're welcome! And thank you for the praise!

  • @Shimshonn
    @Shimshonn ปีที่แล้ว +1

    I recently got one of these chips, your series has helped me quite a bit, I happen to notice that this specific chip (QMC5883l) seems to output data in big endian format (when I try to read using little endian - the values are not stable when the chip is stationary) despite the datasheet implying little endian.

    • @robertssmorgasbord
      @robertssmorgasbord  ปีที่แล้ว +3

      And then there's the order thy bytes and the bits within the bytes are transferred via I2C ... It has been a while, but I seem to remember that I also ran into that big/small endian problem.

  • @markingle8980
    @markingle8980 2 หลายเดือนก่อน

    Thanks for the information on the QMC5883L config and calibration! Will your code compile on Arduino 2.0?

    • @robertssmorgasbord
      @robertssmorgasbord  หลายเดือนก่อน

      I have no idea. I'm still on 1.8.19. One thing I know is that Arduino no longer wants you to use their "boolean" type and that you should use the standard C++ "bool". But replacing that in the code shouldn't be a problem.

    • @markingle8980
      @markingle8980 หลายเดือนก่อน

      @@robertssmorgasbord Thanks! I had to also add Arduino.h to eliminate most of the compile errors. There were several others as well. I think its best to use 1.8.19....I am having all sorts of issues with 2.0 so I recommend to stick with 1.8.19 as long as you can.

  • @jaydipkavaiya6854
    @jaydipkavaiya6854 ปีที่แล้ว

    Thank you for detailing in QMC5883l can I get Version5 code sample so I Can find Magnetic Heading or your Email so I can chat over there. Please

    • @robertssmorgasbord
      @robertssmorgasbord  ปีที่แล้ว +2

      You're welcome! All versions are available on my Google drive drive.google.com/drive/folders/12kyof0Hg6CITjcA6A3DgAFln-HouaEX8?usp=sharing