M5 Stack FIRE Artificial Horizon
-
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:
-
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.
-
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?
-
-
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
-
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.