I'm trying to make a selfbalancing segway model out of lego and an Arduino Duemilenove. The angle from the MPU is stable until I start the motors. Then it becomes very unstable. I power the motors, the Arduino and the motor controller from the same Li-Po. Do I need to run the Arduino on it's own power supply or what is going on?
The MPU-6050 is a MEMS sensor with digital I2C interface.
It needs 3.3V (2.5 to 3.3V). I assume the 3.3V from the Arduino ?
If the power to the Arduino does not drop below 4V, that 3.3V should be good. And the sensor should return valid sensor values.
The sensor works at 2.5V. But according to the datasheet the voltage may not vary more that 5%. If it is powered directly with the Li-po cell, turning on the motors would change the voltage too much.
How is the Arduino powered ? Do you use a step-up converter ?
The Li-po cell has a voltage of 3V to 4.2V.
The motors and the Arduino is powered from a 11v Li-Po. The MPU is powered via the 3.3v outlet on the arduino and the logic in the L293b motor driver is powered via the 5v outlet on the arduino.
I have installed a big reservoir capacitor in parallel with the Li-Po, a small capacitor in parallel with the 3.3v in case of ripple and catch diodes on the motors. None of the above worked.
I finally removed the MPU and mounted it on long wires. That improved stability a lot. It seems as the vibrations from the small lego motors is enough to mess with the accelerometer. Has anyone else had this kind of problem?
Are you powering the motors by themselves or through the arduino? You don't mention that in your description. I don't know what kind of current the lego motors draw, but you can't get very much power out of the arduino voltage pins.
One possibility is that the motors are very noisy. The fact that moving the gyro helped its stability points to that. Have you tried putting capacitors on the motors themselves? Another possibility is the motors are unbalanced, that one moves more for a given input than the other, this could throw it off and make it unstable.
The motors are powered by themselves. The motors might be noisy and unbalanced but that doesn't seem to matter. When I removed the MPU the signal stabilized. When I pressed the MPU anywhere onto the frame of the segway, the signal became unstable. I guess that the vibrations affect the accelerometer that much. Maybe I'll try to implement a Savitsky-Golay filter. Any other ideas?
From what it sounds like now, you might want to first look at how your mounting the motors and MPU to the frame as well as the frame itself. You could try and put something between the motors/MPU and the frame to absorb part of the vibration (like stick on rubber device feet). How stable is the frame? Just because it looks solid doesn't necessarily mean it.
Same problem here.. after hours of debugging i found motors to be problem.But i do not believe vibrations are issue here. It is the current that breaks mpu6050.
Garberg:
I don't know. It's the InvenSence MPU-6050 with a three axis gyro and a three axis accelerometer.
You tell me.
Please provide a link to the product info for the exact module you are using - that chip can slave a
magnetometer and if the module has a magnetometer that could explain the symptoms.
Magnetometers have to be well away from any high current wiring.
All your high current wiring should be twisted pair, BTW, for low interference.