Go Down

Topic: 2-Wheel Balancing Rover - Jitter/Oscillating and does not drive full speed (Read 702 times) previous topic - next topic


Hello Crowed,

I hope there is help here for my rover. I bought the Sainsmart Upright Rover Kit V3 Pro and I can't decide if I like the rover or hate Sainsmart for selling this kit. But this will be another topic.

The rover can balance and I can drive around using the remote. But there is a big problem. Most the time when balancing and changing spinning direction the rover jitters / is oszillating badly.
The other thing is, that he can only drive very slowly (in comparison to youtube videos of the same rover).

The PID settings were set by the software to
P = 26.000 / I = 0 / D = 2.6.

I only changed gyro offset a bit, to -0.4.

The Filtered Angle of the bot stabilises and I think this should not be the problem. 

The wheels have a (in my opinion large) backlash? Is this the main reason of the problem (see youtube video)?

As my rover can balance indefinitely and drives slowly, can the PID settings still be wrong?

What are the possible problems?

Would the behaviour change if I change the motors or the Gyro?

Should I switch to Step Motors? In my case, I would need to add at least one new H-Bridge.

About the software: Is it legal to upload the source code to GitHub to work together on the code? Sainsmart does not have the current version of the code on GitHub and the documentation is veeeery bad. For example, the instructions say you need to adjust the PID settings with the potentiometers but the software sets them.

Please see the video

Video of sick rover

I hope there is help.



Is it legal to upload the source code to GitHub to work together on the code?
You could ask the authors for permission.

If the robot balances, the PID settings are adequate. That does not imply they are optimized, or adequate for driving.


This V3 bot has an extra feature as compared with V2. The extra feature is wheel encoder. So I'm guessing that this bot should perform better than V2. I have one V2 bot and two V3 bots, but haven't yet implemented the remote control functions on any of them. I will definitely get around to this sometime, soon.

Calibration of the gyro/accelerometer will be important. And also to make sure that the sensor outputs isn't 'too' noisy.

V3 is a real pain to put together in terms of getting the motor shield to mate with the MEGA 2560. It takes patience, that's for sure (with all those pins). The other crazy thing about V3 is a couple of its pins will touch the metal chassis of the MEGA 2560's DC power connector - which is a short circuit death trap for the motor shield. Fortunately the motor shield is relatively inexpensive (easily obtained from ebay).

Judging from your video, it appears that your PID coefficients aren't set up properly. Your bot should not oscillate violently like that. More PID tuning work needed.

The good thing is that - at least your bot is at least balancing for relatively long times.

Backlash exists, but this particular V3 bot (with wheel encoders) can balance extremely well when properly set up.

Make sure that your accelerometer units are reading 'correct' values for all three axes. I say this because my V2 AND V3 bots both came with faulty 'GPU' units, where (very surprisingly, and very coincidentally) one of the three axes kept giving out full-scale values. And, on both occasions, a direct replacement of the 'GPU' (of identical model and/or compatible model) sorted things out nicely.

So, it's important to make sure (by testing and observing data), that the measured and processed data are more-or-less what we expect. Otherwise the bot won't behave properly.


I got rid of the jittering behavior by simply changing to kD = 2, from previously original kD = 2.6. But it is still not running on full speed. I think the filter is still not confident enough to drive in full speed. No I really need to know, how to continue configuring the PID settings, as it seems any change in kP or kI will make the rover stop balancing.

Is there a reliable produced to get to the right PID settings? The one I found does not work: "We used the manual method to do this. First, we set all the gains to 0. Then kP is increased until the response oscillates. Then kP is set to half its value. kI is now increased until the steady state error is corrected in sufficient time. Finally, kD is increased to minimize overshoot." If I ever change kI it stops balancing!

How can I calibrate the gyro? Will I just use a script and insert the values in my roverprogram or will I reprogram the MPU?

I just read to raw output values from the sensors and they seem pretty stable and I think they show all values depending on the position the rover I put in.

PS.: Yes, I read about the problems with putting the boards together as well as the short circuit death trap for the motor shield. I was very careful during assembly.

Go Up