Ok, I am making a quadrotor with an arduino nano for a brain. It is controlled with commands sent over serial through a HC-06 Bluetooth module. It is supposed to use the mpu9250 for stabilization. I have run into 2 problems. The problems:
-
When the motors are given power, they shutdown after a brief but random time. Serial communication stops (mid stream if the arduino is transmitting) when the motors stop. The TX light either stays on, or flashes so fast it looks like its staying on when the motors stop. Basic bare code that only sets the pwm rate and analogWrites works fine. Before I added the command structuring (checking serial for commands and adding # and / to the commands), everything including the motors worked as expected. Adding the structure for commands is seems to be what causes the issue. As long as the motors do not have power, everything works as expected, except for the other problem below:
-
The mpu9250 does not appear to be working at all. WhoAmI is supposed to report 71, but reports FF. The reported values for x, y, and z fluctuate wildly while the quad is stationary, and the fluctuations and value ranges do not seem to change when the quad's orientation is changed. I changed the If statement that checks the WhoAmI value, so it checks for FF instead of 71, but that didnt help.
The code for the MPU is a copy and paste from MPU9250BasicAHRS.Ino by Kris Winer. I basically just took out all of the display and serial debug stuff. The rest of the code was written by me.
To Be Continued...