I am using a 12v lipo battery to power my arduino using VIN pin and at the same time I am using this same battery to drive a strong NEMA motor (10kg.m) using A4988 driver. At the same time I am also using arduino to read data from MPU6050 (roll, pitch and yaw).
The problem is this: when the stepper motor is spinning slowly no problem at all, but when the stepper motor spins fast then MPU6050 will start reading very strange angles which are clearly not correct.
I am using a capacitor at the INPUT PIN and GND PIN of A4988. What could be wrong? I think that when the motor spins fast it may be creating some noise in the power line and maybe creating some problems with arduino. Has anyone experienced someting like this?
I join PaulS, especially when you are using such a big stepper.
You will definitely need a decoupling of the power supplies for the motor and the rest of the world. A cap is not sufficient.
Hi I am using a 20C 2200mah LIPO battery, so it's surelly not a problem with the current draw cause this same battery powers my quadcopter with no problem.
I wonder if when the motors stop spinning and spins in the opposite direction (to balance my 2 wheel self balancing robot) it may generate a "back" EMF in the power supply line which can cause some problem with arduino or even interfere with i2c communication? If so, how can I fix this problem using a single power supply?
OBS: I am already using a capacitor very close to each stepper motor driver + and - cause this prevents the driver to burn when the motor is spun by hand with power disconnected.
@Robin2 I appreciate your help as all the other people trying to help me.
Instead of making a diagram (I never did one) I did my best to make a video. I am not good in english so this video is probably the worst you will see but I tried hard to show everything and report the problem.
I made some tests and the problem arises clearly when I am giving a good amount of current to any of the motors (turning the trimpot). If I turn the trimpot in the less current position (or close to it) I have no problem at all but my the motors dont spin strongly and thus cant hold my robot position. When I disconnect the motors of the driver the same occurs, no problem at all.
As soon as I connect the motors and turn the trimpot to a high current position the MPU6050 readings get really terrible, the zero (0 degree position) should be right in the middle, but suddently it becomes shifted to one side or another and keeps moving from time to time. Could you help me with this?