How to stabilize a Segway using Arduino, MPU6050 and Sabertooth 2x32 ?

I'm new to programming and this is my second project. Currently I have completed the mechanical design and fabrication. The wiring has been completed but when I switch the main power ON, the left side motor starts spinning at max speed. Can anyone please comment on this issue?

Picture of How to stabilize a Segway using Arduino, MPU6050 and Sabertooth 2x32 ?
sort by: active | newest | oldest
iceng1 year ago

Looks like you really did a cool job of the Segway.... Could you show how you gear the wheel to the motor. I'm wanting to make an outboard one wheel pusher for my land sailer for those dead wind afternoons with a wheel just like that..

I'm guessing you are not an electrical engineer.... Rick has given you excellent advice... Software is developed one item at a time until it works flawlessly... Start with one motor turn it on turn turn it off, change direction.

Next write PWM (Pulse Width Modulation) means turning the motor on for a moment then off and varying the on/off ratio for speed control, also useful for lowering the inrush current ie extending battery life...

Eventually you will have to learn how to estimate the rider mass = weight to avoid user road burn on the first half wheel turn, but don't worry about that now, that's a long way later from now.

Please do the motors for a start, and good luck...

There are a whole load of them out there - called generally Bike pushers


I considered one for my Recumbent bike.

Thanks for the great pointer... My wheel is bigger and a super quiet exhaust muffler.... Just because the wind wants to avoid me.


Ah is it a blokart look alike or an original?

I sailed a Blokart in New Zealand - fery exciting - I wish we had open beaches where I could do this in the UK.

No offense but if you already know you are a beginner, why not with projects at your level and work your way up? It called learning by doing ;)
As general opinion from my side in regards to help requests:
You can only get advise as good as the details you provide - the rest is only guesswork.
Meaning that all we have to go by is a single pic, a quite meaningless error description and no code, no wiring diagram, no parts details.

As others already said, start with one motor, get the programming right and understand what exactly is happening.
Then try simple directional movements with two independent motors.
Once that is all working fine you can start thinking about how to use sensors to keep a fixed position - and so on...

But if I am not mistaken then I see a pair of scooter motors in the base - that won't work for sure.

Kiteman1 year ago

If you want to see how other people have solved similar problems, have a read through these projects:


rickharris1 year ago

Over and over again we say to people learn to walk before you can run. Start small and build up skill and knowledge, in a case like this build a model so you can work out the control algorithms and basics before launching full sized.

This is a very ambitious project even for experienced programmers.

You should look at how to control your motors, just turning them on and off control direction and then look at PWM to control speed.

You should look at how to read the data from the accelerometer and gyro.

This is so complex no one is going to be able to give you sensible commentary here in a few words let alone fault find on something they haven' t seen.

However some logical checks to make.

Disconnect all inputs to motor driver is it still turning if so motor drive suspect.

Swap left and right signals and parts to see if fault swaps indicating where the fault lies.

Make the best use of you multi-meter to measure what is happening. Most signal levels can be measured easily although PWM is difficult.