Introduction: SainSmart InstaBots Upright Rover(Self-Balancing Robot With Arduino)

Picture of SainSmart InstaBots Upright Rover(Self-Balancing Robot With Arduino)

Upright Rover is a self-balancing robot which was designed by SainSmart. They really made it simple. As you can see, there are only 8 wires on the robot and 8 wires on the controller. So let's find out how it works!


3x Potentiometer

2x UNO R3

2x USB Cable

2x Sensor Shield

2x 24L01

2x Joystick

2x Gear Motor

2x Wheel

2x Motor bracket

2x Coupling

1x T-Plug

1x 9V Battery Snap

1x MPU6050

1x L298N

1x Balancing Robot Platform

1x Wireless Remote Controller Platform

1x Box &wires & connectors

You can find the kits on this website.

Step 1: Opening Box and Soldering

Picture of Opening Box and Soldering

There are so many boards!

Following the instruction on the website, we may solder the motors first. And it says that wires and capacitors can be connected to any electrode, so just do it. And about the T-plug, it need to be soldered as shown in the diagram. We should pay more attention to the T-plug or we will damage the motor drive controller board.

Step 2: The Bottom of the Robot

Picture of The Bottom of the Robot

Assembling the bottom is easy. The expanded diagrams on the website is pretty cool and helpful. Just remember one thing, assembling the motor bracket before you put the motor on it.

Step 3: The Middle and the Top of the Robot

Picture of The Middle and the Top of the Robot

No difficulty.

Step 4: Wiring and Connecting of the Robot

Picture of Wiring and Connecting of the Robot

I copied it from the website.

Positive electrode -> VCC

Negative electrode -> GND


5V -> 5V


IN1 -> D3

IN2 -> D4

IN3 -> D5

IN4 -> D6

ENA -> D9

ENB -> D10



Potentiometer1 -> A0

Potentiometer2 -> A2


As not everyone solders the wires in the same way, if the wheels turn in the wrong direction swap the D3 and the D4 or the D5 and the D6;After adjusting the robot so that it can stand up, try to control it with the remote controller. If it can go forward and go back normally but cannot turn, please swap D9 and D10.


If the potentiometers can not stick on the board tightly, you can solder the pins with a little bit solder wire.

Step 5: The Bottom of the Remote Controller

Picture of The Bottom of the Remote Controller

Screws and shims are needed for each tapped hole.

Step 6: The Middle of the Remote Controller

Picture of The Middle of the Remote Controller

No difficulty but a pity. You can only tight two of the screws which were designed for the UNO R3. Because the other two of the tapped holes on the UNO R3 are too close to the components on it.

Step 7: Wiring and Connecting of the Remote Controller

Picture of Wiring and Connecting of the Remote Controller

Space between the four pillars is for the 9V battery.

Step 8: The Top of the Remote Controller

Picture of The Top of the Remote Controller

Step 9: Finish!

Picture of Finish!

Assembling only takes me an hour, but my battery is still on shipping. So let's watch the tutorial video first!


viktor1994 (author)2017-12-08

Hello guys.

I would like to ask you about the SainSmart InstaBots Upright Rover V2,

i have the following problem, when the angle is -10 for example both motors works in the right position,but when the angle is +10 only one motor turns and the other do nothing.Have anybody any idea what is the problem??

JakobL14 made it! (author)2017-05-24

Just made V2 of this kit ( Had a lot of fun, but be prepared for some trouble since the manuals are all wrong and made for different boards. After some tweaking it works as expected except I have not gotten the LCD display to work yet

Key lessons learned (V2 of the kit)

- Do not trust any pictures from Sainsmart on the wiring. You need to check each wire yourself if it connects to the right thing

- Text descripton of wiring connections above in this instructable is correct for the robot itself. But the position of the wires on the boards is different since boards are not the same as the pictures. See my pictures below for help

- For me it was NOT enough to add solder to the pins of the 3 blue pots (legs are too thin). If felt like they fitted but there was no connection. Check the values in the serial monitor. If they do not change when turning screw you have a problem. I ended up soldering proper logs on the blue pots and then they started working.

- The holes in the top-plastic plate of the robot does not fit the Arduino board at all (only one screw has right position). This means high risk of shorting stuff if it slides when the hole contraption topples over. I drilled two new holes in plastic top-plate and now boards stay put

- For correct wiring of the Remote use manual from V3 of the robot:

- The code in this file "SainSmart Instabots Upright Rover" (Sainsmart V2 product page) is not perfect but should get the robot going. Look in video of this instructable above for adjusting the 3 pots and choose the right values

For testing the robot

- Start without remote until robot is fully working and balances

- It will drift a bit on its own and sometimes fall over. This is due to code sample is trusting that angle=0 means exactly upright. This is not always true

- you can fix that yourself with some ongoing dynamic offset calculations but out of the box the robot should kinda balance most of the time

Despite the somewhat iffy manual and holes being in the wrong place, I had a lot of fun building this, so for me it was great value for money

ΠαναγιώτηςΚ (author)2017-04-25

Sorry for posting it here, but there was an instructable about the 6dof+remote combo for sainsmart that has been taken down and im looking for the working code like crazy. If anyone made the project please contact me cause all the code sainsmart provided didnt work properly.

abderrahmenpianic (author)2017-04-09

where is the code !??

KennyL15 (author)2016-03-27

Regarding the software code that is provided by sainsmart for our balance bots - need to be aware that the 'sampling time' had been set to 0.08. I decided to choose 0.001, which I assume to have units of seconds. As mentioned in a previous post, the "

lastTime" parameter doesn't appear to be initialised. So the intialisation should be something like:

unsigned long lastTime = 0;

And it also appears that the "lastTime" parameter is probably the same as "preTime". So the part that says:

float dt = (now - preTime) / 1000.0;
preTime = now;

Could be changed to this:

float dt = (now - lastTime) / 1000.0;
// preTime = now; // (remove this line, preTime = now;)

Also notice that the units of 'dt' is in seconds. But the line that says:

timeChange = (now - lastTime);

has units of milliseconds.

And the line that says:

if(timeChange >= SampleTime){

appears to be comparing 'timeChange' (which has milliseconds units) with 'SampleTime' (which has units of seconds). So something appears to be messed up here.

Next, the lines:

Input = f_angle;
error = Input;

should be changed to:

Input = 0;

error = Input - f_angle;

The next part is really weird..... the part that says:

errSum += error * timeChange;

It's weird because 'error' has units of degrees, while 'timeChange' has units of milliseconds. So the units of 'errSum' appear to be in units of (degrees x milliseconds).

Finally, as mentioned in a previous post, if you want to use a potentiometer for setting Ki, then the line:

//ki = analogRead(A3)*0.001;

needs to be changed to:

ki = analogRead(A1)*0.001; //ie. the analog pin should be A1, not A3.

eamonduffy (author)KennyL152016-12-26

Any chance you could post your whole modified code for us to see what you have done?

khorn99 (author)2016-02-19

I purchased the SainSmart InstaBots Upright Rover Kit Pro, and have had numerous issues with over 20 useless email exchanges with them, with no result. Still no working product.

The first thing I noticed when unpacking was the terrible quality of the boards, socket were not aligned the connector pins usually 90 degrees to the board were at all different angles, some about 80 degree. On first go it was impossible to get the Mega expansion board to line up with the Mega board. I had to get long nose pliers and adjust all the pins, some off by10 degree. After about 30 minutes the 2 boards could go together. Repeated process for the UNO expansion board. Immediate impressions, this stuff is junk.

After fully assembling the kit neither the remote nor the Rover worked. So started debugging, pulled it all apart.

First I could not program the remote UNO. I eventually discovered that the expansion shield when connected to the UNO, stops the UNO USB port working ? I downloaded the program without the shield on. I tested the expansion board on a Funtronics UNO and the same issue, the usb port stopped working.

Issue 1: So the UNO expansion shield is faulty. I replaced the SainSmart InstaBots SS-SBR-2.0 Sensor Shield with another brand I had at hand.

so down $6.11.

Next once the program was downloaded the LCD screen was garbled, junk characters. I started to try different libraries and eventually found one that worked. The code and library provided does not work, as this LCD comes from various manufacturers, this was not a Sainsmart board provided.

Issue 2: LCD library and code not for the board provided.

Next the Rover. I had connected an 11V external supply and the motors did not work. I traced through the circuit and found the regulator was only outputting 2 Volts. Having circuit diagrams for this boards would help been a great help and maybe I could have repaired it. But no circuit diagrams on their site, pathetic. The absence of SainSmart documentation is unbelievable. Compare this to other reputable providers such as Funtronics. I had a Duinotech brand L298 board and got that going, just to check the code and connections, all OK, motors work.

Issue 3: The SainSmart Protoshield Shield Mega expansion board is faulty. so down $11.99.

I Expected 1 hour work to get this going and now I have nothing. Only due to a very poor quality kit. With over 30 years of electronics this poor quality is unbelievable. A series of emails to their support provided absolutely ridiculous and laughable advice.

Finally they agreed to replace the fully parts only if i returned the two faulty boards to China. Given I have spent over days debugging and testing their poor quality parts I find this ridiculous. It will cost me more than the kit itself to package the goods, take to post office, take time off work and then send. Other reputable companies, e.g. Funtronics etc just replace goods without waiting for returns.

I also cannot believe that Sainsmart do not provide circuit diagrams for any of there products making them mostly useless. As a result I am going to buy another brand proto boards and just make up the plugs and motor driver. At least I then know the circuit for future expansion.

So now trying to get my money back. My advice is not to buy this kit or any products from Sainsmart as the chances they are faulty are high. I just cannot believe 2 items faulty.

The customer service is a joke, I never once got any technical help from them. USELESS !! Now their support has gone totally silent on me.

I really empathised with the story below that had the regulator fall off the board in the package. This sums up the quality on their products.

AndrewS263 (author)khorn992016-09-29

Amigo comprou o Kit Pro também, eu estou tendo o mesmo problema, mas ele não sabe resolver. Você poderia me passar o programa de e-mail e visualizar a biblioteca? Agradeço antecipadamente.

khorn99 (author)khorn992016-02-19

Forgot to mention that while trying to get the Meg shield on the board I saw that the motor plug pins short onto the top of Mega USB connector. So I filed them down and covered with insulator. I guess many people would get caught with this and short circuit the power. Some thing they don't bother fixing or telling poeple about.

OresteC (author)2016-05-15

Hello everyone! I quickly mounted version 2.0 robot with three trimmers, to be clear, I have uploaded the files on the robot and on the joystick, all right up there. the problem is that the robot is uncontrollable, the engines still running and I can not keep him straight in the self-balancing. I read here in the forum that the downloaded file Sainsmart there are mistakes, if someone can kindly post the files and if you can eliminate the three trimmers, and because when the robot is in the horizontal position, the controller remains in wait? Thank you in advance and I send you my greetings.!

mimunozt (author)2016-05-12

Hi, I assemble this kit buying the parts and building the chassis. So far so good, except that the link between 24L01 constantly lost and recovered, making it impossible to maneuver the robot. I still have no definitive cause, but may electromagnetic interference generated from the engines, is damaging the link.

Anyone have any experience with this fault. It is able to solve this by installing capacitors between the motor terminals? Any ideas?

Tiger001 (author)2016-04-01

I am very grateful for the help I received thus far, but I ran into one more problem. The remote came with a LCD display, and I do not have a clue how to wire this in. Could you please help me with this?

KennyL15 (author)Tiger0012016-04-02

In the pdf manual....

Photo 'D' shows you the back of the LCD panel, and shows where to connect the wires to the 'shield'.

alojds (author)KennyL152016-04-08

hi nice project man i buy it and it's really nice , and i have some questions could you please help me

Tiger001 (author)2016-04-01

The instructions say nothing about the robot's battery. What type of battery do you recommend?

KennyL15 (author)Tiger0012016-04-01

Close to 12V DC battery is recommended. I chose to go with a

"Fire Bull 11.1V 3300mAh 25C 3S Lipo". But I seriously recommend using a safety Lipo bag for both charging and storing these Lipo batteries. They have high energy in a small case. So if anything fails inside them, they're known to burn down houses etc. If you don't want to go down the Lipo path, then could just make up a battery Nimh battery pack that gets you to about 12 V DC.

Tiger001 (author)KennyL152016-04-01

Thanks. I got the battery you recommended, LiPo bag and a charger ordered.

KennyL15 (author)Tiger0012016-04-02

Most welcome Stuart. Have fun with the bot. These things are definitely great to play and tinker with.


Tiger001 (author)2016-03-31

The sensor shields that came with my Instabot are different from those shown though they are still made by SainSmart. The photographs of the wiring in the remote control are poor so I can not read what wires go where on my shield. Could somebody let me know in words how to wire this similar to the way it is stated for the robot wiring?

Thank you


KennyL15 (author)Tiger0012016-04-01

True. The factory instructions could certainly be polished up a bit. Anyway, for the left joystick, you have GND, +5V, Vrx, Vry, and some other pin that won't be used. Those pins can then be connected (using wires) to G, V, A1 and A0 (in that order) on the shield. G stands for GND. V stands for supply voltage, and A1 and A2 will be the analog inputs.

The right-hand joystick will have the same pin format. Connect them to G, V, A3 and A2.

Tiger001 (author)KennyL152016-04-01

Thank you very much

JohnB478 (author)2016-03-30

Is this the proper place to discuss the Upright Rover Kit Pro Updated with the Upright Rover 3.1 software?

KennyL15 (author)JohnB4782016-03-30

I think this instructable is based on V2 and below. I got a V3, but haven't assembled it yet. But I reckon there will be differences - since V3 has some wheel encoders added.

JohnB478 (author)KennyL152016-03-31

Thanks for the reply. It appeared to be only about the V2. I have 2 V3's and they are both partially working. I found some bugs in the software and wanted to pass them along.

I am still working on the Gain and PID settings. I occasionally see oscillations near upright.

One of my units had a defective MPU-6050 board. I ordered a new one to replace it and that solved the problem.

KennyL15 (author)JohnB4782016-03-31

Most welcome! Thanks for the heads-up about some issues in their code.
Was surprised to see that they packaged their software by bundling the
Arduino Sketch 1.6.5 r2 in there. I wonder if that's even legal. Plus their software download is like 122 MB!!

KennyL15 (author)2016-03-29

Just want to add that - in the stock software code provided by sainsmart - the "if" statement, ie. "if(timeChange >= SampleTime)" might as well not even be there. This is because 'timeChange' is in units of milliseconds, while 'SampleTime' is in units of seconds..... so timeChange will be a huge value in comparison to 'SampleTime'. This means that the 'if' condition will always turn out to be true, so might as well remove that 'if' statement. This brings about a very interesting thing. If the value K is set to 1, then the stock code actually works quite well. It works nicely, but probably not in the way that the author intended - especially since the units of timeChange and SampleTime are not even the same. This sort of indicates that the author produced a code that actually works, but perhaps not realising 'how it works'. It appears that the "if(timeChange >= SampleTime)" condition is going to run every single time (as already explained). This would mean that the time steps will actually be much smaller than 'SampleTime' (due to the coding mistake). Therefore, 'dt' is going to be tiny. And, if assuming that the initial value of 'f_angle' is zero, then the equation:

f_angle = A * (f_angle + omega * dt) + (1 - A) * r_angle;

will actually reduce to:

f_angle = (1 - A) * r_angle;

And if K = 1, and if SampleTime is chosen to be 0.001 seconds (which is what I chose), then the equation can be further reduced to approximately:

f_angle = f_angle + 0.001*r_angle;

But since there is a coding error in the code, where the author sometimes forgot to convert to units of seconds, the choice of K = 1 and SampleTime = 0.001 has the effect of compensating for the coding error (milliseconds versus seconds). This means that the author's value for 'error' and 'errSum' are larger than they should be by a factor of 1000. And 'dErr' is smaller than what it should be by a factor of 1000. However, it seems that such 'coding mistakes' in the values can be compensated for by setting suitable values for Kp, Ki, and Kd.

RichardB24 (author)2016-03-13

Hi all, I have the V1 of this robot and have assembled it but cannot get the KP, KD, and KI values right to make it balance. Does anyone have any advice on what they should be(e.g. what affects what they are) or how long it normally takes to get the right ones(I have spent an hour already).



KennyL15 (author)RichardB242016-03-16

Make sure to keep the serial baud rate set to 115200 baud. Because even if you're not using wireless communications (for the moment), then setting a lower baud rate actually slows down the arduino system, and things will tend to be uncontrollable. Setting PID values usually shouldn't take long. Start with zero values for all 3 parameters. Then increase Kp until you get fairly zippy activity. But don't overdo it. Then increase Kd until some nice corrective control behaviour is achieved. Only use very small values of Ki.

But before you do all those adjustments, you need to make sure that the motor voltage offsets are set to some suitable values, so that the motors will at least move when a control voltage is applied to them. That's to overcome 'deadzone' effects. Also, some calibration should also be done for the angle measurements, which is why they include an angle offset for accounting for fixed error in the two-axis angle measurement method used in the software.

RichardB24 (author)KennyL152016-03-18

Hi, I did what you said(zeroing all the values and then increasing the Kp value) but I could not fairly zippy activity where it was even sort of balancing, it seemed to be able to balance itself when it was going forwards but when it started to fall backwards its motors would would go extremely fast and then it would just fall over.

I calibrated the MPU6050, but I am unsure how to find the correct values for the motor voltage offsets the motors at there default value the motors move when the robot starts to fall so I am unsure what I am looking for when I change their values



KennyL15 (author)RichardB242016-03-19

For the time being, you could probably just leave the motor offsets as-is, such as '20' for each motor. As for zipping too fast, I just have all parameters at zero, then I use the screw driver to wind up the Kp value until the wheels just begin to turn (while manually holding the bot above the ground and having the bot tilted), then I put the bot on the floor, and gradually increase Kp until the bot tries to balance, then will just add a tad more Kp to get a bit more response from the motors.

A good Kp setting will certainly allow the robot to balance by itself - but with a wobbling behaviour. It will still balance and not topple over in any case. If your bot isn't balancing in one direction, then it'll be necessary to see if all your MPU6050 sensor readings are giving out sensible values. If they are good, then the issue will be in the other hardware and/or software.

The software that comes with the sainsmart bot is pretty good. Although, I do notice that who-ever wrote it was a bit sloppy by not initialising "lastTime". This is referring to the line of code. "lastTime" is used in the code, but is never initialised to say "0" or anything. It probably doesn't matter, but I'm thinking that if they're going to introduce code to everybody, then they should get it right first.

unsigned long lastTime;

Also, in their code, they commented out the line:

//ki = analogRead(A3)*0.001

.... but, if somebody wanted to make ki settable with a potentiometer, then the "A3" variable should actually be "A1". So that's pretty sloppy as well.

For testing, what you'll need to do is to make sure that your 'f_angle' value is around 0 degrees when you hold the bot roughly vertically in your hand (off the ground). If you tilt the bot slightly in a +ve degree angle, then the wheels should start spinning one way, and when you gradually make the bot go back to a vertical position, then the wheels should slow down again, and if you tilt the other direction, then the wheels should spin in the opposite direction. If it does that, then you're on track to getting nice controlled balancing action.

RichardB24 (author)KennyL152016-03-19

Hi, I tried what you said, lifting the bot up and then winding the Kp up until the wheels begin to turn then placing it on the ground and gradually increase the Kp value but I could not get it to a stage where it be considered balancing I brought the Kp value up to about 110 the wheels move in the right direction when the bot is turned but it seems to continually go in that direction sometimes and then just crashes over, this more so happens when it is falling forwards rather than backwards. I checked the values from the MPU6050 and the ax and the gx value looks a little strange with sometimes them increasing considerably in value. I kept the robot roughly stable while I was collecting these values, and this dropping and rising considerably in value continued through out the rest of the data.

ax = -420 ay = 604 az = 14944 gx = -292 gy = 624 gz = 1255
ax = -200 ay = 328 az = 14920 gx = -233 gy = 622 gz = 1270
ax = -396 ay = 684 az = 15308 gx = -292 gy = 701 gz = 1300
ax = -636 ay = 552 az = 14952 gx = -296 gy = 700 gz = 1299
ax = -360 ay = 444 az = 14716 gx = -218 gy = 684 gz = 1298
ax = -12 ay = 492 az = 15200 gx = -256 gy = 732 gz = 1317
ax = -324 ay = 656 az = 15132 gx = -291 gy = 835 gz = 1361
ax = -120 ay = 660 az = 14776 gx = -187 gy = 954 gz = 1302
ax = -68 ay = 500 az = 14948 gx = -88 gy = 1025 gz = 1234
ax = -388 ay = 504 az = 15200 gx = -109 gy = 1276 gz = 958
ax = -764 ay = 376 az = 15060 gx = -39 gy = 1616 gz = 475
ax = 320 ay = 772 az = 15308 gx = 134 gy = 1387 gz = 263
ax = 368 ay = 172 az = 15092 gx = -71 gy = 1705 gz = 1185
ax = -1240 ay = 480 az = 15144 gx = 19 gy = 1692 gz = 823
ax = -1712 ay = 768 az = 15620 gx = -39 gy = 1384 gz = 329
ax = -468 ay = 1688 az = 18756 gx = -579 gy = 1430 gz = 447

I did calibrate my MPU6050 using this script, and I changed the Angle_offset value so that at a roughly vertical position the f_angle was around 0.

KennyL15 made it! (author)RichardB242016-03-26

Excellent work Richard. Yep...... looks like the readings are having an issue. I reckon that once you sought out that issue (eg.... by testing with another MPU6050 or completely compatible MPU9150, your bot will then work excellently.

You may or may not have a failed MPU6050......but it looks like that is the source of the problem right now. Ax and Ay are going crazy. We need Ay, but don't need Ax. Looks like Az is giving sparse values too. Mine has variation too, but nothing like the variation in yours. I'll give examples of mine (from my MPU9150, which is directly replaceable). Once you get things going properly (with good readings), then I recommend - to begin with - set a K value of 0.98, so that the estimated angle relies almost entirely on gyro angle measurements at the beginning of a set of measurements. I use:

float K = 0.98; //instead of 0.8

And, also set a sampling period of 0.001 (instead of the default 0.08)

float SampleTime = 0.001; //normally 0.08

I also choose not to remove power from the motors at any stage, so I modified the code slightly to things like this:

if(LOutput >= 0){
digitalWrite(TN1, HIGH);
digitalWrite(TN2, LOW);
else if(LOutput < 0){
digitalWrite(TN1, LOW);
digitalWrite(TN2, HIGH);

if(ROutput >= 0){
digitalWrite(TN3, HIGH);
digitalWrite(TN4, LOW);
else if(ROutput < 0){
digitalWrite(TN3, LOW);
digitalWrite(TN4, HIGH);


I took some photos of my bot just to show you. The bot is standing on my old EA (Electronics Australia) bench supply. The bot is currently being powered via a 12V, 2 Amp AC/DC adapter supply (with the yellow strip sticker). The bot is standing perfectly still - thanks to the help of the tiniest bit of resistance (anchoring) by the small power cable. The bot is able to stand motionless by itself on carpet too, thanks to some dampening effect from the carpet. It balances very well (but not absolutely motionless) on hard floor. But I'm certainly happy with what it's doing for now.

Some of my raw values from MPU9150 below: I actually took lots more samples, but better not pollute the discussion page with too much data. The samples certainly don't jump from say 200 to say 1000 etc.

1 -284 240 16756 75 -173 382
2 -272 320 16820 91 -224 394
3 -252 264 16944 76 -199 365
4 -260 240 16944 93 -207 389
5 -248 172 16904 70 -212 365
6 -336 200 16820 66 -202 400
7 -304 260 16876 85 -190 388
8 -280 280 17032 61 -188 370
9 -200 116 16752 82 -199 376
10 -276 336 16784 64 -222 353
11 -288 200 16812 82 -204 402
12 -348 248 16944 84 -186 388
13 -204 252 16804 78 -177 387
14 -212 292 16832 69 -219 395
15 -268 352 16904 98 -199 376

KennyL15 (author)RichardB242016-03-20

Hi Richard, I made a very short video today of my bot to show you what you can expect once you've got the sensor readings sorted out.

RichardB24 (author)KennyL152016-03-21

Hi, thanks for the video. I was able to get the MPU6050 ay's fluctuations down to the same as yours however I was still unable to get the robot to balance, I did notice however that it appears that a larger angle was needed on one side of the robot to get the wheels to move in that direction than on the other, I tilted the bot and on one side the angle decreased faster than it increased when tilted the other side

eamonduffy (author)2016-03-07

I just built a second one with bigger motors and and a bigger base

Has anyone done anything with sonar sensors for object avoidance ?

jimkan (author)2014-09-27

Just finished building the robot, wired everything correctly but when power on the robot both wheels started to spin, tried to adjust the pots but still can't stop the spinning. In monitor I can see the kp and kd values are changing. if lay down the robot both motors stop. what's wrong?

mylemonjuice (author)jimkan2014-09-28

Hey bro! You just did a good job! And about your problem, I think you should put the 24L01 wireless module on the shield and everything will be OK!!

XuanW (author)mylemonjuice2016-03-02

Hey mylemonjuice, I face the same problem(two wheels just keep spinning) as jimkan's and I have put 24L01 wireless module on the shield. But still have the same problem:(

teqmo (author)mylemonjuice2014-10-25

I think my wireless module must be broken because the wheels just turn

jimkan (author)mylemonjuice2014-10-01

Initially I thought the wireless has nothing to do with the balancing but after inserted the wireless module wheels stop spinning, I was able to tuned the kp, kd and ki and make balanced, using the wireless controller works but there must a speed control in the code to slow down the bot or it will stumble, currently I move the robot forward with joystick and quickly move it backward to slow it down. btw, you need to reverse the A0 and A1 in balancing_remote code to make it Y axis for forward and backward, the default is X asix (side way).

Joystick_1_X = analogRead(A1);

Joystick_1_Y = analogRead(A0);

Hi, I have the same problem even after connecting the wireless module. same thing motor spinning all the time in one dirction . any advice?

PatrickM17 (author)jimkan2016-01-11

You probably have to adjust offset gyro

teqmo (author)jimkan2014-10-25

i have the same issue

KennyL15 (author)2016-03-02

Back again. I've now found that this balancing bot kit with the 3 potentiometers actually works "a little bit" (including the software that is provided). Although, I must say that somebody out there (eg.... the manufacturer of this bot kit) needs to tell people what's going on with the '3' potentiometer' story, while the currently broadcasted instructions (and software) makes use of just two potentiometers (one for setting proportional gain Kp, while the other sets derivative gain Kd). The remaining potentiometer that is meant to sit in the middle was supposed to be used to set integral gain Ki, except this value is now manually set in the software (so that the manually set value is currently Ki = 0).

After putting this bot together, my recommendation is to duplicate the provided arduino sketch software, and get rid of all the motor controlling code, and then add some of your own simple code so that you can monitor the basic accelerometer and gyroscope values coming out from the MPU6050 accelerometer/gyro board. That is.... use some serial.print and serial.println commands to print out ax,ay,az, gx,gy,gz, r_angle, f_angle, omega, kp,ki,kd. Then at least we can check the values to see if they're good or not.

Also, my recommendation is - instead of using the 'serial monitor' window of the arduino sketch software for inspecting serial data coming into the computer (via USB), it is better to use another software, such as the free PuTTY (for reading serial information). This is because I notice that the arduino sketch serial monitor window can't handle the bombardment of incoming serial text information. The arduino sketch serial monitor window just locks up from the bombardment of incoming text, where-as PuTTY seems to just keep receiving text without freezing/lockups.

An issue that I encountered was that the supplied MPU6050 was showing y-axis accelerometer value (ay) of +32767.... and it was stuck at this value (permanently). All other values ax, az etc looked fine..... as they actually changed values when the bot was manually tilted etc. This suggested that the MPU6050 was faulty. I have a bunch of MPU9150 boards, which is conveniently directly pin compatible with the 6050 board. I took out the MPU6050 and put in the MPU9150. No more issue with the 'ay' reading. I then checked the suspect 6050 again. Same issue. The 6050 was busted for sure. So it was no wonder that the bot inclination angle obtained by the software was wrong.....because the values for 'ay' were stuck at +32767. Hence the importance of making sure the sensors (accelerometer and gyro readings) are putting out expected values.

I haven't got a battery for this bot yet. Ordered from ebay, but not yet arrived. So I'm currently powering up the motor with a bench power supply (set to about 12 Volt DC). I used alligator clips to connect to the 'T-connector' - making sure that I use the correct polarity, and making sure to handle the bot carefully so as not to cause power supply short circuits. It's sort of a precarious situation, but it was ok by me for testing.

Without carrying a battery, the bot is balancing a bit, with Kp of 26, Kd around 3 to 4, and Ki = 0. I only just got the bot to do the balancing act about 15 minutes ago - with the power supply wires still hooked up. Precarious situation with the power supply wires connected like that. I will wait until the battery arrives before doing any more tinkering.

For this bot, I was testing it without the remote control. So the bot was trying to balance on its own. The wireless remote control was left unpowered. In fact, I haven't even tested the wireless communications yet - which reminds me that it is a good idea for the manufacturer to give users diagnostics software to test the wireless communications side of things - just to make sure everything is ok in that area.

My comments...... the bot can be made to balance. The instructables video shows it working, so at least everybody knows that the kit should function more or less eventually. What surprised me is not too many people in the thread came back to say '100% working'. My opinion about the kit. Not too bad in itself, but a better procedure needs to be put together for everybody to follow. And need to include advice for trouble-shooting.

Another important comment is that it is not possible to use every metal screw and metal hexagonal post (standoff) in the way that the bot assembly procedure indicates. It's not possible to do that - because some screw holes in the UNO board are too close to plastic headers. And some metal hexagonal posts will cause short circuits. The solution is to use nylon/plastic screws and nylon/plastic posts whenever you see fit. Sides of nylon screw heads can be clipped/snipped using toe-nail clippers, so that the screw can then be inserted right next to a plastic header. You may need to get the nylon screws etc from a electronics store.

Also, I mentioned that the kit didn't have any screw that was long enough for mounting the wheel brackets. Fortunately, I had my own screws that were long enough. So, there's certainly room for improvement in terms of supplying the right parts for the right job.

I previously mentioned that I noticed (in the instructable photos) two do-it-yourself pins poking out of the GND and 5V terminals of the header of the L298N h-bridge motor controller circuit board. I figured out that these manually inserted 'pins' (which doesn't come with the kit) are simply used for linking (using wire) with the Vcc and the GND terminals of the sensor shield board. The L298N board is supplied with 11.1 Volt, but the L298N also has an onboard regulator circuit, which develops a regulated 5V output. This 5V can then be used to power up the sensor shield board. So my opinion about those do-it-yourself pins..... that's one way to do it. Another way would just be to have two ground wires coming out of the GND terminal of the L298N board, and have 1 wire coming out of the 5V terminal.

I also notice that the legs of the potentiometers are very skinny, and do not match the wider holes of the sensor shield header. I think that it'll be necessary to solder the potentiometer legs to thicker pins, or come with with a plan to ensure good electrical contact with the sensor shield. At the moment, the loose-fitting potentiometers can lead to Kp and Kd values changing unexpectedly.

One more comment - to finish on a good note, it was noticed that when this bot is powered up through the USB cable only (no other power source connected), the bot was still able to spin 1 of the wheels in the proper control direction. It didn't have enough power to spin both wheels, but it was nice that USB power could at least get a wheel to turn and see the control action whenever we tilted the bot.

mylemonjuice (author)2016-03-01

i found that the code on the sainsmart website is wrong for the latest V3. there are two kinds of V3, they have different motors so they have different PID value. ask the stuff for the right codes for the right version.

KennyL15 (author)2016-02-29

I'm just toward the end of assembling this Sainsmart balancing bot. I'm building the version that has the 3 potentiometers. I'm following these instructables instructions, and just reading the various comments in this thread, but can't help wondering - has anybody actually ever got this balancing bot to work properly? I mean, like - fully functional? From these thread comments, it just appears that nobody says something like 'hey! perfectly now!'. I am seeing comments like 'ok....balances, but something isn't working after a short while'.

Anyway, one comment I have is - there appears to be a lack of a proper instruction manual. Another comment - the instructables procedure photo is visibly showing 2 do-it-yourself pins poking out the GND and the 5V header of the L298N dual H-bridge circuit board, which doesn't appear to be discussed anywhere in the procedure.

The 'sensor shield' that came with my kit isn't the same as the one in the instructables photo. Mine has a logo on the shield board that looks like an alien wearing a white space helmet or something.

The procedure also doesn't tell people to pull out and remove the jumper pins on the L298N board.

Also, we are supplied with metal screws and metal hexagonal standoffs posts - to be installed on the Arduino UNO. The issue here is that 1 of the metal screws won't fit into one of the UNO holes, because the surrounding plastic headers get in the way of the metal screw head. And the metal post actually creates a short circuit on the underside of the UNO. Therefore, it's necessary to get (from somewhere) a nylon screw, and modify its plastic screw-head by snipping off bits of it. And then use a nylon hexagonal post, which prevents short circuits.

Furthermore, there were no metal screws that were long enough to mount the two metal wheel brackets, so I needed to use my own screws. So the point here is that the kit is not really complete. I'm just hoping that my bot will actually work properly, especially since I can't see too many people indicating that they got theirs to work properly.

It might help if the instructables procedure shows how the battery is meant to be installed in the bot.

I'm glad that this instructables procedure in this thread shows fairly clearly how to put the bot together. I'm thankful for that. However, the instructables photos show 2 potentiometers, while the kit has 3 potentiometers. And the video indicates that only 2 potentiometers are set (for setting proportional gain and derivative gain), while integral gain is set by software. Some inconsistency going on here in the instructions, especially since the video even starts off by indicating '3' potentiometers....but we only hear of 2 being used.
Fingers crossed, and wish me luck. I think I'm going to need it. I'll make sure to report back if the bot is actually 100% successful. Thanks.

eggsalad (author)2016-02-23

Hi everyone,

just built the v3 and after getting through lots of missing hardware,a bad balance shield and a few other issues I am trying to program the boards.

my problem is when I go to verify or upload either the controller or robot code it says error compiling....and in sub notes it says fatal error no such file or directory #include<mirf.h>

I know everything is set up right as I can select a blink sketch and download it on either of the boards fine.

any ideas? I may be missing something very obvious as I'm newer at this

thanks in advance

ashleywebb76 made it! (author)2016-01-31

Hi! I am so glad to find there is an active forum for this project ?

The regulator (pictured below) was loose in the package. Should I solder it back on? From the back it looks like it was attached with an adhesive. I’m fine with doing it myself, though my only soldering experience is on wire and battery connectors.

Ive got a 3 cell 11.1 Lipo and have wired a xt60 connecter to the VIN and ground. Im worried to connect it and fry anything. This is my first arduino project.

Thanks so much!

FlyinBob (author)ashleywebb762016-01-31

That regulator should have been soldered -- looks like a factory error. I suspect that the 'adhesive' was to secure it to the board as a heat-shield. You could solder it yourself if you have a fine point soldering iron and some good solder. Your battery hook-up looks OK.

ashleywebb76 (author)FlyinBob2016-02-21

I received the replacement board from SainSmart, which is very similar but has some differences. It does have the 3 potentiometers, the h bridge, MPU6050 and 24L01 so it seems like its made for similar functions as the original.

My main concern is that the power connector does not indicate which connection is hot and which is ground. I just picked up a multimeter but have never used one and haven’t found any videos specifically showing how to determine the polarity. Any advice on determining which way the plugs would be greatly appreciated ?

I did solder the regulator on as you suggested and was happy with it but then realized that an m7 diode rectifier was also missing (see picture) so Ive just been waiting for the replacement board from sainsmart. I did have to wait for it to come from China but they shipped it the day after I contacted them, with a tracking number and I didnt have to send the original board back.

I’ve learned a ton I wouldn’t have without the problems but hoping to get it up and running now. Thanks again for your help!

About This Instructable




More by mylemonjuice:SainSmart InstaBots Upright Rover(Self-Balancing Robot With Arduino)
Add instructable to: