🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    M5 Stack FIRE Artificial Horizon

    PROJECTS
    2
    3
    5.9k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • E
      ekalfwonS
      last edited by

      I've been working on an artificial horizon display on the M5 Stack Fire. This is based on the "bodmer" code, but modified for the higher-resolution screen of the M5 Stack. Here's a video taken just after I got the code working:

      https://photos.app.goo.gl/uT6EryccucaQbaix6

      Since then, I've replaced the random pitch and roll angle generator with calls to IMU.getAhrsData();. This works, except for two issues:

      1. The "zero" is not level. With the Fire sitting flat on the table (screen parallel to table surface), pitch reads zero but roll reads 10 degrees off.

      2. I really want this to sit with the screen perpendicular to the table... ie. pitch=90.

      I can manually go in the code and set the offsets, but is there a way to "zero" the IMU before it starts? The IMU demo sketch offers initAK8963() and initMPU9250() but neither apply to the Fire, which now ships with an MPU6886 according to the M5 support email.

      Help appreciated?

      world101W 1 Reply Last reply Reply Quote 0
      • world101W
        world101 @ekalfwonS
        last edited by world101

        @ekalfwons

        I don’t have an answer for you, but maybe this person can help you out if you contact them. Even though it's the m5StickC, they seem to have a calibrate function. Hopefully they can be of assistance.

        https://mobile.twitter.com/kitazatexi_/status/1216365837604360192

        1 Reply Last reply Reply Quote 0
        • E
          ekalfwonS
          last edited by

          Thanks for the Twitter link, i've reached out to see if he can help.

          I did figure out how to do a rudimentary calibration by waiting for a button press and then setting the current values for roll and pitch to "offset" values and "correcting" subsequent readings using them. It works well enough for now, and I can calibrate in different orientations.

          The only issue now is that this just uses the magnetometer, I think... I'm only reading &roll and &pitch from IMU.getAhrsData(), i'm not reading the gyro values. So this is susceptible to motion, if I slide the unit from side to side on the table the horizon tilts when it should stay horizontal.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post