MPU-9250 with Python in Node-RED #3: Angle Calculation "Basic" using the atan2 function.

Veröffentlicht am: 13 Februar 2021
auf dem Kanal: raspberry4sailing
3,876
39

The MPU-9250 is an impressive IMU (Inertial Measurement Unit) sensor: For 5 bucks you get "9 axes": A three axes accelerometer, a three axes gyro and a three axis magnetometer (compass).

But dealing with the sensor is anything but easy! It just gives you raw values, you need to do a lot to get a stable angle calculation.
And the only Node-RED node existing is not working anymore on newer node.js versions!

Thus, I decided to start my last winter project for 2020/21: We will go step by step into the integration of the MPU-9250 in Node-RED:

we will use a special note to be able to use Python in Node-RED
we will read out registers, create objects in Python and hand them back to Node-RED
we will combine high and low bytes to words
we will calibrate the accelerometer sensor, using the 15 bit offset registers
we will perform some trigonometry to calculate the rotation angle
we will create a dashboard in Node-RED to get our readings and results

This is part 3:
Today is "angle calculation day". We will create our dashboard and calculate the roll and pitch axis, using our raw values and some equations!
We will base on our theory of part 1, arctangent but as we want to cover 360° we need the atan2 function of the math library.

Fascinating? For sure. Let's go!

Recommended links:
   • Understanding Sensor Fusion and Tracking, ...   ||| great explanation from Mathworks about IMU. Best I know!
https://www.nxp.com/docs/en/applicati... ||| Application Node from NXP about Tilt Sensing
   • 9-Axis IMU LESSON 6: Determine Tilt From 3...   ||| Tutorials about tilt calculation of IMUs


Auf dieser Seite können Sie das Online-Video MPU-9250 with Python in Node-RED #3: Angle Calculation "Basic" using the atan2 function. mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer raspberry4sailing 13 Februar 2021 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 3,876 Mal angesehen und es wurde von 39 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!