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

Показать описание
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.
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:
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.
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:
Комментарии