IMU orientation problem

Post Reply
Posts: 5
Joined: Thu Oct 19, 2023 7:10 pm

IMU orientation problem

Post by ishanshah474 »

Setup - Used Arduino Nano, MPU6050 and BMP085 as sensors. Using the Multiwii Version 2.4. Configured the config.h file to use QuadX, enabled GY521 and BMP085 from independent sensors. Selected PPMSumReceiver on pin D2 using an ESP32. So basically, ESP32 receives input over Wi-fi as IP data packets and pipes it to pin D2 of the Arduino. 4 motors are on default pins (3, 9, 10 and 11).
Now, so when I arm the drone all 4 motors start running/spinning. Then when I increase the throttle gradually, the motor has very erratic behavior. It starts to yaw, pitch and roll at the same time.
I've checked - the ESC, Motors and PWM are all looking error free. So my doubt comes to the MPU6050/GY521 I'm using. Does the Multiwii code calibrates the MPU6050 each time it powers on?
I calibrated the MPU6050/GY521 manually before uploading the drone code to the Arduino nano. Still behaves the same way. I tried a few different orientations of the IMU but with those, the drone doesn't even arm or at least the motors don't start spinning when armed. I was thinking to enable these 2 lines of code in my firmware -

//#define FORCE_ACC_ORIENTATION(X, Y, Z) {imu.accADC[ROLL] = Y; imu.accADC[PITCH] = -X; imu.accADC[YAW] = Z;}
//#define FORCE_GYRO_ORIENTATION(X, Y, Z) {imu.gyroADC[ROLL] = -Y; imu.gyroADC[PITCH] = X; imu.gyroADC[YAW] = Z;}

If I enable these 2 lines of code, what would be the orientation of the IMU? Also, is it possible there may be some other issue? If yes, what could it be?
Thank you very much.

Post Reply