I have the same problem too! I Use another drive motor without library, I managed to minimize the problem by separating the motor power source (24V) and that used by the rest of the circuit (optically) and using Snubbers filter in the output of the engines, but, the problem continues! Does anyone have any other tips? There exist any gyroscope&accelerometer sensor that use analog output?