Easy build self balancing electric skateboard

Picture of Easy build self balancing electric skateboard

What is it?
Twin wheeled skateboard that works like a Segway.  Electric skateboards exist already with powered rear wheels. Plan here was to build something like a Segway but in the form of a skateboard. It knows which way is "up" via a combination of gyroscope and and accelerometer sensors, using a complementary (not complimentary) filter which reads and combines data from both 100 times per second. Steering by a simple rocker switch in hand controller (or a rewired Wii-Nunchuck as in photos if you are more ambitious).
Upper photo is original budget version with two lead-acid batteries and solid wheels. Lower photo is 2013 not-so-easy-build version, with pneumatic tyres and Headway LiFePO4 batteries just to see how far I could push this overall concept. More on the new one is here:

UPDATE regarding IMU's and CODE (14th March 2014):
This Instructable is a little old now and the IMU used is no longer available. Therefore I have removed the pages that describe the IMU wiring and the code as it is confusing people.
I have just left those that refer to power controller, physical construction and the motors.
For the balance control system please now see this newer Instructable of mine  that describes how to wire up recently available analog IMU's to an Arduino, with code here:

If you have a digital Sparkfun 5dof IMU (which is much more easily available) then for instructions on how to use this with an Arduino, to control a self-balancing skateboard, with code, then look at this new Instructable of mine here:

March 2014: I have finally managed to get this to work using a modern DIGITAL IMU from Sparkfun. This is important as the old analog ones are almost unavailable now. See above for links.

Can I buy one ready built?
Well, looks as if you now can. The German S-Walker looks strangely familiar somehow.

How does it stay level?
It controls the wheel motors so the wheels always stay under your centre of balance, like balancing a broomstick on your fingertip. This is called a "PID" control system and is used for all sorts of control situations. Think of the 363 feet high Apollo rockets used in the moon landings..........
Q: How come they didn't just fall over when they took off? They took off incredibly slowly for the first few seconds, tailfins would have no effect, far slower than Shuttle launches. Watch this video - it takes a full 10 seconds just to get to 100m and clear the launch tower:
A: They had engines mounted on swivelling mounts hydraulically controlled by a PID control system (lots of analog electronics I think involved too). First stage projected guidance system failure rate was approx. 1 in 256 which was considered an acceptable risk (!)

In 2008 I saw a YouTube video by Ben Smithers of his one-wheeled self balancing skateboard whizzing around a car park in Norwich UK.       Video:
It turns out he was a Lotus cars controls system engineer - which makes sense.
Also see Trevor Blackwell's site:
Meanwhile I wanted to teach myself microcontroller programming and, totally underestimating the task, thought this would be a great fun way to do this. Advantage of two wheelers is that they turn more easily and can turn and balance even when stationary - which is fun. I prefer skateboards to segway clones as you just jump off if it goes wrong without tangling in the handlebars.

Why an Instructable?
Having learned lessons the hard way I thought it would be worth redesigning the project around an Arduino microcontroller, then seeing how low-cost and easy-build I could possibly make it. Something like this is not for the complete Arduino beginner, nor is it that "easy" however this is about as easy as a self-balancing machine is realistically ever going to get.

Projects like this lend themselves to being built as a team. Some examples below were built as college projects. There are
i) some electronics (not making circuit boards, just wiring and soldering) to master,
ii) some mechanical fabrication; this version is designed to require no welding, just nuts bolts and some woodwork. Wheel/sprockets/axles/bearings come as a unit (electric scooter rear wheel assemblies).
iii) some programming; the programs (Arduino sketches) you need, including those to help debugging, are attached (P43 - 47).
There are; IMU tester, motor tester, balances-nothing-else, rocker switch steered and potentiometer steered code examples.

How much does it cost?
I realised when costing them up that the cost of a self balancing robot would only be a little lower than that of a ride on machine, therefore I went for a ride-on machine! For me the cost was about $300 equivalent PLUS whatever batteries you choose to use. I recommend starting with lead-acid batteries then make improvements later once you have a working machine. 

Why do it?
i) For the challenge of doing something original. Segway skateboards have been invented in principle BUT there is huge room for improvement.
ii) Making something that is practical and intuitive to ride is quite a challenge in terms of both electronics/software and fabrication/packaging. Cannot all be done on a computer. Eventually you have to actually build something then incrementally improve it. Despite the myth of "Eureka" moments, the truth is that this is how most innovations come about, by slow incremental development and hard work. Edison did not invent the lightbulb. He developed the first practical lightbulb.
iii) To educate yourself.
iv) These machines are really good fun to ride! 

This instructable:
There are a large number of pages in this. This is deliberate, if you are serious about building one then you need every single step documented.

Additional information:
I have documented all my machines both good and bad on another website here:
Links to dozens of other self-balancing projects from around the world here (needs an update soon):

Can I do this as a beginnner?
The fabrication has been deliberately kept really simple.
The soldering between sensors and arduino board needs to be good quality!
If you are new to Arduino I would recommend buying an Arduino starter kit. These come with some ancillary sensors etc and a set of about 12 tutorials. Work through them all (about 2 days work) and read a beginners book to Arduino. You will then be ready.

Can I build a SegwayTM clone?
Yes. Australian SciTech group have built a very low cost machine using a version of the Arduino code from this Instructable:
Here also is the Thatch No-Way Segway using my code almost unaltered:

Has anyone else built one?
Ages currently range from 12yrs to 81yrs.
This Instructable is over a year old now, so yes indeed, people have. Here are a few I know of:
1)   Skateboard:
2)   Skateboard:
3)   The Velociryder:
4)   Great board video - Buffalo State College senior project:
5)   Another board based on this Instructable:
6)   A board based on old FIRST robotics parts + code from this instructable (FIRST robotics was started by Dean Kamen who also invented the Segway, to encourage youth to get interested in engineering):
7)   Carbon fiber racing car seat with 2 - the SciChair:
8)   Carey's self-balancing platform, good video:
9) Really cool video (on clifftop path by the sea): Skate auto-balancé
10) The KSLURP board from Malaysia:
11) The MIT Seboard, video clip:
12) The SITWAY sit-on machine by the 81year old gentleman above, with video:
13) This one has nothing to do with me but is such a really cool inspirational project I include it here, the TILTER skateboard, with hub motors and a suspension system:
14) New one wheeler from team cosmos with some technical information and video here:

Potential areas of improvement
It would be cool if people took this design and improved upon it.
The only way I can envisage further improvements in terms of weight reduction and compactness on my 2013 design with Headway cells and pneumatic tyres would be as follows:
a) Make frame from welded alloy.
b) The cheap scooter motors are quite heavy so use equally powerful but lighter, smaller combat robot motors.
c) To reduce length and make even more compact, someone, say a mech eng student, could design a neat hub motor for each wheel using epicyclic reduction gears.

You build these at your own risk. If tilted they WILL accelerate to correct the tilt. If you are not on the board, this means it can fly across a room or into your head. This is why you have to have an emergency hand switch that cuts the power if you let go of it. If it develops a fault it does not have multiple redundant systems like a real segway, most likely you will fall off! The code is not guaranteed against any bugs. If you don't believe me here is a video of Clint Rutkas developing a similar machine, also featuring some holes it punched in the walls of his apartment!

Have fun. Treat it as an adventure. Once you get it to balance there are many ways to improve it.



Remove these adsRemove these ads by Signing Up

Hello to all,

can anyone tell me if the IMU is oriented correctly?

Thank you, Regards

XenonJohn (author)  gerrymazzotta1 month ago

Other way up. The edge with the two large holes in it faces upwards. Then run the IMU tester sketch.


Ciao Giovanni, ho ruotato l'Imu di 180 ° e allegato inviare le immagini del monitor seriale. Pensi che i valori sono coerento o sto facendo qualcosa di sbagliato? Grazie, cordialità, Gerry
Platform level.JPGPlatform tilted back.JPGPlatform tilted forward.JPG
XenonJohn (author)  gerrymazzotta1 month ago

Hi, we can correspond by email and I am sure we will sort this out.


XenonJohn (author)  XenonJohn20 days ago

We did sort this out and his machine works now.


zetowe1 month ago

i found this IMU it is a reliable website

XenonJohn (author)  zetowe1 month ago


Just pointing out that the IMU above is a digital output one that does not work with the code in this instructable that was written to work with analog (variable voltage) output IMU's. These are becoming quite hard to find however.

This is why I have had to recently rewrite the code and add a new related instructable that shows you how to make a balance control system using a digital IMU.


Oh, i already ordered this IMU, i even started the project. I am making more like a onewheel-frame. i got all the aluminum parts and cut them up to shape, i picked the aluminum frame up from the welder today, i am using a small 24 volt DC motor. i got 4 small 7 ah 6 volt batteries and a velleman P8004 motor controller. I dont know if it works with my arduino UNO yet but its what i have (i am using a cigarette lighter 24-5 volt adapter as a power supply for my arduino, they're really cheap and function well) , otherwise i will buy an arduino motor controller like the sabertooth. Also, i am planning to add a light sensor as a dead-man switch, that way when somebody steps off the board it stops, i dont need a steering switch etc so i think i am just gonna remove those lines of code. i added pictures (the pics of the frame have low quality because my camera sucks at low-lighting). maybe i am going to upload videos someday. Thanks for the new code, helps a lot!

Sorry, i dont know why but my English is sort of broken today, usually it's better. :/ (i am dutch).

eyrecamp zetowe1 month ago

Hi zetowe,

can I please ask what is the logic you intend for your light sensor?

Without your advice I am thinking it is like a solar cell and if you block it with your foot and so your logic is drive the motor when the sensor is not generating or sending any voltage (if solar cell). But problem in my mind is if you put some dirt from your shoe on the sensor then it stay in drive mode when you are off it?

Such that I am interested to learn what you think about the logic for this process. thanku

XenonJohn (author)  eyrecamp28 days ago

Another option is the Sharp infra red rangefinder available from robot sites. It fires an infrared beam at an angle and looks at the reflected light. If you have it facing upwards and you are on the board, it will see light reflected from your foot. If not on the board it will not. You would have to recess it about 3cm into the board (for the shortest range one they make).

Another option is a cheap pressure sensitive resistor mounted under a rubber disc. Look how its resistance changes, set up a voltage divider with another resistor, feed the changing voltage into an analog input and with some adjustment of the limits in the code it will work.

You can also use a rugged metal push to make foot switch that you stand on, - recess it into the deck. These exist as foot switches to trigger alarms by shop cashiers for example.

zetowe eyrecamp1 month ago

Hello eyrecamp,

You have a very good point, but i think that my shoes don't get dirty enough to completely block the light sensor, i live in a city with mainly pavements, i dont think dirt will be a problem for this idea. (i included a pic of the light sensor)

(general update)

I also just got the IMU in the mail! It has the right voltage and the pins have the same names (i included a pic of the soldering so far), i hope it works, if it doesn't it will be hard to determine what doesnt work, its either the IMU not working with the code or it's the motor controller not working with arduino. i still need to find the 2 100 Ohm resistors. I really hope it just works, that way it stays simple.


eyrecamp zetowe1 month ago

Hi zetowe,

you are fortunate that you can keep your shoes so clean!

Personally I cannot yet bring myself to trust this as a fail safe.

Do you have any specific identifier data on that light sensor?

I would like to learn more about that one.

My current thought is a two wheel unit with a pressure sensitive system. No pressure applied is signal to cut out the motor, then I'd like to be able to bias left and right side pressure to bias drive to one motor in order to steer. Probably there are some floors with this concept.

zetowe eyrecamp1 month ago

Hello eyrecamp,

Personally i have decided to use a switch because it indeed is more reliable. If you are still interested here is some info.

I hope this was helpfull to you.


XenonJohn (author)  zetowe1 month ago

Looks good. I have no idea if the digital IMU you have bought will work with my new digital IMU code as I have only tested it with the 6dof digital IMU from Sparkfun. I am sure you will find out soon enough!


If you want, let me know maybe i can send pictures in the future.


XenonJohn (author)  zetowe1 month ago

Please do. Your metalwork looks really neat and tidy.


Ok, no problem, but please note, i am not doing this project bcause i know how to do it, i am doing it to learn how to do it so there might be a bit of a time-gap between every update.


You are a great genius John!

Congratulations, you have given new hope to all of us,



eyrecamp zetowe1 month ago

Great mate, thanks I had no problem finding this option.

eyrecamp1 month ago

Hi, I'm needing to get a copy of the code for this project!?

my mail is

further, I am considering using the hub motors (8 or 9 inch), in order to reduce mass. Do you know if sabertooth motor driver will provide the power and control through to these motors....? I will chase up some specs if necessary.

XenonJohn (author)  eyrecamp1 month ago

The Sabertooth only works with brushed motors. There are some small brushed hub motors out there, but in general, hub motors tend to be brushless nowadays. I have built a machine like a segway with brushless hub motors and a very expensive Roboteq Brushless motor controller but that is another story. It can be done but it was expensive and it would not go up any kind of slope (lack of torque).

Also, hub motors do not generate as much torque (twisting force) as a regular wheel with a sprocket chain or toothed belt drive from a motor, i.e. small sprocket on motor and big one on wheel). With self-balancers a generous amount of torque is very useful to have, rather than a high top speed.

so what I can determine is that I can get a hub motor (9inch) to give 12N.m of Torque which would allow drive up a slope incline of 0.054 (on a 0 to 1 scale), I guess if I had two of these it would double the Torque capacity and allow for slope incline of 0.108 (all based on a 100kg loading). This suggests capability to climb a 9 degree slope best case.

So now I am interested to find what your design rates in terms of Torque generated through the motor and sprockets. Maybe your design can carry a 100kg load on a 20 degree slope!?

Here is links to the 8 inch and the 6 inch hub motors.

Seems that the 6 inch motors are reversible, there is a 9 inch version that has variable speed options, however i have a feeling that a control circuit should be able to provide such convenience with any of these hub motor selections (??)

eyrecamp1 month ago

thanku for the feedback on the hub motors. It is unfortunate that there is a problem with the torque. I assumed that because they are advertised for scooters and wheelchairs that torque would not be lacking.
DR42961 month ago

Suppose I wanted to build one of these... but I wanted to add a third caster wheel and not worry about the whole self-balancing thing. I just want something I can stand on, be self-propelled, and be able to turn it by some really simple means.. What all electronics could I eliminate? Just the IMU's? Can anybody point me to maybe a SIMPLER Instructable that might show me such a thing?

XenonJohn (author) 1 month ago

Hi everyone,

Big development: I have finally managed to get all this to work with the Sparkfun DIGITAL 6dof IMU Code No: SEN-10121.

It has taken 2 years but there we are.

Uses code from all over the web chopped and changed and merged with my existing code. Use the very clever Kalman balance filter algorithm too.

See the new Instructable here:


_Champ3 months ago

What electrical output does your skateboard produce?

XenonJohn (author)  _Champ2 months ago

Motors 250 Watt (times 2 as there are 2 motors) and whole things runs at 24V

nsandland3 months ago
Would a 24V battery charger work OK?
Noaharfarf5 months ago
I am building a regular electric skateboard with four wheels that tilts forward for acceleration. I am using a 2G accelerometer to measure the forward tilt but it does not go full power unless I tilt the board to almost a 90 degree angle. Should I use a higher G accelerometer like the ones capable of measuring up to 250G so that it can go full power at less than a 45 degree angle? Or should I use a gyroscope sensor instead? I am just using analog accelerometer that outputs 0-5 volts to the generic speed controller as I do not know how to program. Any help will be much appreciated. Thanks!
XenonJohn (author)  Noaharfarf5 months ago
Alternative to the above is to use a 1G accelerometer that will give faster rising voltage as you tilt it.
Thanks John. The lowest and readily-available I could find is 1.5G. I am also using Dimension Engineering controllers and they told me that I can use their DEScribe software to modify its voltage range. I am checking on this right now. Great instructable BTW.
XenonJohn (author)  Noaharfarf5 months ago

Yes it will not go to 5V until it is tilted over 90 degrees.

I would use a microcontroller to look at voltage from accelerometer and send correct voltage to the motor controller, altering the performance by tweaking the code.

You could alternatively have an electronic circuit design that outputs double the voltage coming in from the accelerometer. Accelerometers are also very sensitive to vibration so the signal to your motor power controller when at less than full speed will have higher voltage spikes in it especially on rough ground that may make it behave oddly. You could also use a capacitor to smooth out these spikes.

pbecker836 months ago
Has anyone written any complete code for the more common digital IMU's? I am getting to the electronics part of my build but my 5DOF's got held up in customs and I have no idea when or if Ill get them now. Wouldn't mind ordering a digital one if I can find some instructions/code that tried and true. Thanks!
Hello pbecker83, I have the same problem with the China's customs ...
I don't know what I will do. I asked the seller from Ebay to try again but expecting fail again. I already bough everything only this thing left ....
Maybe we should make little group and work together to make good working code for 6DOF digital unit.
XenonJohn (author)  _Rommel_5 months ago
Completely agree with you.
What we all need is a basic self balancing sketch that runs with a digital IMU. It is a bit beyond my programming ability to keep the self balance program running at 100 samples per second and also maintaining reliable communication with the digital IMU.
XenonJohn (author)  pbecker836 months ago
Nearest I know of is Thomas Feminella. His code did work he tells me but every now and then there would be a momentary communications glitch between IMU and Arduino which would cause a big wobble in his self-balancing unicycle - not ideal. Link on front page.

I agree it would be great if someone could write some self-balancing code that works reliably with a digital hobby IMU.
gmiguy5 months ago
Has anyone had succes utilizing the motor control shield for the Uno as opposed to purchasing the Sabertooth. I am just looking to test my skills on small motors before I purchase the Sabertooth. Can even be a 1/10 scale setup to dial in my code?
gbredemeyer7 months ago
I'm in a build and I'm running the just balance sketch and running into some problems you can see in this video:

I've been tuning the pid values as well as working with a few other values as follows:

Acc sum 353.3
Overall gain .1
Overallgaintarget .5
Balance target 353.3
P 5.5
D .495
I is commented out

Any thoughts on what is happening, John?
XenonJohn (author)  gbredemeyer7 months ago
It looks very much as if the accelerometer is slowly correcting for the tilt, which is what it is meant to do. It is mainly the gyro that does the very fast responses to change in angle of tilt.
Can I just check what IMU you are using and what code? The latest code is attached to the arduino self balancing shield instructable, it is set to work with one particular analog IMU that is still available.
I'm using the old code found at the bottom of this link: AS for the IMU, we are using the GY-66. Yeah, we could tell it was doing what it should be, we're just not sure if we're going the wrong direction with certain values as we adjust or what. We just can't seem to adjust our way out of this mode and wanted to see if you had any thoughts/ recommendations or if you saw something that could tell you we have something else going on. Thanks, let me know what you think.
XenonJohn (author)  gbredemeyer6 months ago
That is your problem.
The code attached to this Instructable is out of date now and uses an IMU with different gyros inside it that is no longer available.

The gyro the code was written for (that you are using) had a bigger voltage change for any given change in rate of tilting. The GY-66 gyro puts out a smaller voltage change, but the accelerometer inside has same voltage change per degree of tilting as the one in the old IMU you cannot buy any more.
That is why your machine behaves as if the gyro is not really working but the accelerometer is working.

In the sketch attached to my Self-balancing Arduino Shield you will see 2 sets of comments. one refers to the gyro voltage output (of the GY-66) and one to the accelerometer output voltage. It shows how to scale the outputs so the code will work.
I will need to take a look at it but from memory you need to take the gyro reading from the GY-66 and multiply it by a bigger number than is used in the old code attached to this instructable.

Hope this helps. At some point soon I will remove all the code from this Instructable as it is confusing people and refer everyone across to the new one with the new code.

CUSTOMIZER7 months ago
hi john

now my scooter balances perfectly but i cant stand on it. there is not enugh power to keep me balanced on it.

i did edited the code to
balance_torque = (float) (9 * anglerads) + (0.95 * gangleraterads);

but still cant stand on it.

do you have any idea how to fix that ?

XenonJohn (author)  CUSTOMIZER7 months ago
Usually means you need more reduction gearing so more torque and less speed
Bigger motors ok but usually a bigger diameter sprocket on the wheel is the solution. My earliest machines had wheel sprocket almost same diameter as the tyre itself.
Have you increased the overall gain target term in the code as far as you can go before it starts oscillating?
Also look at the Sci-tech instructables which are very similar.
MaleBuffy7 months ago
Go the correct code. OK for some odd reason I had an older version!?

Anyways, i think it works better even with the smaller sprockets now! Got the bigger ones on Friday. They aren't that big though but at least bigger than the older ones.

Will try and post
XenonJohn (author)  MaleBuffy7 months ago
Looked at your video,

er, it looks fine to me. It balances, the tip-start works, it responds to your kicks in correct way!

The weight of the handlebar arrangement on the front makes it want to "fall" forwards. The self-balancing compensates for this by powering the motors forwards, NOT until it is "balanced" again, BUT until it is LEVEL again (not the same thing at all). When level again, still more weight on front of machine than back, so still tries to fall forwards again, so accelerates forwards again to stop this and stay LEVEL, so it keeps rolling forwards.
If you were standing on it you would lean back, and pull stick back, until it stopped rolling forwards so would become a non-problem. If not standing on it the above happens.

You can balance rear of machine with a weight OR stand on it 1 or 2 cm behind centre line until it works nicely (with bigger sprockets) OR alter the value of 350 in the code by small amounts until machine considers itself to be "level" when the machine is actually leaning back a little so weight of handlebars is then balanced directly over the axle line.

Hope this helps

LOL, its the same code! I did change the layout of the machine and motors. They are now more stable, I guess that made the change.

Will take the part of the new code however and adapt it to the old one.

I see the new code needs rewiring etc.

Will have to try it at a later point of time.
MaleBuffy7 months ago
Well I managed to balance it quite well now. It I bring it to balance, it stays level without any movement.

The problem starts when I tilt it a bit forward. It corrects itslef but moves forward and doesnt stop. If I tilt it backwards however, it corrects itslef imediately and stays there.

What could be the problem?
XenonJohn (author)  MaleBuffy7 months ago
Are you riding it when it does this?

It has no idea of where it is in terms of position on the ground.
It does not know how fast it is going or whether the wheels are going round or not (if stationary on a slope it could be sending power to motors just to keep you still on the slope).

If you tip it back a bit when "moving forwards" will it then slow down or will it just go forwards and not stop whatever you do?

Unusual fault actually, usually if something is wrong it is equally wrong in both directions.
No it does it when it is balancing by itself.

Can the angle be the problem; the 350 value for example may be to high?
I made a video.

Didn't fit the new sprockets yet. I think the problem I have is not sprocket related, so I try to figure this one out first.

Any ideas why it moves forward and doesn't stop;
MaleBuffy8 months ago

I am still waiting for my larger sprockets to come, so I am looking at the code to see if I can finetune anything. Something that comes to mind is the situation when for some reason, I let go of the deadmans switch. When I try to get on again and press the deadmans switch, the motors act crazy at full speed. In order to overcome this, I have to switch the machine off and on again, and do the 5-10secs calibration process.

How can I "correct" this, so that when I press the deadmans switch again, it doesn't start at full speed again? Would tipstart = 0; help? (since it is 5 when pressed for longer time)

This would make sense, since when I for example fall off and let go, by falling the deadmans switch can be accidentaly pressed and the thing can hurt somebody or something. By forcing it to start with limited power (like the softstart function), I would have time to switch it off.
XenonJohn (author)  MaleBuffy8 months ago
I would get your board to work first then I can suggest code mods.

My newer code in the Self-balancing shield instructable has a value that counts down from 50 to zero over half a second if you let go of the deadman. If it reached zero the motors cut and they will not restart until you reset the board.

This has additional advantage of not cutting the power if you let go of the deadman just for a tiny moment, or the switch comtact is dirty (same effect) but it still cuts the power if you fall off. You can adjust the decay time value in he code. Seems to work quite well as once I made a board with a cheapo deadman switch which had dodgy contacts.

XenonJohn (author)  MaleBuffy8 months ago
My newer software does not do this. You have to restart the board after you have let go of the deadman switch for safety as you say.

MaleBuffy8 months ago
Here is the youtube video

It works now.

Thanks a million for your explanation. I really appreciate it.
XenonJohn (author)  MaleBuffy8 months ago
OK I have seen your video. Basically it is working.

You need much larger diameter chain sprockets on your wheels. 2 reasons:

a) Any slight slack in the chain causes a small rattle (picked up by the IMU) every time it changes direction. This is magnified if the wheel is large diameter compared to the wheel-sprocket diameter and the IMU can pick this up and causes oscillation.
When starting to develop a machine like this you are much better to have a very large sprocket on the wheel, say 2/3 the diameter of the wheel itself. On my skateboard the wheels may be small but the sprockets on the wheels are about 2/3 of the diameter of the wheels themselves.
b) If the motor sprocket is small and the wheel sprocket is large, it gives a slow top speed but very high torque at the wheel (turning force). You want this. Self-balancing machines need this as when they start to fall, the wheel speed has to increase very fast, with no delay due to a lack of torque.
The machine you have now may just about balance on its own but may not do so with you standing on it.

Suggest you either use larger diameter wheel-sprockets or use smaller wheels. When it works, then you can experiment with smaller sprockets.

Do not worry, you are nearly there.

MaleBuffy8 months ago
(removed by author or community request)
XenonJohn (author)  MaleBuffy8 months ago
Your video is showing up as private so I cannot see it.

The two key lines are:

balance_torque = (float) (4.5 * anglerads) + (0.5 * gangleraterads);

cur_speed = (float) (cur_speed + (anglerads * 6 * cycle_time)) * 0.999;

The 4.5 is the “P” term i.e. proportional to the actual current angle of tilting
The 0.5 is the “D” term i.e. reflects the RATE of tilting
The 6 in the cur-speed line of code is the “I” term.

Note, it will balance without the I term at all. Could change this line to cur_speed = 0; until the rest is right then put it back in and experiment with the I term.

I would put whatever you changed back to initial value then work on the terms above.

One way to “tune” PID (of many) is to set the I and D terms to zero or near zero, then just increase the P value until board oscillates wildly. Then reduce it a bit, some say reduce to about 2/3 the value that made it oscillate.

Then gently increase the P term and you will find it recovers from sudden changes in tilt much better. If it “overshoots” i.e. over compensates to a sudden tilt by going too far the other way, then reduce the P term. You want board to react by rapidly coming level again, not tilting too far the opposite way.

The I term makes it more likely to stay in one place than running off. It reacts to how LONG the board is held tilted for. So if going up a slope, you hold front end down a little, at first it will not get up the slope, but wait until the I term increases to larger and larger value, then it WILL eventually start to go up the slope.

Get the P and D right first on level ground.

Don’t worry about steering until it balances.

If turning rate gets faster and faster as you command a turn, there is a simple code fix for that. Let me see the vid and I can work it out usually.

XenonJohn (author)  XenonJohn8 months ago
In the above explanation I meant to say increase the P term until it oscillates then back it off a little. Then increase the D term until it tecovers from sudden disturbances optimally.

MaleBuffy8 months ago
Well I managed to make it balance. I rewired everything and it started to behave like it should.

At first it balanced but it was very slow in correcting itself, until a point that it couldn't keep up and fliped over.I then doubled the torque and power to 9 and 2 and it kept level. It jitters a little bit, but it stays level.

Thing is now when I turn, it becomes very unstable. Note that I test it without being on the board. Is the software made so that you don't have to be on the board and turn without it going crazy?

Can you suggest more setting to make it stop vibrating? Increase power or torque even more?
MaleBuffy8 months ago
I need help. I have a balancing Segway based on this project. However althoug when keept level, my IMU readings seem ok, when I press the deadman switch, the motors turn at full speed and the thing flys off. At the following link I have the serial monitor output at the time the board is level a almost 0 degrees, the deadman switch press. Motorvalues go to -100 for both motors and level value also -100.

If I let go of the deadman switch, the motor values go to zero. I don’t understand why whenn press they turn full speed, since values are zero.

Here is the link of the picture
XenonJohn (author)  MaleBuffy8 months ago
Also, the startup procedure is to leave one end on ground,NOT moving at all, power up arduino, count to 10 for gyros to zero, press deadman in (nothing should happen) then bring it slowly level. When it is ;level, (still pressing deadman) the self-balancing algorithm should go active and it should start to try to balance.

XenonJohn (author)  MaleBuffy8 months ago
Try reversing both motor wires where they enter the Sabertooth. This is what it does when they are backp to front.

When testing keep wheels on the ground but hold bothe ends ready to pick it up if it misbehaves.

Wheels should turn in direction of the lowest end of the board. if right hand end pushed down, for example, it should roll to the right and so on.

USAFpirate6008 months ago
I'm a mechanical engineering student interested in building one of these to ride around campus. I was wondering if anyone can tell me the top speed and how it handles hills. Thanks.
XenonJohn (author)  USAFpirate6008 months ago
How about a nice hub motor design with epicyclic reduction gears? Not thinking e-bike direct drive brushless here but a small but powerful brushed combat robot motor, and epicyclic gears to give you the torque, with small pneumatic tyres. A bit like this........
Go to this webpage and select image no 5 for his V2 machine.

That could be a real neat drivetrain kit to go with this control systems kit.
XenonJohn (author)  USAFpirate6008 months ago
See video link number 4 on title page.

Buffalo State College project.

You can see it goes up a standard concrete wheelchair ramp, although the rider probably weighs a lot less than me.

Should go as fast as Razer scooter the drivetrain is based on, although never get to 100 % speed else you will fall off the front as unable to self balance at full speed!

el_walto8 months ago
Finally got my electronics hooked up. My platform seems react in the correct manner, but with a huge reaction speed delay. Any suggestions on a variable change? I upped the gain to a huge number, but the platform just rocks back and forth.

Maybe if my quick gyro wire is not correct this could happen?

I'm using the 2x60 sabertooth and unite 24v500w motors.
XenonJohn (author)  el_walto8 months ago
Sounds like the accelerometer is working but the gyro may not be.

The fast response is due to the gyro, with a slow correction of any drift in the gyro provided by the accelerometer. If accelerometer only working then you will get generally the correct response, but it will be very slow.

You could contact me and post a video on youtube as I can often diagnose problems by watching how it behaves.

See also my recent update where I have further simplified the build of the balance control system.

Yup, this isnt right for sure. I'll have to check wiring / inputs.

balancegyroDegrees:0.00 accelDegrees:48.27 overallAngleofTilt:49.02 accsum: 282.00
balancegyroDegrees:0.00 accelDegrees:48.27 overallAngleofTilt:48.98 accsum: 282.00
balancegyroDegrees:0.00 accelDegrees:48.27 overallAngleofTilt:48.94 accsum: 282.00
balancegyroDegrees:0.00 accelDegrees:48.27 overallAngleofTilt:48.91 accsum: 282.00
el_walto el_walto8 months ago
So yeah, i had a small short between vref and Y-Rate.
XenonJohn (author)  el_walto8 months ago
If you apply 5v to the IMU instead of 3.3v the gyros will blow but the accels will still work - as I have found out the hard way in the past. Hope yours is still OK.


BuildWiz9 months ago
Would it be better to use an Arduino Mega because of the faster speed or is there no benefit between the Uno and Mega??
XenonJohn (author)  BuildWiz9 months ago
My latest board just uses an Arduino Uno. It is fast enough to read the sensors then make decisions 100 times per second, with some processing speed to spare, which is about right for a self-balancing machine. Going faster than that would not confer any real-world benefit in terms of ride quality.

Advantage of a Mega really is if you have several devices attached that use serial communications, as it has several hard-wired serial outputs, or if you have a big program and just need the larger memory or finally, if you just need more digital input/output pins. For example if I want an LCD display I tend to use one that uses serial communication to save on Arduino pins. If you use a regular LCD display this alone will use up most of the digital pins on an Uno.

If you get the older version of the Mega online, they are not actually much more expensive than an Uno.

Hope this helps

thanks for replying so quickly. I also had another question. On your newest board you have a row of leds I assume maybe to show battery status. I was wondering how you achieved that through the arduino?
XenonJohn (author)  BuildWiz9 months ago
It is a module you can get from one of the online robot shops. there is a 24 V version and a 36v version. You can get led voltmeter kits online too but the robot shop battery indicators seemed to be neatest solution to a simple easily visible battery voltage monitor. It is just wired across where the power leads come into the Sabertooth motor controller.

The 4 LEDS in centre console are each controlled by an arduino pin. When it first balances as you bring it level they all come on, then 3 go off. After that they come on in sequence as the torque being sent to the motors passes 70'then 90 percent as a warning to slow down a bit else you are about to fall off.
XenonJohn (author) 10 months ago
If I wrote this Instructable again I would set the internal pullup resistors in the Arduino to HIGH which can be done using software, and then make it so when you pressed the deadman it would pull the Pin down to ground (GND). i.e. when deadman not being pressed the Pin "sees" +5V and when it is being pressed the pin "sees" 0V. That way you would not need any extra resistors. The Sci-Tech group have done it that way in their version of the software.
As my code is written for this instructable at present, pressing the Deadman connects 5v to the Input Pin. The rest of the time, when the deadman button is not being pressed, the pin is pulled "down" to GND via the resistor.
If I changed it now it would confuse everyone even more!

XenonJohn (author) 10 months ago
You put one end on floor, let us say the left side, and wait approx 5 secs while it takes zero readings for the gyro. Then stand on the end that is on the ground with, in this case, your left foot. Press deadman switch in. Put right foot on board, then slowly bring it level. When about level the self-balance algorithm engages.
It has to be like this else, when you pressed the deadman in, while board was tipped, it would shoot off across the floor as it tried very hard to become level.
Softstart: This means when slef-balancing first engages, the overall "gain" of the software starts low then gradually increases to a target value. This stops it being too violent when you first bring it level.
The first time you do this I would lean forwards on a desk with both hands (deadman in one of them) and support about half your weight on your hands. If board then goes crazy just lean forward some more and lift your feet right up out of the way!
zaki448410 months ago
Hello John,

I am using 24v 350w electric scooter motor. Do you think that the 350watt motor is good for this project? because apparently that is the only motor that I could get from my supplier.
I have tested with a RoboClaw 2 channel 30amp motor driver. It burned out the first time I tried.
Do you think that the motor driver burned out possibly because of the high peak current (80amp) of the 350w electric motor?
XenonJohn (author)  zaki448410 months ago
If you hold a motor so it cannot turn, it will draw a very large current. For these projects you need reduction gearing so lots of torque, low top speed. Easiest way is a chain but segways for example have gearbox.

350watt motors would be fine, but do have to have the correct reduction as in the examples in the instructable.

nboyajian10 months ago
Hi there XenonJohn! Really great page you have assembled here! I have been working on a self balancing skateboard with my friend for the past 6 months or so and we have been using tons of your advice. Here is a photo of our board.

We used a digital IMU and have the board fully balancing and rideable. We are still fine tuning the software to optimize the ride but we are happy with how far we have been able to come.

As you requested in a previous comment on this page I have set up a forum for this group to use. You can find it at I will post many pictures and videos of my own board very soon. Thanks again!
XenonJohn (author)  nboyajian10 months ago
Thanks for setting up the forum. Have noted it at top of the front page of this instructable.
It has no messages yet so I just posted one!

Your board looks great. If you used a digital IMU could you share the code with us or do an Instructable? There are many people out there who would benefit from it, see all messages below, instead of having to scour the globe via the web looking for an old-stock analog IMU.

Best wishes

kennyng11 months ago
Hi XenonJohn and friends,

I am amazed by the self-balancing skateboard and had tried to make it myself. The instruction is very clear and I really learn a lot from the thread.

I am in the stage of using “ Just Balances Codes “ and got stuck. The skateboard that I built doesn’t not response fast to the angle tilted. When I tilted the skateboard from side to side, I can see from the serial window that values under Motor1percent and Motor2percent change from + to – and – to +. But once it hit -100 or 100, it will stay at this value for a pretty long time even I had tilted the skateboard to the other direction.

Can anyone help me on this problem. Really wanted to have it working. Thank you so much in advance.

XenonJohn (author)  kennyng11 months ago
If you hold it tilted one way, there is a value (the cur-Speed) term that increases according to how LONG (in time) it has been tilted that way, the I in PID. This accumulates until it eventually is sending 100% power to motors to try to make it go the other way and become level again.
If testing machine off the ground, i.e. with wheels in the air, you then tilt it other way and it takes a moment or two for this accumulator to decrease and then go the other way. If you rock it back and forth past the centre balanced point (as in real self-balancing) this term never really accumulates to a significant value.
This feature is used to go up slopes, you hold board slightly tilted (but still balancing) and the power slowly increases until it starts to go up the slope.

You can set the cur-speed term to zero in the code as it will still balance OK on level ground just using the P and D parts of "PID"

Alternative is to just try the machine with wheels on the ground and stand well to one side.

Does anyone fancy setting up a self-balancing segway/skateboard Arduino forum? There are so many Q and A's here now, and quite a few working boards out there too, we should all really just be helping each other out.with problems as a community of builders because the collective knowledge is out there now. I have no idea how you set up a forum.

XenonJohn (author)  kennyng11 months ago
It has no concept of position, only whether it is level or not. All it does is try to stay level by applying power in one direction or the other. Note, it does not apply a set speed, merely applies power which is not quite the same thing. Therefore it has no concept of speed either, only how much power is being applied as a percentage between 0 and 100% in either direction.
You can alter the balance point so it almost stays in one place, but it will never do so perfectly.
To give it "knowledge" of position, you would fit wheel speed encoders which tell arduino how fast wheels are rotating, then modify code so it stays balanced but also keeps the average wheel speed over time at or close to zero. This would make it more or less stay in one place.
If you are riding it you essentially do this manually by leaning a bit one way then the other.
If wheel encoders failed with you on it, - dirt on the optical encoder for example, there would be unpredictable behaviour as computer would then follow the "rubbish in, rubbish out" maxim and who knows what it would try to do.

XenonJohn (author) 11 months ago
If you just have one wide wheel, then you can ride it like snowboard and turn by tyre deformation.

With 2 wheels fixed on the same axle with just one motor, if you have pneumatic tyres AND wheels fairly close together AND tyres medium-soft, then by leaning you will compress the inner tyre and so start to turn. Soft tyres mean more power required to run the machine however.

Finally, as in my "pneu-skate" you could fit pressure sensitive resistors on the deck and use your heel versus toe foot pressure to steer the machine (2 motors one for each wheel). This takes some experimentation to get right but did work. Hint: Put rubber pads over the resistor pads.

Very finally, look at the "Velocyrider" project where the foot platform for the trailing foot could actually be tilted by moving the foot. This was attached to a steering potentiometer which steered the machine.

So the answer is yes it can be done, but you need to be prepared to experiment a little. Nothing wrong with that. As Einstein said, "If we knew all the answers it would not be called research would it?"

sgovaerts1 year ago
Hey John

First of all: thank you for this amazing tutorial! :)
I was just wondering if you have to use the sabertooth. Can you also use a dual-channel motor drive module like this one, in combination with 2 300W motors?

These are its specs:
Peak current (Load): 50A
Recommend max working current(Load): 20A
Power VCC (Load): 0V~30V
Recommend power vcc(load) : 12V ~ 26V
Control VCC: 4V~12V
Control TTL Voltage; 2.5V ~ 12V

Thanks in advance!
XenonJohn (author)  sgovaerts11 months ago
It is peak 50A on ONE channel. This suggests it is peak 25A if using both channels. Nominal is 20A (it does not say per channel so nominal may be 10A per channel if both channels used separately).
Also no heat sink, you have to add your own.
No safety cut out if it overheats, it just melts essentially.

So, it is cheap so it may be worth taking a chance with it. Do not cry if it burns out however! It would probably be OK for a machine running gently on flat level ground. I have seen a small mini-Segway type machine run with a 2 x 10 Amp Sabertooth power controller but that was running slowly on a very smooth floor.

You get what you pay for with motor power controllers. The sabertooth and other similar robot controllers are expensive but they also have shut down circuits that help protect them if they get too hot. This means in the long term they may end up cheaper.

I have blown up several low cost controllers over the years and now realise that a good quality one will actually cost you less money over the long term.

Hope this helps.

him2anshu11 months ago
Can you please add the 6DOF digital code again please, its been removed again, or mail me at
XenonJohn (author)  him2anshu11 months ago
See the note I have added to the title page. I would if I were you modify the code of Thomas Feminella as he has a unicycle self balancing using a digital IMU. Therefore he is the most advanced person so far as regards getting anything capable of carrying a human to self balance using a digital IMU and Arduino.

I am making a new compact board with an old analog IMU, pneumatic tyres and decent battery pack, but when it is built, I will then start investigating a digital IMU seriously to see if I can get it to work, based very much on his code.

eyhseow11 months ago
Hi All

My self-balancing likes to move left and right and doesn’t stay still in one position. Anywhere in the code where I can change to make it stay still?
Please help. Thanks.
eyhseow1 year ago
Dear Xenon John

Any update on on the SIXDOF digital unfinished code?


William Seow
XenonJohn (author) 1 year ago
HI everyone,

Been away from this for a while. Still working on balancing machines though.
The specimen, UNFINISHED and UNTESTED attempt at reading a digital IMU (using Arduino V22 by the way) on step 53 has just been put back. For some reason it keeps disappearing, it is not because I remove it deliberately or anything.
Needs someone with proper training as programmer to write some software not just to read a digital hobby IMU, for which examples do exist, but then also run self balancing code without disrupting the reading of the digital IMU......which I have not been able to do yet. Whenever I add in the self balancing code, my data stream from the IMU locks up now and then.
For now all my projects are using analog IMU's from earlier projects.

All the best,

Hey, I got to the Just Balances point, but mine isn't balancing. I did the accsum thing, however it continues to violently waver up and down. Also it drifts a little bit forward. Any ideas?
Hello Pizzapie500,

Does your Just Balance act like this (video) ?

Also, my deadman switch is acting weirdly. When pressing the deadman switch, the wheels start spinning but as soon as I release the deadman switch, the wheels keep spinning instead of stopping. Does anyone have any idea on what the problem is?

Yep. That's the exact problem, except I don't have to tilt it that far to engage tilt start. Did you figure out a solution? Your deadman switch is probably short circuiting. I had the same problem with my wii nunchuck.

Well, that was a one time problem. Normally I just tilt it until it is horizontal and the TILT START engages.

I did not figure out a solution as of yet. I am still working on it but it seems that I am not using a resistor for the deadman switch, which might be the problem... Is that what you are referring to when saying " Your deadman switch is probably short circuiting. I had the same problem with my wii nunchuck. ".

If so, I will only be able to try with a resistor tomorrow since I currently do not have a 1500Ohm resistor.

Tim003 Tim0031 year ago
Hi again,

My deadman switch is now working correctly. But the Just Balance code still does not work (by that, I mean that the robot doesn't self-balance at all).

Hey, so I guess now we're at the same standpoint now. We both are stuck at the Just Balance :( I'm going to try changing the values in the code, and I'll tell you if it works.
Thanks! I will also do my part by trying to change some things in the code.
Cool! I seem to have a problem with the deadman switch again. What did you do to fix it? Also XenonJohn commented this, "increase derivative gain constant (0.5 at present) so that when you tilt it one way it rapidly corrects in a damped sort of way, i.e as it get back closer to balance point the force of the correction drops off so it rapidly corrects without overshooting or oscillating". I haven't tried it yet, but it might help.
I'll try to do that tomorrow morning.

Here is a picture of what I did.

I got a 10K resistor, "tied" it to pin 9 wire and plugged the other side of the resistor to GND (ground). If you can't seem to understand what I did, I can take a few more pictures.

Oh, so that's what i did wrong! I only used a 2.2k resistor... Will try that in like 30 minutes. Good luck with the script! I have a lot of homework to do, so I can't play with the values tonight.
I tried to change the value but it did not change anything. I am not sure what value John is talking about. There are two 0.5 values. Do you have an idea?
I think he's talking about the overallgain target because it's under "setup variables". It turns out that it wasn't the resistor to ground that I needed, it was that the Nunchuck pressure sensor I had was broken. Now i'm just using a momentary switch as the dead man. Going to try the values tonight and the weekend.
I'll try that tonight.

Did you try changing the values already?
Tried switching my accsum to 344 and changing the derivative gain to .7. Unfortunately, it's acting like a bucking horse.
Can you do something for me (and everyone else on this website). Could you copy and paste your serial data on here? I will put mine on her tomorrow. We should compare our data.
Some data of a bucking horse:

balancegyroDegrees:-5.30 X-accdeg:1.48 overallAngleofTilt:0.816,9\n
balancegyroDegrees:-32.82 X-accdeg:-7.80 overallAngleofTilt:1.306,9\n
balancegyroDegrees:51.03 X-accdeg:4.02 overallAngleofTilt:5.676,9\n
balancegyroDegrees:56.18 X-accdeg:13.83 overallAngleofTilt:-0.726,9\n
balancegyroDegrees:33.36 X-accdeg:37.07 overallAngleofTilt:0.806,9\n
balancegyroDegrees:-2.00 X-accdeg:22.00 overallAngleofTilt:0.195,10\n
balancegyroDegrees:-4.23 X-accdeg:-2.18 overallAngleofTilt:5.676,8\n
balancegyroDegrees:-12.07 X-accdeg:3.98 overallAngleofTilt:5.266,9\n
balancegyroDegrees:81.01 X-accdeg:-18.59 overallAngleofTilt:16.106,9\n
balancegyroDegrees:-15.99 X-accdeg:-22.78 overallAngleofTilt:14.156,9\n
balancegyroDegrees:-60.26 X-accdeg:1.15 overallAngleofTilt:6.765,9\n
balancegyroDegrees:11.07 X-accdeg:20.36 overallAngleofTilt:7.285,9\n
balancegyroDegrees:0.46 X-accdeg:16.95 overallAngleofTilt:6.696,8\n
balancegyroDegrees:-5.61 X-accdeg:11.45 overallAngleofTilt:5.996,9\n
balancegyroDegrees:2.77 X-accdeg:17.20 overallAngleofTilt:5.536,9\n
balancegyroDegrees:-1.00 X-accdeg:9.65 overallAngleofTilt:4.977,9\n
balancegyroDegrees:8.68 X-accdeg:1.77 overallAngleofTilt:5.325,9\n
balancegyroDegrees:3.92 X-accdeg:16.83 overallAngleofTilt:5.575,9\n
balancegyroDegrees:0.69 X-accdeg:-1.89 overallAngleofTilt:5.776,9\n
Ok. I can't really verify anything right now (I m in class) but it seems that everything is working fine for you. Here is why:

"However when you tilt the board so accel values go +ve, the gyro values should TRANSIENTLY go more +ve also.

They will go transiently -ve as accel angle goes -ve when you are tilting it the other way.

If this happens then you have your accel and gyro mounted correctly!"

From my past paste of the data ( it seems that my IMU is having trouble getting it's values right. I'll find out more about it as soon as I am back.
I think that we're doing different codes. I was using the Just Balances code. This is my IMU tester code data:

balancegyroDegrees:7.07 accelDegrees:-1.11 overallAngleofTilt:1.90 accsum: 345.29
balancegyroDegrees:5.23 accelDegrees:0.49 overallAngleofTilt:2.92 accsum: 343.43
balancegyroDegrees:6.53 accelDegrees:2.26 overallAngleofTilt:4.35 accsum: 341.38
balancegyroDegrees:6.76 accelDegrees:3.61 overallAngleofTilt:5.84 accsum: 339.81
balancegyroDegrees:5.00 accelDegrees:6.57 overallAngleofTilt:7.06 accsum: 336.38
balancegyroDegrees:0.46 accelDegrees:7.92 overallAngleofTilt:7.73 accsum: 334.81
balancegyroDegrees:-4.61 accelDegrees:6.90 overallAngleofTilt:6.93 accsum: 336.00
balancegyroDegrees:-6.76 accelDegrees:5.71 overallAngleofTilt:5.48 accsum: 337.38
balancegyroDegrees:-2.38 accelDegrees:3.82 overallAngleofTilt:4.58 accsum: 339.57
balancegyroDegrees:-4.92 accelDegrees:3.49 overallAngleofTilt:3.65 accsum: 339.95
balancegyroDegrees:-6.69 accelDegrees:2.26 overallAngleofTilt:2.18 accsum: 341.38
balancegyroDegrees:-9.15 accelDegrees:0.00 overallAngleofTilt:0.12 accsum: 344.00
balancegyroDegrees:-6.99 accelDegrees:-2.83 overallAngleofTilt:-1.81 accsum: 347.29
balancegyroDegrees:-9.45 accelDegrees:-4.27 overallAngleofTilt:-4.10 accsum: 348.95
balancegyroDegrees:-6.92 accelDegrees:-6.44 overallAngleofTilt:-5.95 accsum: 351.48
balancegyroDegrees:-9.61 accelDegrees:-8.99 overallAngleofTilt:-8.32 accsum: 354.43
balancegyroDegrees:-2.92 accelDegrees:-10.59 overallAngleofTilt:-9.39 accsum: 356.29
balancegyroDegrees:-4.07 accelDegrees:-11.45 overallAngleofTilt:-10.43 accsum: 357.29
balancegyroDegrees:2.38 accelDegrees:-11.70 overallAngleofTilt:-10.15 accsum: 357.57
balancegyroDegrees:6.07 accelDegrees:-10.67 overallAngleofTilt:-8.86 accsum: 356.38
balancegyroDegrees:8.22 accelDegrees:-7.88 overallAngleofTilt:-6.95 accsum: 353.14
balancegyroDegrees:9.30 accelDegrees:-6.53 overallAngleofTilt:-4.70 accsum: 351.57
balancegyroDegrees:8.53 accelDegrees:-3.74 overallAngleofTilt:-2.60 accsum: 348.33
balancegyroDegrees:9.38 accelDegrees:-1.11 overallAngleofTilt:-0.46 accsum: 345.29
balancegyroDegrees:5.61 accelDegrees:3.16 overallAngleofTilt:1.42 accsum: 340.33
Did you get the segway working in the end?
I haven't got the time with school and everything. Did you?
We are actually using the same one. I am using the Just Balance code. I just decided to show ACCSUM in the serial data so that I know it is correct and nothing is messed up.
And yes, my ACCSUM is about 290 when horizontal. I don't really know why, but it doesn't seem to matter.

I see. Well, to get the correct gyro reading, I just soldered exactly the same way he did, and I mounted it using removable blue tac. Now I just have to figure out why my skateboard is over compensating and bucking.
XenonJohn (author)  Pizzapie5001 year ago

Send me a working email via the messages section and upload a video clip to youtube showing me what your machine does and let me have the link.

When we are in email contact, send me your sketch as you are using it and I will make some suggestions for you.

Best wishes


I couldn't find your email address. Mine is (don't laugh, I made it in 1st grade). Anyhow, here's a video link to it. I forgot to copy the serial data, but I put it to the right of the video.
XenonJohn (author)  Pizzapie5001 year ago
I am sending you an email with suggestions.

Your machine is working but it looks a lot lighter in weight than mine so it does the right thing when it tips, but then overcompensates. Its like having your stereo amplifier working OK but then you turn the volume up to 11 !

Have emailed you some new code to try. It has a lower overallgain setting you can play with.

Also, I would not use rapid serial.Print values to the screen just maybe every 2 sec while balancing as it upsets the loop timing slightly. OK for testing your IMU but otherwise no.

Try out the new "Just balances nothing else" code I email you and let me know what happens. Have just sent it to someone else to try too but seems to be OK.


Sorry for the double post, but you can see the serial data in full screen 1080 HD
The problem must be in the code somewhere. I hope John will read the comments and help us. I have no idea what to do right now.
peraz911 year ago
hello, I'm trying to build a balance!
I made the circuit today with all the parts but I have found serious problems:
1) The motor 1 rotates very slowly and does not respond all'IMU.
2) The motor 2 is stopped forever!
3) During the compilation of the Arduino sketch tells me that the word "BYTE" I have to replace with "Serial.write ()".
4) None of the switches affect the rotation of the motor 1.
If you can help me do me happy :)
Tim003 peraz911 year ago
Here is how you fix #3:


My best guess for problem #1,2 is that you misconnected a wire somewhere. Everything should be working fine with XenonJohn's code.

For problem #4, do you have a continuous switch or a momentary switch? You must have a momentary switch. Otherwise it won't work (I tried). Also, this is a good way to complete the switch circuit:
WARNING: it does take a lot of battery. There might be another way of doing it, but I do not have too much time to deal with that problem right now.
peraz91 Tim0031 year ago
is amazing but to be functioning my IMU must be placed approximately at an angle of 45 degrees. I do not understand the reason for this behavior.
Tim003 peraz911 year ago
Did you get it to work?
peraz91 Tim0031 year ago
Tim003 peraz911 year ago
Would it be possible for you to send me your code? (tgirgin (at) wisc . edu) I've been stuck on this project for a while. The board just does not want to self-balance. It freaks out as soon as it is set.

And what was the deal with the IMU?

I really hope you can help me.

Thank you!
natsud11 year ago
Hello i am also looking for the digital version code that is supposed to be attached to step 53. I dont think it got attached, can you please repost it? I have tried to implement a digital version to your code with no success I am using a generic MPU6050 IMU and i just can figure out what the problem is hopefully I will have better luck with your code. and Thanks a million for your hard work.
XenonJohn (author)  natsud11 year ago
Instructables seem to have removed it along with the title photo which disappears for no obvious reason every month or two.
Must have uploaded it over 20 times since this I first put this up.

Thats odd, must be frustrating I bet its a pretty popular request. Would you be willing to send it to my email? or maybe post it on github? i would really appreciate it
davidwjib1 year ago
Could you re-post your code that works with the digital 6DOF IMU please?
eyhseow1 year ago
Dear Sir
Do you have any spare anlalog IMU-5DOF or 6DOF that I can purchase from you? Please advise.
eyhseow1 year ago
Dear Sir
Do you have the software code for the whole project using the digital 6DOF, and the full schematics diagram for the whole project. If not the connections between the digital 6 DOF and the Arduino. I will greatly appreciate for your help.
eyhseow1 year ago
Dear Sir,

Do you have spare 5 dof analog accelometer (sparkfun part number: 11072) that I can purchase from? Can I use Sparkfun 6dof DIGITAL IMU for self balancing scooter project and also the code for self balancing scooter? Please advise. Thanks.
Blkant1 year ago
Seems I've arrived on the scene a bit too late... Not only is the 5DoF IMU gone again but the 6DoF IMU is gone as well. There is only a 9DoF IMU "Razor" now. Not sure where to even begin to attempt this one now. I fear this might be hopeless now without knowing all the ins and outs of the IMUs. Does anyone have ideas on how to approach this with the currently available hardware?
atanguay1 year ago
Any suggestions as to the exact IMU to get from Sprakfun as of jan 2013? I need some things from them and would like to include one that would work for this project.

Seems like these things are getting killed as fast as they're coming out.

Really really cool stuff. I definitely want to build some kind of self balancer over the winter for the spring. Thanks for any ideas, and thanks for sharing!
el_walto1 year ago
So, i finally figured out that both raw AND vref have to be connected to 3.3v. I only had raw connected before and could not get imu test code to work. Hope this helps someone.
meirmark1 year ago
Very nice work.
I like to use your desigen to build a segway with 16" weels.
what changes do I need to make to the software ?
I don't think you need to make any changes to the software
peraz911 year ago
the test of the IMU and the rest of it works, but the engines tend to shake and it becomes impossible to use.
A while ago I built a "Segway" style machine based on this instructable, using a Sabertooth and it works perfectly, I'm now attempting to make a one wheeled device using the Syren 25. When I power the system up the Syren goes full steam ahead for about 5-10 seconds before being stopped by the code, Im wondering if anybody else has had experience with this?
XenonJohn (author)  Nthatchable1 year ago
Yeah, me!

Have tried same thing. Syren does not seem to behave just like a one channel version of the Sabertooth, even though it is supposed to. Still playing around with it.

My original heavyweight one wheeler used an OSMC and a different microcontroller with faster pwm output on it.

Thanks, at least it's not just me, I've found I can lift the wheel off the floor whilst the arduino boots up, and then it behaves itself, but I'm thinking of shoving a Sabertooth in and just using one of the channels, plus it may be useful to have a spare channel for future Additions.
el_walto1 year ago
This is a really nice tutorial. I just finished building my side by side platform using 500Watt motors and 12.5" wheels. I hope to finish with all of the electronics\programming soon.

I have the 60amp sabertooth, so might end up using 8S LiPo after I'm done testing with 24V SLA.
grunff1 year ago
Hi XenonJohn,

I built a robot using this setup a while back, but never managed to get it to work satisfactorily. I've now picked the project back up to see if I can get it working.

The problem I'm having is caused by the Level drifting very quickly, so the board never finds its level. It tries to level, but by the time it gets there, the Level variable is way off horizontal, so it can't balance.

Any idea what can cause this drift? It happens over a few seconds, and within 30 seconds or so instead of being 0 deg it's 400 deg.
XenonJohn (author)  grunff1 year ago
This is a classic issue. The gyro is doing the short term balancing but it drifts so after 30 sec or so it still balances but at an odd angle. The accel is supposed to gradually correct this. What you describe is the accel acting against the gyro rather than with it (i.e. back to front).

Solutions, turn IMU over (current upper side downwards) or alter code:

Take this line:
x_accdeg = (float)((accsum - (338 + balancetrim))* (-0.862));

Change the sign before the 0.862. If +ve now change it to a minus sign or vice versa.

Alternative is to take this line in code:
angle = (float) ((1-aa) * (angle + gyroangledt)) - (aa * x_accdeg);

and again, change the sign so now reads opposite of what it was before:
angle = (float) ((1-aa) * (angle + gyroangledt)) + (aa * x_accdeg);

It makes the accel interact with the gyro readings in opposite way to whatever it is doing currently.

Hope this helps

Thanks for your help John, I appreciate it.

I'd actually got past this point, but I'm still having trouble getting it to balance. It starts off well, then oscillates wildly out of control. I suspect the values in your sketch are not working well on this small frame (~500g).

I'm experimenting with overallgain, and also with the scaling variables in the balance_torque calculation (4.5 and 0.5), but I still haven't managed to make it balance.

Any further insights would be much appreciated.
XenonJohn (author)  grunff1 year ago
Here is one way of many to do pid tuning I have found on the web:
Set all constants to zero
1) increase prportional gain constant (currently 4.5) until it more or less balances but starts to oscillate wildly. Then set the value to about 1/2 to 2/3 this value.

2) Increase derivative gain constant (0.5 at present) so that when you tilt it one way it rapidly corrects in a damped sort of way, i.e as it get back closer to balance point the force of the correction drops off so it rapidly corrects without overshooting or oscillating.

3) The I gain is more what tends to keep it in one place. Keep increasing it until you get oscillation then back off a bit. If too high and you push it off balance machine will roll along, regain balance, then roll back the other way as the I gain was too high. I gain in this sketch is actually the cur-speed multiplier value So that is the line of code you need to play with.

I am not an expert, whole theses are written on this, but this is one relatively simple explanation i found on the web.

Thanks very much for that John. I will spend this evening trying to tune it :-)
Did you ever figure out the solution? Please tell!
My +5V and Gnd short out doing this. Any ideas? I think it might be that I connected both +5V together since there's only one +5V pin.
Solved it. I soldered a 1.8k resistor to the +5V, and it doesn't short out anymore.
grunff2 years ago
Hi John,

I hooked up my Arduino to my Sabertooth for the first time today, and ran the motor test. The output from the Arduino looks good. The deadman switch is on, and it is stepping through the motor outputs as it should. The DIP switches on the Sabertooth are set correctly, and the batteries and motors are all in place. But the Sabertooth doesn't power the motors - nothing at all!

I tested the Sabertooth in analogue mode just to check that it's good, and that side of it is fine. I stripped down the test code to just power the motors at 100%, and still nothing.

Did you have any problems getting the Arduino to talk to the Sabertooth? Any tips?
XenonJohn (author)  grunff2 years ago
Don't have any easy suggestions to be honest.

Only time my saber has refused to work was when I charged batteries so much they were producing around 37V. Saber decided this was too high so refused to work until I hed left it turned on for a while to drain the batteries a little.

I do know someone who had a faulty sabertooth which worked but highly erratically. He mailed me his Arduino/IMU and it worked fine on my sabertooth so he sent his back and had it replaced.

You could rewrite the code so it works using the analog inputs of the sabertooth.
If you look at the Instructable by Shane Colton that shows how to make a segway with drill motors, he has a sketch that resets the arduino pulse width modulation from the standard 500Hz (too slow) to a much faster rate.

If you smooth the pulses with an R/C filter so it JUST smooths out the pulses to a stable voltage (so retain the "instant" response time), then it could work.

One of my early boards used a non-arduino microcontroller, a PWM output of about 20,000Hz, with the ripples just smooothed with an R/C filter, feeding into the analog inputs of the sabertooth and it did work OK.

I used the serial link communication method in the instructable to deliberately avoid all this hassle!

Thanks for your help John. After spending much of yesterday playing with it, trying everything I could think of (including packetised serial), I am now 99% confident that my Sabertooth doesn't talk serial.

Rather than using the Sabertooth in Analog mode, I'm having a go at using it in RC mode. This is where it pretends to be a servo. I've used Arduinos to control small RC ESC like this. It does work fine, but I am concerned it wont be fast enough for self balancing.

There's an Arduino Servo library which does all the work for you, you just give each motor an input between 0 (full reverse) and 180 (full forward).

Will post an update on how this goes - I'm not convinced the response will be fast enough though.
grunff grunff2 years ago
Ok, here's the update. I've used the Sabertooth's RC mode, and modified John's self balancing code to talk to the Sabertooth as a servo. While the communication does work, the board will not balance. It tries to, but overshoots, and ends up oscillating back and forth.

Do you think the speed of the communication is the issue, or could solething else be causing the overshoot?
grunff grunff2 years ago
Another update :-) Got it to balance by cutting the servo output down to 50% (so instead of 180-90-0 it's 135-90-45.

Balances fine, but has a tendency to wander around the garden slowly on its own.
Tim003 grunff1 year ago

I hope you will receive this comment. Could you give out more information on what the problem was? I'm getting the same trouble as you did - system seems to react to late, therefore it does not balance correctly. Could you please share more about your solution? Thanks.

grunff Tim0031 year ago
Hi Tim,

I'm not sure you have the same problem, in my case it was reacting too much, overshooting. I fixed this by reducing the motor speed range (I was using the servo lib, because my sabertooth refused to work in serial).

I got the board to balance in the end. I then went on to build a smaller robot, which I never succeeded in getting to balance satisfactorily. It would balance for a while, but eventually would oscillate itself into the ground.

Good luck!
Tim003 grunff1 year ago
Hi grunff,

Sadly, I have never worked with a servo. It would be difficult for me to learn how to use one correctly I guess. I made a video though,

This is not the problem you get? I have to hold my board so that it somewhat "balances"..

grunff Tim0031 year ago
Hi Tim,

I think you definitely have a different problem to the one I had, looks like your motors are not responding fast enough.

Have you tweaked overallgain? Try increasing this from the current value, and note how this affects the behaviour.
XenonJohn (author)  grunff2 years ago
More on this:

Someone else has recently contacted me as he cannot get the sabertooth to respond to serial commands either.
I just wonder if some sabertooths have a fault with this as others do seem to get it to work OK.

Re: wandering around the garden: If you use a PID loop the "I" should stop it wandering too far.
As I am using something more like a "PD" loop in the code, it is only the rider who stops it rolling off in one direction by leaning back a bit when necessary.

Simplest explanation of all this I have seen is the SegWii project video and pdf tutorials:

XenonJohn (author)  grunff2 years ago
The second gyro is used to RESIST sudden turns when board moving along and no steering inputs being given by the rider.
This stops
a) Machine spinning you off if one wheel hits small obstruction.
b) Machine spinning you off as you come to a standstill after a run as one motor stops before the other one as they often have slightly different amounts of internal friction.

I learned all this by falling off!

Now, gyros drift with time, they are not the same as an electronic compass when used like this.
So, if you don't put in any steering inputs for a while, the "resist sudden unexpected changes is course" gyro will drift a bit and the board will start to meander around your garden as you say!

Tim0031 year ago
Here is a copy of my serial monitor. Could you please take a look?

I did test if everything was positioned correctly with the help of STEP 42. Everything is fine. The board just doesn't want to balance... it is way too slow to respond and get leveled again.

Is something wrong somewhere?
Tim0031 year ago
Hello John,

Thank you for this awesome project. I would like to know if you have anything to say on how to connect the sabertooth to the arduino? I can't seem to find anything written on this page nor on your website. Can you give me (and the rest of the community) some tips on what pins to use on the Arduino and where to place them on the sabertooth.

Thank you!

Tim003 Tim0031 year ago
Never mind this, I found the solution. It's on the schematic with the Arduino.
nimith1 year ago
Hi John,

Sorry to Bother you again,

I am new for the Gyro and ACC concept.

I got the 5 DOF( SEN-11072) from Sparkfun that have reg for3.0 v on board,

Connected as your schematic to analog port of Arduino,

Motor Test anticlockwise -- OK !!

Uploaded IMU_test_code and installed IMU board point the 2 hole downward to the floor and component side face to the back

Till to engaged and then test to tilt anticlockwise ACCEL Should go V+

like this :-

balance-GyroDegrees:-32.74 AccelDegrees:-9.48 overall Angle of Tilt:-52.60 accsum: 303.00

Tilted Clockwise :-

balance-GyroDegrees:-32.89 AccelDegrees:12.93 overall Angle of Tilt:-58.44 accsum: 277.00

and hold still to Level:-

balance-GyroDegrees:56.87 AccelDegrees:-0.70 overall Angle of Tilt:116.39 accsum: 292.81

so i will use 292 for the accsum then recompiled

But I think something wrong with Gyro sometime value stay at 0 or 450 and not statble like ACC number, is that Gyro already failed ?

I cannot get it balance Motor spin like crazy.

I think GYRO board already failed.

Thank you,


Tim003 nimith1 year ago
I'm actually having the same problem as you do. Did you find the solution to get the motor spinning at its max RPM?

nimith Tim0031 year ago
No, I still do not figured that out.

Hard to deal with yet, I might need to try to see why later .

Tim003 nimith1 year ago
I actually found a solution so that the wheels do not go faster then a certain percentage of RPM. Go to your code and search for motorpercent (sorry, the name might be different, I do not have the code in front of me) and change the value to whatever percentage you want your wheels to turn (max).

I m still trying to figure out why it won't balance itself though.
I know you put codes for controlling the overall gain, but which wires/pins do you connect the potentiometer to? My 10k potentiometer has 6 tabs on it (it's this one, will it work? Thanks
XenonJohn (author)  Pizzapie5001 year ago
Need to go back through the Q and A here as nearly every question you could think of has been answered.

The latest attached codes have the overallgain coded in at the top. You do not need a potentiometer at all.

I would start with the simplest version that is steered by push switches, then get more advanced later once you have it balancing.

The IMU: I soldered ribbon cable to every hole, although at the arduino end of the ribbon cable, I only used some of them, i.e. the ones I needed.

I did this as the IMU was buried in centre of one of my boards and hard to get to. Seemed good idea at the time to solder a wire to every hole and just tidy away the ends of the ones I did not need in the end at the arduino end of things.

I have just bought a Replicator from Makerbot so would be cool to see if could print bracket that could suppport my weight.

Remember chain needs to be JUST slightly loose but not so loose it slops around else you will get juddering when trying to balance in one place. Wheel axle mounting points should not be flexible!

Best wishes

To help anyone looking for the screwdriver to disassemble the nunchuck, it's called a "Triwing Screwdriver". It looks like a regular phillips screwdriver, except it only has three points, sort of like a peace sign. The Triwing is only a dollar and free shipping on ebay.
Hi! I'm new to electronics and stuff, so this may be an "easy to figure out" question. Anyhow, how come in the picture, the gyro has nine wires coming out of it, but in the arduino connection diagram, the gyro is only connected to six ports? Is it connected to something else than the arduino?
Hey! I created a axle wheel mount just for this!

I'm currently building this, but I didn't want to go through the hassle of working with the metal angle brackets, so I created a 3d file that can be printed out and used as a wheel mount. Specifically, it's measured for E100 Scooter Wheels, but you can change it however you like. I haven't tested/printed this yet, as my 3d printer kit just arrived, but is missing some parts. I will update when I do this (probably in a month or so).
Sorry for the double post, but here's an image of it and some specs: The entire thing is 3/8" thick. I think this should be adequate if made out of ABS or other strong plastics. As I said, I didn't test this. If anyone tries it, please let me know! If it isn't strong enough, just take out the triangular hole in the middle of the side of the mount.
Wheel Mount.jpg
Hi John,
I really want to be able to ride on somewhat rough surfaces and go over small bumps like cracks in a sidewalk.

Could you recommend any small pneumatic wheels that would work with your instructions that could mount under the skateboard but not raise the board too high?

I am concerned that it will be to hard to balance otherwise.

Thank you.
XenonJohn (author)  kevinsundar1 year ago
Yes, the rear wheels from the razor e300 scooter have pneumatic tyres. They seem to come with 2 sizes of chain sprocket fitted, ideally you want the bigger sprocket for slower speed but more torque.

I have modded my board to take these now so I know they work OK.

they come with drum brake system fitted so you have to remove all this and I also shortened the axles with hacksaw and welded a nut onto the cut end.

mbril1 year ago
Do I need this and if so do you know where i can get it from?
mjg23811 year ago

I have (2 )100W 24V motors from the E100 scooter, will these work instead of the 250W motors you used?
XenonJohn (author)  mjg23811 year ago
The first segway type machine by the sci-tech group in australia used 100watt motors from rear of scooters. They have a couple of instructables. So, answer is yes, at least on level ground.
mjg23811 year ago
If I wanted to make this a segway platform do I need to make any changes to the code? I would think there would be some changes in regards to the IMU since its position would be different.
nimith1 year ago
Hi John,

Sorry to bother you for some question-

1, I did finished the board and 5 DOF and it seems work on the IMU test enter my new level Accsum as you recommend and IMU engaged

2. Moter test worked perfect with Dead Man swith when released then stop

3. Just Balance nothing happen?

I do not know what is wrong, any help please?

Thank you for helping

XenonJohn (author)  nimith1 year ago
Note that I uploaded new version of the justbalance code quite recently.

In previous version the serial display was commented out. In this one it works and there are a few other things added that help with debugging.

I am pricing my materials and was wondering what gauge wire do you recommend for connecting the batteries to the Sabertooth?

XenonJohn (author)  kevinsundar1 year ago
At least as thick as wires on your motors, ideally thicker since you have 2 motors. Also make sure your main power switch is good quality.

I often use a double pole switch but wire up both sides in parallel to maximise the current carrying capacity.

nimith1 year ago
Hi John,

I just purchased the New replacement of IMU -5DOF from SparkFun and this one already have building Reg for 3v . Can I use the same code that you have ?

I believed the same of your configuration.

XenonJohn (author)  nimith1 year ago
I think it has its own built in voltage regulator.

I would check the data sheet but presumably you can run it from the arduino 5v line without blowing it up.

Check the datasheet first as the old one would definitely not work any more if you connected it to 5v supply. It would blow the gyro leaving you just with accel values!

I believed it said on the Sparkfun website


Full Scale Gyro Range: 500°/s
Full Accelerometer Range: +/-3g
On-Board Voltage Regulation
Input Voltage: 3-16V
Analog Output
Breadboard Friendly

But I already connect with 5V from Arduino and got the Acc.

cjustini1 year ago
Hi John,

I am going through the code slowly building up to the whole thing. One thing I am not quite sure how you got: why to you add up 7 readings for the gyros? Is this some sort of average, like the Savitsky Golay filter for the accelerometers?

XenonJohn (author)  cjustini1 year ago
Came to 7 by trial and error. Actually if you take mean of more than this it has increasingly smaller benefit. I just take 7 readings very fast almost at the same moment.

Sav Golay filter was nicked (borrowed) from a self balancing "TOBB" robot built by a proper engineer (TOBB stood for Totally Overengineered Balancing Bot). Very interesting filter as does not cause the "delay" effect that a rolling mean filter would cause. Lets more of signal through, with no time lag, and removes more of the noise. Worth reading about online. Even used in software to predict behaviour of stocks and shares for similar reasons.
Accel signal is v noisy so I was looking at ways to filter noise out. We use gyro for short term corrections and accel for long term correction of gyro drift.

New version of "just balances only" code uploaded tonight.

Thanks John, its very clear. I have managed to get an angle calculation using the gyro and accel combined, same method you suggest. However, I do not understand why we need a gyroscalingfactor, when in theory we are using the right units to get the angle... do you understand why this is necessary? Mine is closer to 3.0 rather than your 2.2.
XenonJohn (author)  cjustini1 year ago
No idea either

If you hold machine level, then tilt it to say 10 degrees, the gyro rates of tilting added very rapidly together will give you a new tilt angle of about 10 degrees.

If you then hold it still at 10 degrees tilt, the accel will,fine tune the tilt angle.

So, if you tilt it fast to 10 degrees and it reads say 5 degrees, then slowly settles to a reading on serial display of 10 degrees, your gyro is underreading the rate of tilt and then the accel gently fine tunes it.

This is what was happening so I ended up with a gyroscaling factor. It only seems to be an issue with the 5 dof analog IMU. I have a newer analog 6 dof one and it does not do this, the scaling facor is set to 1 with that IMU.

I know Sparkfun have replaced the old 5 dof IMU with a new version due to filtering issues so maybe this is what they meant.

dreniles181 year ago
Hey john i got my "Segway" to balance on Friday [i got my steering to work perfectly so no need and fixing that]................ and i have been playing with it ever since but i still have some question.
1. i got it to balance but when i step on it and lean forward a little it goes but if i go any father i will fall off same for when i reverse.
..............( all weekend i have been tweaking mostly every value AND still didn't fix what i wanted to fix)

but if you cloud help me out on this i really would appreciate it

thank you
aniles jr1 year ago
i almost done i have everything together i did the imu test and the motor test and everything worked fine. but i tried to put the JUST BALANCE code on it and i followed the directions and wired everything up right but when i bring it to balance point and nothing happened i tried to open up the serial moniter and it is blank..............can you please help me my project is due on 5/31/12 thank you for all the help.
XenonJohn (author)  aniles jr1 year ago
send me a message with a working email in it and I will send you variations of the code to see where the problem is.

XenonJohn (author)  aniles jr1 year ago
er, you mean as in 3 days from now?

tranct1 year ago
Hi John,
I am a beginner. As I see on Ebay lots of Sabertooth >But they are not the same with yours -
Please, could you show me where to buy this one
Many thanks
XenonJohn (author)  tranct1 year ago
I googled "sabertooth 2 x 25 buy" and here are a few webstores it came up with:

Where can I find a complete list of all objets to buy ?
XenonJohn (author)  tranct1 year ago
I didn't actually do one, naughty me.

Do it in stages.

Get mechanicals right: wooden board, brackets, motors, chains, Razor wheel sets.

Then start on electronics:
Battery to power Arduino initially

Also need sabertooth motor controller and 2 x 12V batteries.

I would not try this as complete beginner. I would make some Arduino projects first so you are fairly familiar with how it all works.

Merci John
XenonJohn (author) 1 year ago
The code can be altered so the motor speed is limited to 50 percent. Buzzer can be added to give warning when power reaches any value you want to set.

I have done all these things with my own projects. However, purpose of this instructable was to keep thiings fairly simple, more complexity means more things to go wrong.

You have to get it balancing first, then you add in clever features afterwards.

thank you how long do you thing it will take me to get it to balence
XenonJohn (author)  aniles jr1 year ago
Took me 3 sleepless months first time around. I have saved you so much hassle.
If you follow instructable sometimes people get the IMU back to front and things like that. Should be pretty quick so long as no faulty components or dry solder joints, misaligned drive chains and so on.

The IMU tester and motor tester software examples are there to help spot some of these basic problems before you get to the first self-balance test.
i appercatie all your help john i cant thank you enough i did the motor test and the IMU test and it worked perfect. but when i let go of the kill bottom it stops hard when it post to go to the next % this is how it went 10.00 20.00 30.00 40.00 50.00 40.00( let go of the kill switch) and then finish with the 40.00 then is stops hard when you let go of the kill switch is it post to stop keep balancing?

Thank you very much
aniles jr1 year ago
two questions how do i wire the POT for steering and i want to limt my motors to go 50% is there a way i could put a buzzer for when it gose above 50%?

thank you
XenonJohn (author)  aniles jr1 year ago
Pot has 3 connections. Suggest using 10k Ohm pots. Connect 5V pin to one of the side connections, GND pin to the connector on the other side.

As you move the pot the middle connection is connected to the wiper of the pot that moves over the carbon track inside it. This middle connection is connected to the analog input pin of the arduino for that pot.

When knob is in centre position, 2.5V will be read at the analog input pin, i.e. a
value of about 512 on the scale of 0 - 1023. If you do not know what this means buy a starter book of Arduino projects as they all describe how to control a motor or brightness of an LED using a potentiomer.

thank you
XenonJohn (author) 1 year ago
In the motor tester sketch motor power goes up to 50% in 10% steps, it seemed safer that way.

In main code for balancing machine, it can go up to 100%.

For the main code can i limit it to 50%. and when im useing the POT to steer do i turn the POT to the middle and then turn left to right?
and how do i wire the pot's
XenonJohn (author) 1 year ago
Motor tester should go to 10% power, then 20% then 30% then 40% then 50% then 40% then 30% then 20% then 10% then round the sequence again.

Make sure wheels are going in same direction, if not one of your motor wires are back to front.
XenonJohn (author) 1 year ago
Send me a private message with a working email address and we can correspond on this until problem fixed.

cjustini1 year ago

First, thanks for contributing such a great project and providing so much help. Everything is pretty clear, i am buying parts and will get started in the next few weeks with my kids. My only doubt is around the batteries. You suggest somewhere using other than Lead-acid. I don't mind spending a little more if I can get better weight:power ratio, for example. Where can I learn about battery types, chargers, optimum charger procedures etc.?

Thanks, will send you pictures once done, and hope to "grow" with many ideas from this design.

XenonJohn (author)  cjustini1 year ago
I used lithium iron phosphate battery 24V from an electric bike shop on ebay.
Lots of batty summaries and discussions on electric bike forums. Some ebike shop websites have battery discussions.

I would not waste 200 - 300 dollars on a battery like this though until you have your machine balancing on a couple of much cheaper lead acids.

I have also used 2 x 12v nickel metal hydride packs designed for large radio controlled racing cars in the past as well. These are not so far behind lithium these days but cheaper and the chargers are cheaper. Have to make sure they can give thie peak current your motors require.

Lots of online stores for RC car parts and battery packs to choose from. Also combat robot sites have battery packs in all shapes and sizes.

Hope this helps
Delpap1 year ago
Could you send the code please, my email address is:
XenonJohn (author)  Delpap1 year ago
Code is attached in several versions to last few pages of this instructable
aniles jr1 year ago
i know this seems like a dum question but if i put two arduino boreds toghter would it go fast like will it give faster resuslts.

thank you
XenonJohn (author)  aniles jr1 year ago
One goes plenty fast enough

If you want one to run the self balancing and for example one to read a wii nunchuck you can do that. To begin with though you just want it to balance, add all the clever controls later in the V2 rebuild.
ld'sa1 year ago
Hi Xenon,

i am working on a self balancing bot
even i checked out this website

but i need help with the variables to take in order for my code to perform calculations
because it is a digital IMU (6dof) i am facing a lot of problems as i am a beginner. If you could help me out i am will to share my details with you so other guys can also use it for their projects

XenonJohn (author)  ld'sa1 year ago
As beginner i would strongly suggest using analog IMU.
It looks as if sparkfun have released a new updated version of the 5dof one I originally used.
Would be worth getting one of those. There is also a clone on ebay of the original one still available, see some of discussions below for links.
Best wishes

I have only a week left to submit my project and also i am from India so it would not be possible to order another one from sparkfun.
If you could please provide me your assistance.
Thank You.
XenonJohn (author)  ld'sa1 year ago
On page 53 I have put a code example as a starting point for the 6dof digital IMU. Totally untested.
However unless you are pretty good at programming, i.e. not a beginner, I cannot see how you would be able to work on this and get all the bugs out of the code within 1 week. Sorry but true.

I am happy to help people and have done several times, but I do have a day job so it is just whenever I have some free time. If it is a college project with a deadline, contact me well before the deadline!

Best wishes
yes i tried getting the code from page 53 but i couldn't get a link to download. could you help me on that?

And my project guide is helping us out so he would be able to fix the bugs as he has used IMU for some sort of robotic arms...
XenonJohn (author)  ld'sa1 year ago
Example (unfinished) of code to read the 6dof DIGITAL imu seemed to have disappeared from my instructable. I have just put it back as an attachment to Page 53.

Hope this helps. If your supervisor gets it to work please do let me see the improved code as others would benefit from it.

Best wishes

i will surely give you the resources to my project if it works even 50%

thank you
ld'sa ld'sa1 year ago
in a comment i seen you have mentioned to use a 2.2K resistor what is the reason for it?
i have used varesano's code for testing my IMU and they worked just fine without the resistors...

one more question..
does ur code have the kalman filter?
XenonJohn (author)  ld'sa1 year ago
Some people ay if you are using I2C communication between an external device and Arduino you need two resistors, especially if the cable between device and arduino is long.
I did this with a WiiNunchuck for example and it did not work without the reistors. If yours works without then fine, go for it.

The Modified Varaneso software in my 6dof digital example on page 53 is I think a kalman filter.

All my working examples using the analog IMUs are complementary filters. I have rewritten one of these with a kalman filter and the machine balances worse than wheni I used the complementary filter so I have not posted it!

XenonJohn (author)  XenonJohn1 year ago
Sorry ignore last comment.
I used varaneso software to get me the angles, then i display them on serial view window and that is it. Have not added all the self balancing part yet from my previous code versions.
Angles are zero whe balanced, then go negative or positive depending on direction of tilt fro level position. Same for gyro except now they are in degrees per second.
ok so i pass those angles and gyro values into the old code and hope that it works?
yes i also went thru the schematics and they have included on board resistor...
but thanks for the info...

it will stay in my head
XenonJohn (author)  ld'sa1 year ago
In theory yes!

You will not need the gyro scaling factor in old code, just remove it or set it to 1

Best of luck

have one more doubt..

in your motor calculations the tilt angles and gyro rates passed are in degrees and degrees/sec respectively? or are they the raw values?
XenonJohn (author)  ld'sa1 year ago
I get raw databthen convert to degrees for accelerometer values and degrees per second for gyros. Commented saying where I do this.

later on in the examples (not the only part finished 6dof digital example) I then convert to smaller values to get the scaling correct for the motor driver part of the software.
If it seems odd it is because the code has evolved by trial and error.

All the examples need a complete rewrite but on the other hand they do work as they are, which is always useful!

Best wishes
aniles jr1 year ago
Were should i place my gyro im almost done :D
XenonJohn (author)  aniles jr1 year ago
In theory gyro should be in centre but in reality it does not matt that much. See the segway builds on instructables by the scitech group in Australia
2012-04-20 08.50.05.jpg
aronzitti2 years ago
for set the accsum variable
i have insert in the foot of Setup() subrutine:
delay(3000); //3 sec delay
digitalWrite(beepPin, HIGH); delay(100); digitalWrite(beepPin, LOW);
for (int i=0; i < 50; i++){
fSetup += analogRead(accelPin); //read the accelerometer pin (0-1023)
fSetup /=50;
XenonJohn (author)  aronzitti1 year ago
That does make more sense. I am working on a new project where I have added a $2 piezo buzzer. If you have a buzzer it is also very good to make the time delay between each beep proportional to (i.e. a multiple of) the measured tilt angle, in the tipstart routine. This means as you first bring it level after turning machine on, the beeps become faster and faster so you know exactly when the tiltstart is about to go active (continuous tone).
XenonJohn (author) 2 years ago
These look OK.

I have uploaded slightly tweaked version of the IMU tester. It will now show accsum in serial view window (it was commented out).

Best wishes
XenonJohn (author) 2 years ago
Good news.
Sparkfun have released an updated version of their 5dof analog output IMU.

IMU Analog Combo Board - 5 Degrees of Freedom IDG500/ADXL335

Part number SEN-11072
So, everything is OK again.

pumo2 years ago
I got today ebay 5dof, I try to find time tomorrow night so I'll post here did it work with imu test.
one question do I need anymore those pulldown resistors to digital input?

there have been replacement for 5dof from sparkfun :
XenonJohn (author)  pumo2 years ago
If you alter code slightly you do not need the pulldowns.

Essentially you set the internal pullup so it is HIGH and pulled up to 5V.
The pushbuttons then connect the digital pin to ground(GND) i.e. pushing button pulls the pin down to 0V.

Best wishes
pumo XenonJohn2 years ago
thanks I try (I am newbie with arduino) :)
just tested IMU tester code with ebay clone 5dof works!
XenonJohn (author) 2 years ago

When you download the Arduino programming environment, softwareserial is a library that should come with it, built in.
It is a bit of code that allows you to send serial commands using any of the digital pins on the arduino.
It is standard with all versions of Arduino beyond V6 so should not cause you any problem.


Best wishes
aniles jr2 years ago
can i use The E150 motor that seems to use 10 Amps. with this motor controller and two 35ah batterys please HELP ME
XenonJohn (author)  aniles jr2 years ago

I have been answering your numerous questions now for over a year.
The answer to this particular combination you have given me is yes, probably will be OK.
The Ah of your batteries reflects how long it will run for. You also need to know what maximum current is that it can deliver in a short burst. If you have 2 motors drawing 10 Amps then battery has to be able to provide 20 Amps at least for a short while such as when going up a hill.
Motor controller has to also cope with 2 x 10 Amps if using two 10 Amp motors.

Therefore, with two 10Amp motors, you would only need a 2 x 25Amp Sabertooth for example.

You have to match all 3 components to each other and make sure motor controller has some spare current handling capacity to reduce risk of meltdown under high loads (remember if you hold your 10Amp motor stalled, it will draw way more than 10 Amps).

Time to have a go and build something. Go for it.
thanks but would it be better if i got the 2x25 amp sabertooth because im just sarced that my motors will burn out (can you just help me out on this one because this poject needs to be done before 5/30/12) SORRY FOR THE BOTHER
XenonJohn (author)  aniles jr2 years ago
Watts = Amps x Volts
If your motors are 10 Amp at 24V then they are about 240 Watts each.

A 2 x 25Amp Sabertooth would be fine.

Motors will not burn out. If you put 24V across them and they are 10 Amp 24V motors, then they will draw around 10 Amps. The Sabertooth does not try to "force" 25 Amps into each motor. The motors draw the current they require from the battery, the Sabertooth regulates that so that they do not just run flat out all the time. The thing that might burn out is usually the motor controller if the motors are held stalled - when they will then draw much more than 10 Amps.
However the Sabertooth has protection circuits that will shut it down if too much current draw through it.

If your motors are 10 Amp then you could even use the smaller Sabertooth.
i cant thank you enough

But i decided to keep the 2x60 and im going to get a bigger motor that peaks at 2.3 horse power and the amps are 28 and its rpm at 24 volts is 6900 the only thing i need to find out is what tooth sprocket do i need to attach to the wheel the diamter of my wheel is 14 in. So can you work with me to find that out

Thank You
XenonJohn (author)  aniles jr2 years ago
You need low speed high torque, not high top speed, at least initially when developing and learning.

Use a big sprocket on your wheel say at least 6 times as many teeth as on your motor sprocket, or maybe even more. My original monowheel board had a sprocket on the wheel that was almost the same diameter as wheel/tyre itself, only slightly smaller.

Best wishes

XenonJohn (author) 2 years ago
Clone of Sparkfun 5dof IMU found on ebay:

This clone IMU on eBay looks exactly like the SparkFun 5dof analog output IMU that they have now discontinued. Price is good too.

This may help a few people.

XenonJohn (author) 2 years ago
Code is written for the old 5 DOF IMU with analog outputs but nobody can find one for sale any more.

This is why I attached a version of the code for a 6DOF "Razor" analog IMU which is being discontinued but some stores still have a few in stock (be prepared to buy from anywhere in the world).

I am currently working on code for the 6DOF DIGITAL IMU from sparkfun as soon this will be the only one you can buy.

Best wishes

pumo XenonJohn2 years ago
Thanks for your help and info, I did order that 5dof version from ebay if it wont work I just have to find 6dof analog.
Or if no luck with that I just wait your 6dof digital version code...

BuildWiz2 years ago
Hi! I was just wondering if it was possible to use two motor controllers for this? and if so how would you connect them? I was looking at this one:

Thank you,
XenonJohn (author)  BuildWiz2 years ago
You can definitely use one syren so can probably use two.

Would have to set up another pair of pins as serialports for the second syren as I currently have for the saberserial.

Would then send all motor1 output to syrenserial1 and all motor2 output to syrenserial2

Dont really have time to write it and debug for you but that would be the general idea.

Best wishes

Nikotine2 years ago
Hi! Amazing build log!
I found a website where you can buy Razor parts ( They sell three kind of rear wheel assemblies, for different versions of scooters. Does it matter which one to get? Will the teeth on the sprocket match the one on the motors you find on ebay?
XenonJohn (author)  Nikotine2 years ago
The chain driven E100 scooter rear wheel (solid tyre as in this instructable) and the E300 rear wheel (small pneumatic tyre as in example shown near end of this instructable) both use the same chain type.

The Chinese electric motors sold as "scooter motors" have sprocket on them which fits this chain.

So, not sure what the 3rd type of wheel is but certainly for 2 of them the chain is the same type.
Hi XenonJohn, thanks for the quick reply!
Well, there's three types, depending on the version E100 you have.
See this page:
The page doesn't say what the actual differences are between versions... Only that you should pick the right version or it won't fit, so there must be differences...

Perhaps I will buy bigger wheels like these:
For doing a bit Segway off-roading :-)
skynard2 years ago
Hi XenonJohn!

Would the razor e100 chain driven wheel fit onto a Razor E300 MOTOR ST09 (24v 280 W) instead? Does the sprocket size fit towards each other ?

link for the motor

Thank you.

XenonJohn (author)  skynard2 years ago
Yes I think chain is the same type.
schabanow2 years ago
> Gyro is L3G4200D, Accel is LIS331DL from ST.
Both are of 3-axis and I2C.

XenonJohn wrote> I can search the web, find some code examples and supply a draft (untested) version of my code so one of you guys with the new 6DOF digital imu can test it out.
Yes! Would you please to do it for us as well? Let's come together - hardware enthusiasm and software experience! ))

XenonJohn (author)  schabanow2 years ago
I have just obtained a Sparkfun 6dof Razor analog IMU board. It works fine but scaling constants have to be altered a little.
This is only a stopgap as although many places still have it in stock, it is also being discontinued.

To get an arduino to read data from the Sparkfun 6dof DIGITAL IMU, this website is the place to start and they have sample code:

If somebody who really understands I2C communication can write a well commented sketch that gets the arduino to read the accel angles in degrees and gyro rates of angular rotation in degrees per second from this IMU, it would very helpful to everyone else as all the IMUs now slowly seem to be going digital.

Anyone out there want to have a go? I for one would appreciate it.

hello john, where did you get the 6dof razor analog imu? can you send me the store name... thanks...
XenonJohn (author)  free2flyus2 years ago
You could try these, they are UK stores:

This shop may still have some 5dof analog sensors left by the look of things:

thanks john... got one from
Unfortunately I'm not a programmer. But I'll ask my guys - maybe one of them will find some spare time to help us. What kind of sketch do we want to see? Exact one for your model, or principal well commented frame code for all I2C-compliants?
XenonJohn (author)  schabanow2 years ago
Hi, if you can do this it would be great for all self-balancer builders and worth putting on one of the Aduino forums as well.

We do not need all the data from all 3 accels and all 3 gyros to self-balance, but if writing a general purpose sketch you might as well read all of them.

Basically you would want 3 variables x_acc, y_acc, z_acc which vary according to the output from each accelerometer.
Currently with analog output IMU's you get
i) a low voltage output when each individual accelerometer is held upwards relative to (downward) force of gravity,
ii) a high value when held downwards relative to force of gravity, i.e turned 180 degrees from the previous position and then
iii) a mid-value when held horizontal
These are on the scale 0 - 1023 at present as we use the analog inputs on the Arduino to read the voltage from each axis of the IMU.

We then have 3 more variables: x_gyro, y_gyro and z_gyro.
These give an output proportional to the angular rate of turning in the plane of each gyro.
When stationary the gyro ouputs a middle value. When rotating clockwise it increases and when actively rotating counterclockwise it decreases by an amount proportional to the angular rate of turning, eg degrees per second. The ideal units here would be degrees per second, -ve values being counterclockwise rotation, zero being no rotation and +ve values being clockwise rotation.

To be honest though so long as the arduino can read the data, these scaling issues can be sorted out later if necessary.

It would be nice to have one for all I2C compliants but for now the 6dof Sparkfun one seems to be the lowest priced one that people will use for next year or two.

If you need more dof than 3 accels and 3 gyros, then you are entering DIY drone territory not just self-balancing!

All hobby IMU's will be digital soon so this is worth doing for the whole Arduino community. Hope you can manage it.

All the best
I see. I'll try to do sth.
XenonJohn (author)  schabanow2 years ago
Example code (not fully tested) for 6dof DIGITAL Sparkfun Imu attached to page 53 of my Instructable.

Here some Arduino--I2C' videolessons for the meantime - I'm sure you can find these without Russian audio:
XenonJohn (author)  schabanow2 years ago
Hi Alex

If you want to have a go with the 6dof DIGITAL Imu from Sparkfun, then here is some code.

Only tested as a sensor / arduino combo so far but all the values it gives look about right so is a reasobale chance it will self-balance.
I have built it into my existing code for the rocker switch/button controlled self-balancer.

Attached to page 53 of my Instructable.above.,stepId=SZGO7T3GZKE1JXL

> Attached to page 53 of my Instructable.above.

Hi John! Thanks for the link, I've posted it at our forum; hope it will turn to be appreciable one.

ps: It's a pity but I have no news on sbj from our community yet.
schabanow2 years ago
Hi XenonJohn!

We're at the very beginning of our long way to balance )) with our DIY IMU-shield for Arduino Uno platform. Some pictures are below.

Gyro is L3G4200D, Accel is LIS331DL from ST. Few days ago we already get raw data from both of them and last week we're just almost in heaven. )) Yes it is, but yesterday I came to conclusion we have to go further. Some googling - and I'm here!

1. What can we do now in order to build our table-top little balancer (not skate-like)?
2. Does your code work properly in conditions when Z (vertical) acceleration work? In other words - will your skate keep its balance been put on the plain and smooth but VERTICALLY MOVABLE surface?

Alex and Alex.
XenonJohn (author)  schabanow2 years ago
I may be wrong here but as I see it:
Gyro responds to angular rate of rotation and is vibration insensitive so that should still work fine.
Accel will alter its readout while flat surface on which machine rests is actually moving upwards or downwards, but not when it has finished moving up or down.

Input from accel is used to correct gyro drift over time so if small movements of the table top occur that do not last very long, then it will probably waver but tolerate it. If tabletop up/down movements are regular then they may well cancel out allowing accel to do its job. If they are random - not sure what would happen.

The answer is that short term balancing mainly taken care of by the gyro so small pertubations may be tolerated.

Q: Why is your surface moving up and down anyway?
Q: Why is your surface moving up and down anyway?
We gonna make a model of A-4 rocket with gimballed motor. Extremely slow and due to this - REALISTIC vertical lift-off during approx. 10 sec up to the height about 20 .. 30 meters. And then rescue with a parachute.
XenonJohn (author)  schabanow2 years ago
Cool - as in the A4 rocket otherwise more well known as the V2?

Of course some men in grey suits might turn up and persuade you not to.

I can think of some politically incorrect names for your Arduino shield.

Another application would be to control inherently unstable model RC aircraft such as an exact copy Wright Flyer.

I think it would be OK but will chat with a friend who knows all the maths around attitude measurement.
A4 becomes V2 afterwards. A4 - rocket of human genius, V2 - its dark side, slaughter, nazi, and so on... Human history is full of paradoxes.

As for "grey suits" - we live here just in wonderland where you can found yourself in cell for million causes, so A4' model doesnt gain or diminish anything to your karma. Relax. ))

No "another application". A4 only. My dream. ))
XenonJohn (author)  schabanow2 years ago
Another site / sensor to look at for your rocket is the ArduIMU from DIY drones.

It uses I2C I think again and they have link to sample code towards bottom of this web page:

Again, looks way too complex for me, it seems to do almost everything except make you a cup of coffee as well. All I want is a not-too-enormous block of code that gets me the raw data from the 3 accels and the 3 gyros.

On subject of a related paradox: I read an obscure book recently showing how an engineer who worked on the pulse jet of the V1, especially the shape of the exhaust, crucial for pulling more air into the front end, "ended up" working for MZ motorbikes in East Germany making exhausts for their unfeasibly powerful small racing engines. He then defected, went to Suzuki and shortly after that Suzuki starting winning world championships. Similar (and very noisy) extractor exhausts can be seen even now as aftermarket add-ons for small scooters.
(removed by author or community request)
Crooked link I'm afraid... :( "Cannot be found" - I'll try it again later...
XenonJohn (author)  schabanow2 years ago
Hi again,

I think I may have found what I need here. Near top of blog are 4 code examples. 2 of them seem to read the Sparkfun 6dof digital IMU and gives raw values for the 3 accels and 3 gyros.

I will try modifying one of these and see how I get along.

Best wishes

best thank to you john... i am looking forward for the code coz the 6dof (analog) is gone in the market..
> All I want is a not-too-enormous block of code that gets me the raw data from the 3 accels and the 3 gyros.

Well, should I give you those sketches we used to get diagrams above??? For I suspect my amigos are too busy amigos ))  to help us with special tutorials on I2C now. Can you edit all the proper addresses and register' names according to your actual hardware?

Concerning MZ - very interesting... Kurt Tank turned out to be much less successfull with his post-war jet-fighter in Argentina. MiG-15 - Soviet compilation of german war-time projects... Many revelations of that sort became well-known to public nowadays here in ex-USSR.
webber992 years ago
Hello guys,

i'm webber, a newbie to arduino and IMU stufss but i'm trying it for my hobby. My question is this, will the code still gonna work if i use different IMU board, because the IMU board used here is already out of stock. i hope someone could answer me, i already bought IMU Digital Combo Board - 6 DOF (ITG3200/ADXL345) from sparkfun. in case the code will not work, what should i study to make it suitable for the IMU board? thanks in advance and more power!
XenonJohn (author)  webber992 years ago
The old boards were analog, i.e. they put out a varying voltage to each of your arduino analog input pins, nice and simple to just read voltage on each pin.

However newer ones seem to have digital outputs so my code examples will not work without some code alteration to read the digital data coming from the IMU.

I can search the web, find some code examples and supply a draft (untested) version of my code so one of you guys with the new 6DOF digital imu can test it out.

Keep an eye on page 1 of the instructable as I will put a note on page 1 if I do manage to find some time to do this and attach a code example.

Best wishes

justinpruss2 years ago
Here's a good one....Anyone have an issue with 24v?

I'm using a SyRen 25 (just one motor) and when I use 12v I see a small kick at start-up and then its fine.....tiltstart works and etc.

When I use 24v instead of a small nudge, the motor just takes off.....any ideas?

I have 12v going to the arduino (freeduino 1.2) and the imu is getting 3.3...not sure what is going on.
Hello, I'm very surprised by what you managed to do, congratulations. Inspired by your project I would also like to realize in my school in Italy, however, starting from a lower level until you get to 'self-balancing. The problem that I know basicstamp parallax. I have a problem in programming arduino 2009 to perform simple movements with this yojstik
The two motors (left and right) should say:
- Both forward (acceleration ramp%)
- Both backward (with ramp acceleration%)
- Turn right (starboard engine spins up)
- Turn left (turn left engine plane)
- Do you reverse right or left (respectively, the engines run against each other).
I use two 180w 12V motors
Arduino 2009
yojstik assembled on Arduino as links.
I suppose you are super busy but I'd be very grateful if I persuades a tip on the Arduino programming and electrical connections.
PS: I build the vehicle has two front wheels and rear swivel type robots.

Sorry so much for English .... I'm Italian!

Hello and see you soon!
TigrisLi2 years ago
Could you give the names of all the parts please?
dariokristo2 years ago
Hello everyone,
For people who are interested in making a remote controlled two wheeler, check this out:
Howdy! ,
I have just recently tackled this project to use daily taking me to and from class. However i was wondering if this system is stable enough for daily use or just time to time to show off to your friends.. I will be using 2x 300W motors instead of 250.

You can fallow my project at

XenonJohn (author)  looking4ideas2 years ago

Good luck with the project. All depends on how smooth the paths are at your college. If very rough use the E300 wheels with pneumatic tyres (note they seem to come with 2 different sprocket diameters depending on the website you look at).
It is stable enough otherwise. Check out video No.9 on the front page of this instructable. His has 300 or 350 Watt motors and lithium batteries.
Make sure your deck is thick enough wood/metal so it doesn't bend under your weight and slacken off the drive chains.....this adds unintentional instability!
Curtis 1092 years ago
Hi, I was very impressed with the self balancing skateboard and I thaught I am going to build one but as a segway, I used the same parts just put the wheels further appart and fit a handlebar. So far so good the IMU test worked out good it leveled at 340 which is close to Johns recommendation of 338, the motor test is perfect.
with the balance test I seem to have problems, I lean it forward count to 5 then activate the deadman switch and slowly bring it level and just as it gets level the tiltstart kicks in but it doesn't selfbalance at level the motors stop if I tilt it slightly forward the motors move forward if I tilt it back the motors reverse and the more I tilt it the faster it will go, of course let the deadman switch go everything stops.
What am I missing out on? I,m not a programmer nor have I an oscilloscope.
Any help would be much appreciated.
XenonJohn (author)  Curtis 1092 years ago

Jan 15th 2012
I have attached new sketches in addition to the old ones to pages 43 to 47. Old ones ran in Arduino 22. Latest version of Arduino environment is V1.0 and it has a different sofwareserial library and commands.
New sketches same as old ones but
a) Run in latest Arduino V1.0 and
b) Have the bug fixed regarding orientation of the accelerometer (I think).

Change this line of code: x_accdeg = (float)((accsum - (338 + balancetrim))*0.862); //approx 1.16 steps per degree so divide by 1.16 i.e. multiply by 0.862 with,
x_accdeg = (float)((accsum - (340 + balancetrim)) * (-0.862)); //approx 1.16 steps per degree so divide by 1.16 i.e. multiply by 0.862. We actually use -0.862 as accel is wrong way around relative to gyro.

It should work.
Thank you heaps dariokristo, it is balancing now all I have to do is to adjust the take off speed as present it is taking off too quick when I only give it a slight tilt.
Again, try changing this:
angle = (float) ((1-aa) * (angle + gyroangledt)) + (aa * x_accdeg);
with this:
angle = (float) ((1-aa) * (angle + gyroangledt)) - (aa * x_accdeg);

XenonJohn (author)  dariokristo2 years ago
Hi folks,

Sorry about this bug.
If your board powers up when roughly level (i.e. tipstart becomes active) then tries to balance but with a balance angle that gradually drifts (i.e. it leans more and more to one side while still balancing OK) it means the accel is not correcting for the inherent drift in the gyro and is acting in wrong direction.

Remember, the gyro corrects small instantanous wobbles of the board while the accel slowly, over a long period, gently corrects the drift in the gyro zero point. This is why, with the above accel fault, it self balances OK for a few seconds but at a gradually changing angle.

This is why changing this:
angle = (float) ((1-aa) * (angle + gyroangledt)) + (aa * x_accdeg);
to this:
angle = (float) ((1-aa) * (angle + gyroangledt)) - (aa * x_accdeg);

usually fixes the problem.

I will do a comprehensive code revision soon as I am still working on similar machines and still learning all the time. The code here evolved by months of trial and error and really needs a full rewrite!

Arduino sketches exist to "read" data from arduino nunchucks. I have even done an instructable on that. If anyone has the time to merge it with the self balancing code, and get it all to work, please go ahead. I am just short of time to work on these things right now.

XenonJohn (author) 2 years ago

Motor with a built in controller could be used if arduino can talk to the controller OK.
Remember it has to be able to go from forward to reverse with no delays or problems. Also need high torque ideally.
However the motor web page you gave me the link to shows brushless servo motors with integrated encoders (position encoders). These tell an external brushless motor controller how to turn the motor.
I could not see one there with a built in motor controller.

I have stuck to brushed motors with robot H-bridge controllers for now as brushless controllers seem more complex to get control of with an Arduino board.

If anyone knows how to reliably control an affordable hubless motor controller with an Arduino I would like to know as then I will get a 1000Watt Chinese e-bike wheel with brushless pancake hub motor and build a self-balancing unicycle!

tracer11lb2 years ago
sorry here is the link of the motor I want to use
mgrachev2 years ago
Hello! I don't have an oscilloscope, how can I measure the cycle_time? Thanks. I'm trying to use your code on an Arduino with Lego and some servos, but I have to tweak the Motor output signals. Thanks for the help! Awesome instructable btw
XenonJohn (author)  mgrachev2 years ago

The code unlike earliest versions now has a timekeeper routine added.
This works out how long one cycle of the program loop has taken in milliseconds, then adds a variable delay so that the overall loop time is 10 milliseconds. This means program will loop round at 100 times per second so long as it is not so unwieldy that just doing all the calculations takes more than 10 ms.

Therefore the code that sends a pulse out to an oscilloscope is there just so you can double check how fast the program is cycling. Not actually required for the setup process so long as code all working properly.

Looks like Universal Pictures likes The THING you built!

Check out the scooter the boy is riding!
XenonJohn (author)  BeerBellyJoe2 years ago
I like it.
Wish I could ride mine in real life as well as he does in this cartoon!
dhteam2 years ago
once again thanks for your insight in regards to my question before about running from a power supply as well as the usb cable in the tuning stages my self balancing scooter has come a fair way since then but ive hit a small problem and was wondering if u had any suggestions to help me out ???

here is a link to my board running :

the problem im experiencing is the shuddering in the entire board when changing from forward to reverse or reverse to forward , im pretty stuck im thinking its a program fault , maybe when changing directions i need to add a delay or a way to ramp power up, any guidance would be much appreciated
XenonJohn (author)  dhteam2 years ago

I get this if the chain is a little too slack in my drive system plus the overall gain is too high.
In the wheelchair mechanisms you have, there is a little backlash in the gears. You get rattles around the balance point when stationary, as motors flip from forward to reverese and back, these are transmitted into the gyro/accel unit causing more trouble.

When rolling along you do not have the problem as motor controller is not reversing direction, just providing variable forward power.

3 possible solutions:

Let us imagine you calculate a torque value to send to each motor and then you multiply that by a value called "overallgain"
a) Reduce your overallgain.

b) Let us imagine the range of torque values that can be sent to each motor is
-100 to +100 (zero being stationary), then when the value is between say -4 to +4, then within this range reduce the overallgain to half what it is otherwise.

c) Make the overallgain value increase proportionally to the desired torque value in each direction (so it is low around the mid i.e. stationary balance point).
Actually might be better to make the overallgain a low fixed value, than ADD to that a small additional value proportional to the torque (which has a maximum possible value about the same as the baseline fixed value it is added to).

I think these would help. Need to do some experiments but b or c might be the things to try out.

Best wishes

dhteam dhteam2 years ago
i helped reduce this problem significantly by having overall gain relative to angle of the board, still not great but better result.
XenonJohn (author) 2 years ago
Just to report........... I looked at the video he sent me and we did sort it out.

i think you can use a relay instead of that switch :D good luck
jmunsami2 years ago
Thanks for an amazing tutorial once again john. I really want a pressure sensor driven one... so i guess ill have to wait!

So anyway... I was thinking about what motors to use. I want to use one of these motors, but im unsure which one, and if the sabertooth will be enough to handle it.

Ive also found this battery which can handle the juice.

thanks :D
XenonJohn (author)  jmunsami2 years ago
The E150 motor seems to use 10 Amps. All the others use much more. The Sabertooth is 2 x 25 Amps (40 Amps for short periods).

However the main draw on a motor controller is when the motor is held stationary by mechanical obstruction, too steep a hill, and so on.

The Sabertooth does have overload protection that shuts it down allowing it to live to fight another day, which is good.

Also there is now a more powerful Sabertooth I believe that will take higher currents if this is what you want.
can i use this sabertooth

thank you
XenonJohn (author) 2 years ago

Send me a message with a working email and I will correspond directly with you.
Make a video of it, put it on youtube for friends only, send me the link. I can tell a lot by just looking at how it behaves.

Best wishes

aniles jr2 years ago
wat motor would be better the on u used or this
dornseif2 years ago
I have been able to purchase all other items for this build except these. Cant seem to find an online source for good brackets. I am in South Carolina, any idea where I can obtain them on internet?
aniles jr2 years ago
and wat motor would be better the on u used or this
aniles jr2 years ago
how long can u ride ur untills it dies
dhteam2 years ago
hey thanks "XenonJohn" for this tutorial it has been a big help i have used this and a few others and a lot of researching and incorporated them all together my code seams to be working alright and a balancing bot feels not to far away ,my question is in regards to powering the board by a second source as well as the usb cable , i was wondering what happens if u dont? and if the change is noticable? i have been using only my usb cable when debugging and testing software .

XenonJohn (author)  dhteam2 years ago
I found that the accel readouts changed when running the debugging "IMU tester" program when using the USB power.
When the board is running it will have its own power supply so recommend using that when using the IMU tester, especially as can use the IMU tester code to find the perfect balance point of your board to enter into the code of the full balancing software.
alexw21502 years ago
Cool, but I have a couple of inquiries;
Firstly could I use this( ), because I have a couple floating around the place.
And secondly could you make it as an assist for a pedal (with brakes) bike like this ( ) (with the back wheel taken of)?
XenonJohn (author)  alexw21502 years ago
Re DIY drones arduino, yes you probably could use this!

Not sure if it could act as an assist to a pedal recumbent bike.

Could however probably use pedal power (cautiously) in combination with a self balancing system so long as pedal derived top speed did not exceed ability of electric motors to accelerate further if starting to tilt forwards.
Cool thanks,
aniles jr2 years ago
thank you for answeing all of my qustions but i have a few more

im building a segway and instead of putting left-right on a SWICTH iwant to lean the handel over to the left to turn left and the father father i push it to the left or right the tighter the turns. would this mean i would have to put the gyro some were in the steering bar? and how much would i have to change in the code?

XenonJohn (author)  aniles jr2 years ago
I have attached a version of the code that allows you to use a potentiometer to steer the machine.

If you fix the potentiometer to the movable steering arm, it should work.
Code changes required: None or minimal.

Gyro/accel best placed in deck of segway in centre ideally.

How far have you got with your machine?
Best wishes

for the potentiometer would it have to go left and middle and right

im just mapping were every thing is going i m also desigining the base for it
alexw21502 years ago
I just had a thought, you should add a pressure sensor, so that if no one is on it (no pressure) it doesn't activate.
aniles jr2 years ago
can i do this set up?
XenonJohn (author)  aniles jr2 years ago
aniles jr2 years ago
another question can i put the 2 motors in the middle connected dirctly to the 2 wheels?
XenonJohn (author)  aniles jr2 years ago
No, motors would not have enough torque (twisting-force) so you have to gear them down, and a small chain is easiest way.

You can get 250 Watt electric wheelchair motors with gears inside that do a similar thing (motor spins fast but wheel goes round more slowly - but with more torque).

This is also why toy electric scooters also use a chain drive and do not have wheel directly on the motor.

Best wishes

aniles jr2 years ago
if i want the motors to run at full speed can i get this to do that
XenonJohn (author)  aniles jr2 years ago
Is this a new product?
This has been designed for big combat tank style robots and ride-on vehicles.

Control inputs and performance all the same as the 2 x25 sabertooth, just twice the power, so it should work. Looks ideal for a bigger segway style project if you need to go up steep slopes.

Your batteries have to be good enough to supply the current however otherwise you would just be wasting money.

Also motors: Mine are 250 Watts each. Watts = Volts x Amps so if running at max power from 24v battery pack then you would be using 10.4 Amps per motor. Therefore the sabertooth 2 x 25 would still be more than capable. So only spend money on 2x 50 if you are planning much bigger motors.

Motors could draw much more current than this if physically jammed/stalled, however the sabertooth will shut itself down in that situation to protect still OK.
ok thanks

but then how come u said i cant run the mottors at 100%?
XenonJohn (author)  aniles jr2 years ago
I don't think I did say you cannot run the motors at 100%.

People have built machines that balance a human on a level surface using motors as small as 2 x 100 Watt. I am using 2 x 250 Watt motors in my boards. A real Segway has much more powerful motors than that.

To summarise, to balance on level surface, motors do not have to be huge, especially if using reduction gearing or the chain equivalent (i.e. large diameter sprocket on the wheel + small diameter one on motor).

For fast acceleration , high top speed and/or especially if you want to go up hills, you need a lot more power in reserve.

If you run motors flat out, you will fall off front of machine as it cannot speed up any more to stay balanced under your centre of balance. Therefore unwise to command motors to run at full power, best keep a little in reserve for this reason.

Motors, motor controllers and batteries have to be well matched. Batteries have to be big enough to provide the max current the motors can draw. Equally the motor controller has to be up to the job and be capable of handling that current as well.

All this is secondary though. The hard part is achieving self-balancing. You can experiment with huge motors/motor controllers and batteries later on if you wish to make the financial investment - which will be considerable.

ok thanks
jmunsami2 years ago
Im thinking of using a LEAD battery permanantly instead of lithuim polymer. I plan to use a 75Ah 12v battery
and use a converter to make it 24v
Is this a good idea?
Also.... Is it possible to make the hand controller wireless? (bluetooth)
XenonJohn (author)  jmunsami2 years ago
The 12V to 24V converter only handles 3 Amps. Although when these machines are rolling along a smooth surface they dom't actually use much power, when tipping over they will throw a huge current into motors so machine accelerates to get itself back underneath your centre of mass.

So, for self-balancing machines you do need some reserve.

Also when going up a slope the current draw will increase considerably.

I would use two 12v batteries in series. Lead-acids are fine, in fact they can provide high current for short periods - exactly what we need.
I would only invest in more expensive batteries once you are happy your machine balances OK.

I have one machine that uses a wireless Wii-Nunchuck for the "deadman" switch function and steering. Works fine but in public exhibitions it can get swamped by too many people using cell phones and so on, it loses connection (scary).
See here for how to do that:

I also have a wired Nunchuck Instructable - not as cool but more reliable!

Thank you John :D

Im planning on using the same motors as you... are these the ones?

Can you use bluetooth to link the nunchuck?(if it doesnt already use that LOL)
I now plan on using these batteries

, 2 to make a 24v system. I was wondering... what batteries do you use and how much battery life does it give you? I was hoping to use this for at least 3 hours.
I want a design like your carbon fibre pneumatic system... but dont have access to welding and metalwork facilities. Is it possible for you to make me one and me pay you? Speaking of pneumatic, how much benefits to the pneumatic tires give?
Also could i use the pressure sensors on the board to make a dead switch?
Excuse me for asking so many questions, because im making 8 of these to sell, with a £160 profit on each, so i want to make them good :D

Thanks for your amazing advice and all the time you put into making the instructions viewable.

XenonJohn (author)  jmunsami2 years ago

If you are going to sell them for £160 profit on each one, then you design 'em matey!
Make sure you have a few million $ public liability insurance, don't use any of my software and don't mention me anywhere in the instruction manual.

Haaahaa! Im not thinking as big as that! But Im Sure that these could make a much larger profit if made per 100's!
XenonJohn (author) 2 years ago
The Inertial Measurement Unit (IMU) has 2 gyros and 3 accelerometers.

I actually use 1 gyro and one accel to balance, and the second gyro as a way to detect and then compensate for sudden rapid changes in direction (like one wheel hitting a stone for example).

It is the Sparkfun 5DOF IMU (5 degrees of freedom)

There is also a 6DOF version (3 gyros and 3 accels) but for my needs the 5 DOF one is fine.
Making video of the new pneumatic tyre board at the moment.

Best wishes
miguipda2 years ago
Hi John,

thanks to share your arduino segway like project. Because I also think to make a segway like but my knowledge is limited in electronic. I am sure I can do it with an arduino and I enjoy to read your project.

Just two thinks I need to ask you and may be that will upgrade your project :

1) At 1:19 on this video we can see that a segway use five gyros :
may be for front to back + left to right + one wheel up or down the other.
What do you think about this ? I mean if your "segway" like have one wheel a little a bit up the other does it continue to run anyway ? If well what the need of five gyros on the real segway ?

2) to answer to your question concerning the fact to reduce the cost of your segway like I just discovered this gyro reduction. In place of paying it 100$ you can build it to 8$ (as he said) :
May be can you give us your project with this use.

3) Do you think that overclocking the arduino can help for the answer time or unneeded ?

4) Can the one chip arduino be cheaper and or more useful (consumption with some LiPo battery in place of weight battery) ?

Sincerely thanks for your informations and have a nice day.

Miguipda ;-)
XenonJohn (author)  miguipda2 years ago
1) Why dont I use 5 gyros?
A real segway will probably work with some of the gyros failed. It is designed with redundancy in mind (2 motor windings for each motor for example) for safety where the users are not at all interested in how it works.
2) I use 1 gyro with 1 accel to balance. This is the minimum. If they fail you fall off.
3) Also there are starnge situations that can occur such as tuening while on a slope or with one wheel on a slippery surface while truning while on a slope, and so on. The 5 gyros help with the "calculations" for such situations I suspect.
4) Why overclock the arduino? My software at present only works for about 1/3 of the time, the rest is a delay, and that gives you 100 program loops per second which is ample for the balance algorithm
5) One chip arduino? Not sure what you mean, maybe the tiny versions of the arduino's you can get. They will save you space for sure if space is tight I suppose. Perhaps will use a little less power if powering them from a small battery perhaps. Marginal gain therefore.
6) $8 "gyro" is not a gyro. It has a wheel with a weight on it that "will always be closest to the ground" which is then connacted to a sort of optical position sensor. Well no actually, if you braked hard, the weight would swing forwards. It would give you a "I am tilting" reading when in fact you were not. My gyro in 2008 cost be about $200. Now sparkfun do a board with 2 gyros and 3 accels all for about $50 so to be honest I am not complaining about price of gyros any more. You can even use a WiiMotionPLus module which has gyros inside to save money, but you need to understand all the code required to decode the data from these.
Therefis already plenty to go wrong in these machines, don't make life even harder for yourself just to save a couple of dollars.

Best wishes

miaoichi2 years ago
Hi XenonJohn,

I can't find the balancing point.
please kindly find my video as below,
Do you have any comment?
XenonJohn (author)  miaoichi2 years ago
Just posting this here to say that after much emailing and dodgy YouTube videos of a machine trying to break itself apart, miaoichi's board now does indeed self-balance!

The value in the code that affects the balance point had to be tweaked and also the motors may initially have been wired back-to-front (50/50 chance).

The IMU tester code has been updated on the Instructable so it now tells you the exact value you need to insert in the rest of your code to get your particular machine to balance perfectly level. This compensates for slight variations in the way people mount their IMU's since "vertical" can in fact vary slightly from one machine to the next.

still on the learning curve...........


XenonJohn (author)  miaoichi2 years ago

Accel is clearly cutting in when level so that "titlstart" part is OK.
Therefore thinking of gyro and the way it is combined with the accel. Something may be back to front in code or physically.

Just try decreasing the variable "ti" at start of code to smaller value, try 2.2

Send me a message with a working email address and we can correspond and sort it out.

I need a good quality photo to begin with of your IMU orientation

Best wishes

My e-mail shown as below

Could you send me an email first, so that I can corresponding.

I uploaded picture of self-balancing board for you.
Please kindly find below link.

What email address can I send to you? Please provide me. Thanks.
zaborrilla2 years ago
Hi John,

This instructable is really great!! I have in my mind the idea of building a segway clone instead of a skateboard. I am in the process of reading your code and study what is made in each step. I have a question about one feature i miss (I don`t know if it's implemented or simply I cannot locate it). If I lean forward and keep leaning there will be a moment when scooter is going so fast that the wheels can't keep up. Is the "tilt back" or some kind of speed limiter feature implemented?

Another question is about the motors you use. Do you miss more power? I would like to keep it cheap, so Im thinking to use the same 24V 250W motor you use (going to 500W ones the sabertooth might not be enough) with pneumatic tyres whells with 80 tooth sprocket to increase a bit the torque. The sprocket diamter is 165 mm, so im thinkink to use a E300 rear wheel (260 mm diameter).

Thanks for sharing your work!
XenonJohn (author)  zaborrilla2 years ago

Trevor Blackwell has a monowheel site with code in "C" that implemented a tilt back feature to limit top speed. Others had trouble making it work though.

In my latest twin wheeler I simply have some LEDS come on when power being sent to motors is by arduino algorithm is 70% and more come on (red ones!) when it gets to 90%. You can also use a buzzer. Relatively crude but it works. You are right, if you accelerate to max speed then after that you will gently topple over the front end as it cannot accelerate any more to keep under your centre of mass.

You could use bigger motors with saber 2 x 25. These Chinese scooter motors also come in 350 watt and 500 watt versions (case same diameter, motor slightly longer).
500 watts from 24V battery pack would be 20.8 Amps so you could probably go to 350watt motors and still be OK with saber 2 x 25. If you really overload it, it will shut down before it burns out - which is good.

As you can see from link above, my latest machine has E200 rear wheels with pneumatic tyres and it works just fine. Posting a new YouTube vid of it in a couple of weeks time.


Thanks, I think first i will try to do a skateboard instead of a segway like thing, so, recovering from that situation is easy if you have small wheels at the top, but with the segway mode you will go to the floor easily.

Regards and thanks for the quick answer
aniles jr2 years ago
how do i enter the code into the borad and were do i get the software from
XenonJohn (author)  aniles jr2 years ago
These are my serious thoughts on how to progress as fast as possible (I know because it took me 3 months to get my first efforts to balance badly):
i) Get an arduino experimenters kit (most arduino retailers have them), about $40-50 that comes with a book of about 12 tutorials and a box of additional sensors etc as well as the arduino board itself. Work through them and the code (about 2 solid days work) and this will teach you the basics of arduino electronics and programming.
ii) Read, read and read some more about self balancing projects, segways, robots (lots of links on my website but plenty more out there for you to find). Fill your brain with everything you need to be thinking about. Spend about a month getting your head around the principles at work.
The lectures on the site are a good starting point.
iii) Then, have a go at building something, even if it fails you are still learning all the time.
iv) Keep going and have fun. Treat it as an adventure, the end point is unknown.

Best wishes

Links to other projects:
aniles jr2 years ago
how can i use a potentiometer to adjust the how tight the turns are and i want to do this on the handcontroller?
XenonJohn (author)  aniles jr2 years ago
I would get it to just balance first. Concentrate completely on that.

Eveything else after that can just be classed as refinements.

Sure, you could adjust the target rate of turn in degrees with a potentiometer, you could also make it inversely proportional to the estimated speed which would be a good thing.
For example I am currently working on using 2 pressure sensitive resistors under my left heel and toe to allow it to be steered by leaning, and stopped by rolling foot sideways so not pressing either resistor. This also means you can lose the deadman switch. Lots of things you could do - after you've got it to balance!

wen i get mine to blance can u help me out to do that so we i lean it will turn?
tilmen2 years ago
cool work
aniles jr2 years ago
were do i get the 5volts from
XenonJohn (author)  aniles jr2 years ago
The terminal on the arduino labelled 5V

(the one labelled 3.3V next to it powers the IMU)


mickydee2 years ago
Hi John
Thanks for a great project. I am building a variance of your ible. . II am building a two wheeled balancing wheel chair. I don't have a lot of experience in this field, but I follow instructions pretty good. I will be using 24 volt wheel chair motors and all the electronics yours has. I plan on using your code as it is written. It will be a little heavy but really rugged . One question I have for you. Is it important to try to balance everything around a CG at the axles? If I am a little off , will it still balance? To get some experience I am building a small platform using an RC donor tank for the drive motors to see if I can get it to balance. If it balances I will transfer all the electronics to the larger wheel chair. I am 80 years old and it is getting harder to get around. I just won first place in the Makebot challenge and I hope I can use the 3-D printer to make some of the parts.
Thanks again for the great ible I will send you pictures as soon as I get a little further along
XenonJohn (author)  mickydee2 years ago
There are several segway style machines around based on wheelchair motors.

The thing does not have to perfectly balance when power is off. What happens is you adjust the balance point with one of the rocker switches until your CG is above axle line. If that means you end up tilted a little forward or back when "balanced" so be it. Alternative is to vary where you put your feet. So long as total machine + rider CG is roughly above axles when you are on it, it doesn't matter if machine is slightly off balance when riderless.

I did temporarily rebuild this as mini-segway so I know it should work.

You do need to consider what happens in wheelchair mode if it goes wrong, i.e. will you fall back hit your head or will it simply tilt to a slight angle onto a caster wheel for example. Please do put some caster wheels each end just in case!
Hi John!
Thanks for all the help and suggestions. I have built the frame and mounted the motors.I have installed casters front and rear for safety. They only let it tip just enough for the tip start to work. The IMU and motor tests ran well. I tested on 12 and 24 volts. After several tries I finally got it to balance. It was not quite level, but I assume that is due to the IMU placement.My next step is to wire up the hand controller and try the full balance program. I have not built the seat risers yet. I just want to prove my electronics first before I try to ride on it. I have a couple of questions for you
1. What does the soft start do?
2. Can I mount the IMU screwed to a block of wood to keep it at a 90 to the floor?
I will send you some pics soon. This thing is pretty heavy. but it sure is solid.
3. Do you think the weight will be a balance problem?
Thanks again for all the code I don't know the first thing about C++
Regards mickydee
XenonJohn (author)  mickydee2 years ago
If it balances at all then you are nearly there.
I did use this code in a segway styled version for a while so I know it works OK.

1) Softstart: The motors react to angle of tilt but also to rate of tilting. Therefore if you stand on board then over-enthusiastically bring it to level point (so rate of tilt is actually very fast), the motors will really fire as soon as you go past the level point. The board will really wobble and overcorrect.
You soon learn how to gently bring it level, but what softstart does is this: when you first bring it level the overallgain is set to 50% of what it should be. Over the next few seconds after you have brought it level and motors have started up, the gain gradually comes up to 100%. This makes it feel a bit mushy underfoot for a few seconds when you first start it up, but this also stops it overcorrecting if you bring it to the level position too rapidly.
2) As well as a steering control there is also a forward/back rocker switch (3 position switch with central position as default). This can be blipped back or forward to fine-tune the balance point while you are on the board.
However, simplest way to get it more or less level from the outset is to mount IMU on a little bracket that rotates slightly then can be tightened up in perfect position (plus a little blob of glue to stop it coming loose - hot melt glue is great for this kind of thing as so long as you don't use too much, you can peel it off if you have to change something).
3) To balance you need a decent amount of torque at the wheels. If not aiming for high top speed this is easier to solve: small spocket on motor and big sprocket on wheel. You only need this "excess" power when trying to recover from a large angle of tilt, or trying to get up a slope. However, if pootling around slowly on a level floor, as you plan to, then your weight is more or less directly over the wheels all the time so in theory it should still balance without too much trouble.

Also remember when you first power it up, stationary with one end on ground, count to 5 slowly as first thinbg it does is read the value from the gyro when zero "rate of tilting." Then press the deadman switch and slowly bring it level.

If you find it too aggressive and want a softer ride, look at the line at start of code where it says "float ti = 3;" and change the value to a smaller one, about 2.2 would be OK.

Hope this helps

Hi John
I imagine you must tire of solving our problems. I try my best to work it out but I am just frustrated at this point.
I can't get the numbers you get during the IMU test. They are all too high and all over the place. I thought I had blown my IMU so I bought a new one from Sparkfun.. The numbers looked a little better so I tried the "Just Balance sketch". When it came alive it lurched forward and ran across the room. I checked all my joints and even moved the pull down resistors to the hand controller by running a ground to the controller. This does make it neater. I hope I haven't blown the new IMU? I am attaching two pictures of the serial window during the test. Let me know what you think. Is the dead man in play for this test? I tried it both ways. The numbers seem to be a little lower with the switch depressed.
XenonJohn (author)  mickydee2 years ago
Your IMU tester data is definitely wrong.
When accel goes +ve, gyro should go +ve as you are tipping it
When accel goes -ve, gyor should go -ve as you are tipping it.

When held still, accel will give (static) tipping angle (zero being about level) while gyro should read zero (at any angle of static tilt) but will in fact give a small +ve or -ve value as it drifts a bit.

I will have a closer look over weekend and come back to you.

aniles jr2 years ago
how can i use a potentiometer to adjust the how tight the turns are and i want to do this on the handcontroller
aniles jr2 years ago
is this battary good?


XenonJohn (author)  aniles jr2 years ago
Should be OK. You would need 2 of them.
Best wishes
XenonJohn (author) 2 years ago
By momentarily flicking switch forward or back you can make small adjustments to the angle of the board at which it self-balances. It is just for the comfort of the rider. If one foot feels a bit higher than the other when you are riding it, you can make a small correction while you are riding board.

Also, if about to go up a slope you might want to raise the "nose" of the board slightly, this is how you do it.

The IMU uses 3.3V from the arduino board which has a regulated 3.3V supply on it for just this sort of peripheral (the newer ones anyway).

The arduino board also has a regulated 5V pin on it which is a 5V supply, again for peripheral devices.

Supply to the arduino has to be in range of 7V to 12V via the power input socket.

Easiest way to get going is to connect a 9V battery to it.

You can use a so-called linear voltage regulator to convert from 24 V of the main batteries to 7V but it will generate lots of heat and waste some of your main battery power.
I have ordered a more exotic one which works in a different way and is far more efficient. If it works OK I will add it to the instructable.

Best wishes


but were do i get the 5 volts from the board so i could bring it to the hand controller
kriogenic3 years ago
Hey there, I am going to experiment but I was wondering if you knew if this IMU unit would be applicable.

I have no idea really but think it will be fine without the capabilty of resisting sudden turns?
Hey there,

I got a few things for this project underway now,

I got my motors, motor controller, IMU and arduino.

Using your examples I got the accel and gyro to give me usable figures....

Using the motor example I got my motors to run fine.

Using your balancing only code and a few tweaks I have gotten the IMU to spin the motor depending on its orinetation. however the motor controller seems to cut out after the motor reaches 100%, i am not sure why this is. I can post a video for you if it would make it easier.

XenonJohn (author)  kriogenic2 years ago
When both motors running at 100% then current draw on batteries may be pretty high.

Not sure what batteries you are using but if the current draw exceeds what batteries can give, voltage across them will drop. If it goes too low the sabertooth will shut down. I am not sure at what voltage this happens but might be worth measuring voltage across batteries and seeing how low it goes when you are running both motors at 100%.

In the motor testing sketch they only go to 50% each then decrease again.

what if you put it up to 80% because i want mines to go fast


XenonJohn (author)  kriogenic2 years ago
June 1, 2011:
This turned out to be a bug in the code. The "Integral" value of the PID accumulates indefinitely if you hold it tilted on a bench rig for a long time for example. Eventually it flips back around to 1 again!

I now have put a limits check on it so it cannot do this any more.

XenonJohn (author)  kriogenic3 years ago
This should work OK

Minimum needed to balance is one accel and one gyro

ursine1002 years ago
(removed by author or community request)
Hi, where did you buy the wheels please ?

XenonJohn (author)  Montspy2 years ago
If you cannot get hold of E100 wheels which are the smallest ones with solid tyres you could maybe try the E200 wheels (200mm diameter) with chain drive which would be bigger but perhaps better over rough surfaces as have a pneumatic tyre.

I've got 2 pneumatic tires on order. I plan on rebuilding when they get here.

XenonJohn (author)  ursine1002 years ago
I have just built yet another version of the machine with Razor E200 wheels (i.e. pneumatic tyres) with drum brake mechanism cut off each wheel and axle rods shortened.

Had to make quite a complex welded frame as I wanted tops of wheels to poke through top of frame, but it does work just fine from mechanical perspective.

Nice build !
My skateboard balanced and I ride it yesterday before the Sabertooth microcontroller burnt today... Apparently it's because wheels turned when no batteries were connected. Back EMF is bad !
Need to buy another one :/
Sometimes,when I bring the board to it's balancing point, with the deadman button pushed, the board will go crazy and turn on the motors near 100% in the wrong way to balance :/ Do you have an idea ?

XenonJohn (author)  Montspy2 years ago
You have to bring it to the balance point very gently. Takes practice. Harder to do if your board is high off ground. Try it while leaning with both hands on a desk and you will get the idea.

There is a term in the algorithm that says "if I am tipping fast then send more power to motor to correct against it - proportional to the rate of rotation of the board"

So, if you bring it to level point fast, i.e. rapid rotation in degrees per second, as soon as it is level, even though the absolute angle of tilt is zero, the software goes live and motors really kick in as your rate of tilting as actually still a high value. Your instinct is to fight it which makes it oscillate even worse.

I have tried to soften this with the "softstart" added to the code recently.

Also at the start you see we define the variable "ti" as 3.

Try changing it to about 2.2, it gives you a slightly mushier ride quality though.

Also you need the deadman switch to be a decent quality switch - no "intermittent" dodgy contacts allowed!

Also remember to leave it tilted on ground stationary, turn it on, leave it alone for 5 seconds, then bring it level as after you switch it on it "zeroes" itself (takes readings from the gyros when board not moving and uses them as the zero values).

Also once you have let go of deadman, you have to turn power off then on again and go through above startup routine again. If you press deadman again after you have let go of it (while board is now tipped) it will fire off across the room as it tries to balance itself.

Best wishes

XenonJohn (author)  Montspy2 years ago
Here is one:
as you can see they will be "in soon" !

Here is another (delivery 1 month) which is where I originally obtained mine from.

It looks like if you can find any anywhere in the world you should buy them wherever they may be, even with import cost added, or find a usable alternative.

Thank you ! I thought they don't ship outside US but their is an hidden "international checkout" button ;)
Waiting for arrival !

Thanks again ursine100 !

No problem. I'm hoping to get mine next week.

Got them ! Building th thing :)
Can't wait to ride it int he campus !

BuildWiz2 years ago

So i have hooked up the motors (i went with 300w motors) to the sabertooth, pluged in the batteries and hooked up my ardrino uno. I go to run the motor test sketch and the dead man switch function doesn't work and it only runs one motor. i was wondering if anyone had any advice cus i've switched both motors and tested so they both work it's just the M2A and M2B ports aren't putting anything out. I checked my wiring and everything and just can't figure it out. Any suggestions would be helpful.

XenonJohn (author)  BuildWiz2 years ago
Reading all these Q and A posts it does seem some people have faulty Sabertooths that don't read the serial communication from the arduino. This is one reason I wrote the motor tester sketch.

For example one person ("grunff" April 2011) had his sabertooth failing to run in serial mode but working fine in RC mode.

You could rig up a variable 0-5 voltage input (see datasheets for sabertooth) system with potentiometer, set the DIP switches on sabertooth to the analog input mode and see if both motors work then.

If there is any way you can try a different sabertooth that would be the thing to do.

Best wishes

mickydee2 years ago
Hi John!
I found part of the problem. It appears that my arduino DC input is bad. When I powered it up using my laptops USB port it came to life. I was using a 9 volt battery for power. The arduino lit up but would not function in the system. I have ordered a new UNO . The excess voltage 6.8 volts coming from the arduino is causing the project to be jittery. I think I will continue testing using the USB port for power.
Thanks mickydee
mickydee2 years ago
Hi John!
Everything was going well, until I soldered all the wires from my hand controller to the arduino. I am not sure if I accidentally put 24 volts to the arduino or not. Now the tipstart is not working. I checked all the wires and voltages and all seems well.
The arduino is putting out 6.3 volts instead of 5 volts. The 3.3 tap is working .
I tried the motor test sketch and it works perfectly so I think I am communicating with the Sabertooth O.K. Do you think I have blown the arduino? I tested the arduino with the blink sketch and it works fine. Any suggestions?
XenonJohn (author) 2 years ago
Just to clarify so no confusion at all:

I have component side of the IMU facing to my left.
IMU is mounted almost vertically with the 2 holes for the bolts both along the lowest edge nearest the ground.

When you run the new IMU tester sketch, when board is held level the accel value (in degrees) should be more or less zero.
It then goes -ve if you tip it one way or +ve by a similar amount if you tip it the other way. The angles of tilt displayed should be roughly the same as those you see when tilting the board.

Meanwhile the gyro reading is giving you a RATE of tilting. Ideally this is zero when board is at any angle (not just when level) but being held stationary.
In reality it gives a small reading even at rest due to the fact that its baseline value drifts with time. When actually in the act of being tilted, the gyro rate of tilt should increase or decrease in same direction, momentarily, as you see with the accel value.

If you can position IMU so this is what you see, then you are nearly there!
DrWilson2 years ago
Well done on making it onto the gadget show, seen it this morning! Loved the t-shirt! :)
XenonJohn (author)  DrWilson2 years ago
Here is the relevant clip from that episode of gadget show (I missed it too, someone phoned and told me it was on):

It was also on the New Scientist web TV channel so now I must be a proper scientist!

XenonJohn (author) 2 years ago
OK here I am again:

1) The IMU tester code has been improved. Open serial view window and check that as you tilt it, the gyro just transiently reads same sign direction as the accel value, i.e. they both go +ve one way then both go -ve the other way.
NOTE: the gyro reading at zero or "level" will not be zero as it drifts. My gyro reads 6 degrees per sec even when stationary for example. This is why we have an accelerometer - to correct for the "drift" in the gyro readings.

2) Both the final versions of the code (rocker switch steering and potentiometer steering versions) have serial view windows now that allow you to watch what is going on with any variables you want to look at.
This works in real time as it is balancing and the loop time of 100 cycles per second is NOT affected by this feature, thanks to some clever timekeeping code borrowed from another instructable.

Hope it helps,

Thanks I wasn't sure if it was accurate or not.

As I have all the same components as you do here and have checked everything more then once.

with the old IMU I was using I managed to get my board to trigger and try to balance at the right point. Using the 5DOF from sparkfun it is trying to trigger (and assume balance point) is lying fully tilted to the right.

I will do some more tweaking within the next few hours and let you know how it all goes.

Thanks for updating the test sketches and source,

XenonJohn (author) 2 years ago
The test sketch is not that great to be honest. It was just an attempt to stop people connecting their accel and gyro facing backwards with respect to each other (a mistake I have made more than once).

When have time will rewrite it so all the values it spits out are accurate (they arent at present - they just give you an indication of whether accel and gyro are moving the same way or opposing each other).

I will post something on page 1 when I have made this upgrade. Hopefully within next few days.

ursine1002 years ago
Thanks John for the great post.

I just finished mine a few days ago. Lots of fun ( although I'm nursing a pulled hamstring from one of the first few rides). I left the sketch pretty much as is except for modifying the level balance number, but I noticed my rate of turn is slow.
XenonJohn (author)  ursine1002 years ago
Yours balances roughly as mine does.

Am trying to build a unicycle at the moment and have learned a lot more about PID balance control. I may well redo the code soon with a few small improvements.

Meanwhile the regarding the rate of turn:

//steer one way SteerValue of 512 is straight ahead
if (k1 < 297) {
if (gangleratedeg2 < 8) { //will turn clockwise at 8 degrees per sec and if not, more power fed into steering until it does
SteerValue = SteerValue + 1;
if (gangleratedeg2 > 8) {
SteerValue = SteerValue - 1;

//steer the other way
if (k1 > 697) {
if (gangleratedeg2 < -8) { //will turn anticlockwise at 8 degrees per sec and if not, more power fed into steering until it does
SteerValue = SteerValue + 1;
if (gangleratedeg2 > -8) {
SteerValue = SteerValue - 1;
If you want to turn faster change the 8's and -8's to a larger value. I would suggest doing this in stages! Remember at present as the code is now the rate of turn will be the same in angle of turn per second even if you are going fast. A fast turn rate is cool when near-stationary but you will fall off if it turns at same angular rate when you are going along fast!
The value (8 at present) should actually be larger when speed is slow and become smaller when speed is fast. You could try making it vary inversely with the cur_speed term. There are lots of ways to improve my code.

One bug that needs to be fixed (now fixed in latest attached code):
Where it says:
level = level * 200; //changes it to a scale of about -100 to +100

if (level > 100) level = 100;
if (level < -100) level = -100;

WHY? because if you hold it tilted a long time (to go up a slope perhaps) "level" can get larger and larger then flip back to zero causing motors to throw you off.
Has never happened to me when riding it but can be seen to do it when bench tilt-testing with wheels off the ground.
Best wishes

screighton2 years ago
I have just finished building a segway version of this. It preforms very well. I will submit a link relatively soon.
pstone22 years ago
where did you get the razor back wheel kit and how much was it?
ursine1002 years ago
While waiting for my wheels, I went to work on wiring the wii nunchuck. As it mentions in the instructable, the screws on the wiichuck require a special tool available on ebay. Not wanting to buy a tool I'd use only once, I ground down an old screwdriver and fashioned a 3 lobed driver with a Dremel abrasive wheel. Works great!

Montspy2 years ago
Thank you for this instructable ! I'll follow it as soon as I... can find those wheels -_-'
It's been near 1 year they are out of stock !

miaoichi2 years ago
Hi John,

Could you share me how to mount the batteries underneth ?

XenonJohn (author)  miaoichi2 years ago
I had some spare angle brackets of the same type used to hold the wheels.

It is not a work of art but I bolted them together so they formed a Z shape, and bolted one flat edge up under the board, one of these at each end of the board. This forms a suspended support you can slide the battery onto.
With some additional bracketry underneath and tape, the batteries can be held steady under the board.
Thanks for your response.
I'd like to see the pictures of battery, if you can sharing with me.

miaoichi3 years ago
Hi, John

Could you tell me who to change the chain length ?
What tool should I use ?

Best regards,
XenonJohn (author)  miaoichi2 years ago
I learned by trial and error:

Get a vice and open the jaws about 3mm.
Put chain on its side with one of the pins linking between links of the chain exactly above the gap. Use tape or a helper to stop it all sliding off onto the floor!
I used a 2.5 mm broken drill bit (the shaft part) as a drift to tap out the pin so it drops out downwards between the gap in the jaws of the vice. Gap should be only just a tiny bit wider than width of the pin else the sides of chain will get bent.

When I say "tap" I actually mean hit it hard with a big hammer. A nail is too soft, it will just bend. That is why I used a broken drill bit. Hold drill bit tightly in pliers or locking pliers from the side and hit top with the hammer.

This is very fiddly to do. Do some trial runs with some spare chain.

Assembly is reverse of this and slightly easier.

You can get proper devices for splitting a chain, and a special removable link that is used to join the shortened ends back together again (this link is visible in one of the chain photos in the instructable but in the end I didn't use it).

I would ask a bike shop to help you out possibly.

prateekk3 years ago
hi john i am really inspired by this thing and looking forward to make one for me.
so would u plz help me out with sendind codes to:

and one more thing can u plz tell me can i make this with an atmel atmega8 microcontroller??
plz send me d circuit diagram and wiring things too
plzzz i am really looking forward to your reply !!!!
XenonJohn (author)  prateekk3 years ago
It's all there in the instructable folks, including the wiring.

You could use an Atmel atmega8 but the code will have to be written in "proper" C. Although the Arduino boards do indeed use Atmel microcontrollers the big advantage is that they use a simplified form of C which speeds things up hugely, plus masses of code online on the forums as an inspiration to you if you get stuck. This is why they are so popular with hobbyists.

I know because my first balancing machine used an Atmel microcontroller board and it took me 3 months to get the code working. Unless you code for a living or really know what you are doing I would use an Arduino every time.
miaoichi3 years ago
Hi, John

Could I have code as well ?

XenonJohn (author)  miaoichi3 years ago
Check out the improved instructable.
All code attached to last few pages.

Thanks John.

I can't find the e100 rear wheel and motor in Taiwan.
Do you have provide Kit already now ?
If yes, i'd ordering from you.
Rikain3 years ago
Really interested, can I have the code please.

XenonJohn (author)  Rikain3 years ago
Hi Rikain,

I have just made quite a few improvements to the instructable. The arduino sketches keep disappearing so I have now attached them as simple text files to the last few pages.
Have added a number of test routines with video links to help people set up the IMU correctly, wire the motors up the right way around and so on.
Check out the last few pages and code should be attached.

Best wishes

eyeo3 years ago
hi.. can i have the code please ? A full version 1 and a balancing 1. thanks in advance.. my email is
XenonJohn (author)  eyeo3 years ago
code sent
I'd love a copy of the code, this is just begging to be built!
Question, what sort of heat dissipation from the controller, would a micro fan aid cooling and circuit stress loading? email
kpp3 years ago
Hi, can i have the code please?
Seems like a fun project my email
screighton3 years ago
High I have two questions. The first is can someone who has never used arduino before do this, or do you need to be an arduino expert. ( I have done a little bit of java programing.) The second is could you please send me the code so that I can try to understand it.
Please help this is for a school project.
XenonJohn (author)  screighton3 years ago
Code sent.

Would suggest reading a book such as Getting Started with Arduino.

I think you would pick it up very quickly, it is a simplified form of C.

kevman00443 years ago
I've got mine built and balancing but it is real twitchy. How do I go about solving this problem. The chain has good tension on it and thats all I really knew to check.
XenonJohn (author)  kevman00443 years ago

Firstly well done in getting it to balance. Hardest part done.
Twitchy: First thing to try is to turn down the gain potentiometer a little.

If you are using the code version that just gets it to balance and nothing else there are two places in the code where it says "overallgain = "
Reduce the value a little (same value in both places) and try it again.

Failing everything put a video on youtube and message me with the link so I can take a look at it.

Best wishes

screighton3 years ago
Can I please have the full version of the code, and the code that is just for balancing.

Thank you
xiodene3 years ago
I turned this on for the first time today as was very careful to get the + and - the right way round, started off fine, pressed the deadman switch and it spun. So i turned it over and pressed it agai, it ran for around 2 seconds before the sabertooth burst into flames!!

Is there anything else that could have done this??
as i had the batteries connected up fine!
XenonJohn (author)  xiodene3 years ago
All I can say is that according to the instructions, the sabertooth is supposed to be resistant to almost all forms of abuse except being connected up to battery the wrong way around. If overloaded it is supposed to have thermal cutouts to protect it for example.

Sorry not to be more helpful.

I have emailed the company i bought it from so will hopefully have some joy as i cant see what has gone wrong.

Silly question.... but you can use the ground on the digital site of the arduino board as a normal ground cant you?

XenonJohn (author)  xiodene3 years ago
Yes, the GND connections on the arduino are all connected together, you can use any of them.

The 0V on the Sabertooth is connected to GND on Arduino.
The S1 on Sabertooth is connected to digital pin 13 on arduino with current software.
The other two sabertooth connections are not used.

The "dead man" switch is set up to feed a signal of +5V (from +5V pin) to digital pin 9, I put a 300 Ohm resistor in this line just to limit current, not sure if essential to do that..
Digital Pin 9 is also connected to GND via a "pulldown" resistor - about 5K will do. This holds it at 0V when the dead man button is not being pressed else the voltage the arduino "reads" at that Pin would drift around.

For the version of the code that just self-balances the board, then, assuming Gyro/accel outputs are connected to the correct analog pins, your board should balance.

A reminder:
analog pin 4 is used for accelerometer voltage intput to the arduino
analog pin 3 is balance gyro low-res input pin. (Y-rate)
hi res balance gyro input is analog pin 0. (Y-rate 4.5)

IMU also requires a power supply: +ve from the 3.3V output on the arduino and a wire back from IMU to GND on the arduino.

best wishes

XenonJohn (author)  xiodene3 years ago
I have emailed you a new stripped down version of code that just balances the board, nothing else.

No extermal pots, values for overall gain, balance trimming etc all hard coded for now.

Once you can get it to balance you are 90% of the way to success. You can then add steering and other peripherals back in one at a time.

If anyone asks me for code from now on I will send this version also with main code.

kevman00443 years ago
I have it all wired up but when I turn it on I get nothing out of the motors when I bring it to the balance point. The only way I get anything out of the motors is if I take the OV ground cable from the sabertooth out completely. When I do that motor number two spins like crazy. Any ideas what might be wrong. Also could you send me the stripped down debugging code at
XenonJohn (author)  kevman00443 years ago
I would try the code that just balances it. Only peripheral required apart from a working single gyro and single accel from the IMU is the dead-man switch.

failing that send me a hi res photo and I will see if I can see any obvious wiring problems.

best wishes

kevman00443 years ago
What would I have to change in the arduino code if I wanted to use a potentiometer for variable turn rate?
XenonJohn (author)  kevman00443 years ago
There is an image on front page now of a version with a wii nunchuck attached. All I have done is solder wires to the two 10K potentiometers in the chuck thumb joystick, and to the buttons on the end to use them as my "deadman" switch.

Good thing about this is that the pots self-centre at about 5K resistance point. So with some experimentation you can connect them to an analog input each for steering left right and to fine tune the balance point using the forward back motion.

Two main values in code affect steering:
Steercorrect is a variable that is generated by second "headlock" gyro to make it resist slight turning forces, for instance if one motor has more friction than the other, to keep it in a straight line.

The other variable is "Steer". A value of zero is no steering i.e. keep going straight ahead, a -ve value is left and a +ve value is right. Do some experiments with hard codinjg in values for this but you need your potentiometer to vary the value of "Steer" remembering to code the data from your pot so that a Steer value of 0 is straight ahead.

Hope this helps

mwagner633 years ago
can you please send me the code my email is thanks
would the motors do well with 13" tires or would it require to much torque? for a segway type scooter not a skateboard
XenonJohn (author)  BIGHAIRYDUDE3 years ago
In theory tires can be any diameter. If the chain sprocket on the wheel is large, then you will have just as much torque as if using a small wheel.

Regarding torque, the key factor really is the diameter of the large sprocket on the wheel vs the diameter of the wheel itself. Big wheel with big sprocket means more torque but lower top speed, big wheel with smaller sprocket means higher top speed but less torque. If torque too low it won't have the power to balance you.

Somewhere in the middle is the "happy medium" and that is what may take some experimentation to get right.

Have a look at the original Focus Designs unicycle. It has a ???500W motor, a bike wheel and a fairly small sprocket on the bike wheel but it goes OK on the level. Hills might be a different matter.

I would start with larger sprocket so you know it will have the torque to balance you, then once it is working, go down a size if you have no intention of going up hills and would rather have a high top speed.

thanks man and about the code you just copy and paste right?
how fast does it eventually go?
Can i Have the coding you used for this
My email is
great project,
would you send to me code on email
xiodene3 years ago
Hi this is a really great project!
I have started to buy the parts to build my own, could you send me the code just to make it balance please?
email addr :
hey pls send me the code and parts details from the list at my email addr :- thanx.
Me too please. My email is Thanks
XenonJohn (author) 3 years ago
Good point. Anything that makes it simpler is welcome!

When I find some time I will try that.

lgcalex4 years ago
 I wish there were more profound words for 'you rock'.

I've always wanted one of these. I think i'd be tempted to go for a one wheeled option and save on the motor but rely on more skateboard lean style turns. 

I think the cool factor is pretty important on these boards, its something the segway missed. 
XenonJohn (author)  lgcalex3 years ago
Here is a one wheeled one with a "Syren" motor controller (which is similar to half a sabertooth) and a 500W chinese electric scooter motor.

Here is a video of him on it and my attempt at a stand-up one wheeler:

It runs some of the arduino code from this instructable.

Also here is more info on my original one wheeler:

To be honest I still prefer my 2 wheeler skateboard having now tried most variations of the theme. It is very handy to have a machine light enough to just pick up and walk away with when you have finished playing with it.

Next mod will be to replace the nunchuck steering on my really nice twin wheeler with pressure sensors (pressure sensitive resistors) in the deck under the griptape so it becomes truly hands- free and more like a skateboard. This is main criticism of skateboarders/snowboarders who have had a go on it. I will have a switch so you can select between wireless chuck (easier for beginners) or pressure sensors to steer.

XenonJohn (author)  lgcalex4 years ago
Thanks for the feedback. One way to steer a 2 wheeler by leaning is to make the deck tilt and use a tilt sensor to provide the steering input to the microcontroller. This has been tried before with "Emanual" - see bottom of this page:
My problem with this was: it looks tricky to control / I knew in the end I wanted to but the batteries in the deck / I wanted everything under the board not on top, if it could be done. I could have cheated with a battery backpack and power cable down the trouser leg (which after you have stopped laughing would actually give you a really cool thin-decked small twin wheel board - as well as instant power shut off if you fell off), but I didn't want to do that.

I may use a carbon sheet for top of my deck just for cool factor. Also plan to improve turning software so the gyro that stops sudden spins is actually used to control the rate of turn proportionally to thumb joystick deviation. Should make turns more intuitive so you can lean into them.
Hey can u plz send me your email add. i want to send u a code for varification wich i hav modified for l298 motor driver using your code.

my id is

neways u hav done a very outstanding job...
XenonJohn (author) 3 years ago
Wow, 5 stars. Thanks everyone.
geekflytk3 years ago
Can I lay this down horizontally, or does it HAVE to be standing upright? If it were to put it horizontally would I have to modify code?
XenonJohn (author)  geekflytk3 years ago
If horizontal the balancing gyro would still work OK as it measures rate of turning, not actual angle.
The accelerometer I have used would become the wrong one. You would have to measure voltages coming out on each accel pin to find the correct accel in the IMU for the new orientation.

The second gyro which detects sudden turns to left or right (when viewed from above) would now be in the wrong orientation. This second gyro is not required for balancing but the algorithm it feeds into is there to help resist sudden spins left/right as you are moving along if one wheel hits a small stone for example.....keeps you going in roughly a straight line until you enter a steering in model helicopters.

In the photos you will see I soldered up ribbon vable to ALL the outputs of the IMU, even though I only use some of them, as much easier then to mount the IMU and work out with a voltmeter on other free ends of the wires which outputs I needed to use for any given mounting position.

So, in summary, you could lie it flat but some experimentation will be required. In particular one gyro needs to be turning on the fore-aft vertical "tilt" plane of the machine while the second (optional) "headlock" gyro needs to be turning on the horizontal plane to detect sudden turns to left or right as you are moving along. As there is an accel in all 3 planes, you need to just find the right one for the fore-aft plane once you have laid it flat.

Its a pretty small item compared to everything else, do you really need to lie it flat?

Best wishes

What I meant was can I place the IMU down horizontally, or does it have to stick straight up somehow?
jrcnelson3 years ago
I have just about completed my Segway Clone utilizing your instructable, but would like to debug it before I put power to the motors. I am looking for the "test" code you have to verify that the accel and gyros are working right. On the instructables site, both links to the code examples are the same and are not the "debugging" code. Could you send it to me or tell me where else I can download it from? Thanks very much - this is the best instructable I have seen. -Jeff
XenonJohn (author)  jrcnelson3 years ago
I keep attaching it to this instructable on first page and it keeps being magically removed after a few days - not sure why. Send me a message with your email address and I will send it to you. Best wishes John
karandex3 years ago
I am from india and i dont have access to 5 axis can i use 3 axis accelerometer and single gyro ? I have access to this shop please suggest parts 
XenonJohn (author)  karandex3 years ago
The minimum you need to get something to balance is a one axis accel and a one axis gyro like my original monowheel board has.
I put some notes on reading and scaling these here on my original website:

The nunchuk / wiimote+ combination looks pretty complex to me. I put a link to it on page 1 of this instructable - good luck if this the way you really want go. I am no expert on that combination.
 thank you but i got a vendor in india with 5dof tenet technologies
is this code robust that if i keep the electronics same it will work with any low CG configuration ? I was thinking to build a prototype with DC motors, what rpm or voltage should i use ?
Also one more thing , can i make segway with it ?

Thank you for your valuable time.
hey i m from india too can u plz help wer u got 5dof ?
XenonJohn (author)  karandex3 years ago
To be honest more or less all of this has been discussed in this Q and A section.

Here is a page I made with links to every single amateur built self balancing skateboard / segway and other oddities I can find on the net. Plenty of people have built segway style vehicles along these lines (i.e. 2 x cheap 24V scooter motors from China).

So my answer is a) probably with some adjustments to code, b) 2 x 24V cheap scooter motors 250W or above, but on level ground may be OK with lower power motors c) Yes.

Best wishes


I rewrote your code to use it with the WM+ and Nunchuk code from the Arduino forum (complementary filter). I'm waiting for parts to be delivered but I can send you the code if you want. Actually it's quite sure it won't work beacause I can't test the whole thing
Thanks but i desided to use IMU as i found a vender in my country. My thinking is that if there is project make it as the instruction say and then improve or customize on it and not to start from scratch
XenonJohn (author)  karandex3 years ago
If I were buying from this supplier I would use:
MMA7260Q Accelerometer Module (1.5/2/4/6G ) as it has an analog voltage output.
LISY300AL Single Axis Gyro (300 degree/sec) as it has, again, an analog voltage output.
I put a link to my page describing how you scale the output from these devices in my previous reply.
This should get you going. You are going to need to do some experimentation and modify the code somewhat, I cannot give any guarantees everything will work first time. However I see no reason why these sensors shouldn’t work OK. I am happy to give advice but not going to rewrite the code for every single accel / gyro combination on the market – just don’t have the time. Best of luck.
Pooloop3 years ago
What the maximum amp that I can use on the baterrys?
XenonJohn (author)  Pooloop3 years ago
Lead acids will give a very high current at least for a short while. This is one advantage of lead acids in this application (i.e. when about to fall off, motor really needs to rapidly move so it is balanced underneath you again - so draws high current just for a very short moment). The more exotic batteries such as the LiFePO4 ebike ones vary but are lower regarding peak current thery can supply (although store more charge for their weight in total). I burned out an OSMC motor controller the other day with 2 lead acids on it on my monowheel. It was hot day, poorly ventilated OSMC with no fan so my own fault. However with new one I now have a current limiting circuit breaker that will shut everything off if current goes above 75 Amps.
hi, i am dutch but can you please send the code... and also can you tell me witch motors you used?? because you say that u use 24 v but where did you get them... e-mail: tnx
XenonJohn (author)  nielsdewinterr3 years ago
Code link on title page. Right click and download it. It is an Arduino sketch. Motors: 24V scooter motors from ebay. 250Watt each. Search under "electric motor" or "electric scooter motor" and they will all come up.
hey really nice project,Great Work..! would like to build my own could you please send me the code at pls suggest me the parts cauz here at india we dont get the parts that you have used. pls reply as soon as possible thanx in advance.
XenonJohn (author)  emailadityaa3 years ago
Code is there for you to download on title page 1 of the Instructable. You will have to adapt it to whatever micro you plan to use. You need a gyro and an accelerometer to get it to balance, again depending on what you can buy. John
Pooloop3 years ago
I think the input resistor are 25k ohms, Cheak pls
XenonJohn (author)  Pooloop3 years ago
Brown Green Orange is 1, 5, x1000 = 15K Ohms John
karandex3 years ago
I want to use h-bridge to make small segway with small gear motors, So how can i change code for serial output to sabortooth to l293's pwm and direction output. I know how to use h-bride , i just want to know how to interpret the serial code to pwm and 2 dir pins
TXTCLA553 years ago
Would it be possible to buy one? :P seriously!
karandex3 years ago
I read your code. I want to use a hbridge chip like l293. It got 3 pins for each motor, 1 for pwm and 2 for direction. I cant understand how to translate sabertooth serial to h-bridge. A code for h-bridge will be great. Thank you
tuzzer3 years ago
What kind of lead-acid battery did you use there? How many amp-hour should we get? And do the motors actually draw 20amp all the time? Just want to know how long could this skateboard run in one charge and see if I should get a heavier but a higher rating battery.

I am trying to build this and powered it with Lead-acid battery. However, I have not used lead-acid battery before. I read that the lead-acid battery cannot be discharged too much. How do you know when it has been discharged too much and when to charge it??
XenonJohn (author)  tuzzer3 years ago
They were two 12V 7 Amp hr batteries (but only because I had them from an old project).

Motors draw very little current maybe one or two amps from experience of others (the "Emanual" project) when balancing or moving along gently on a level surface. Some discussion on this lower down this page of questions and answers.

I used a 5 LED voltmeter display from a robot shop to tell me when to recharge (when only 3 of the 5 are lit I recharge it.

Here is a link to the ones I use:

Best wishes


XenonJohn (author) 3 years ago
There is a link to the code below the main picture on the main title page (which is below the 2 video boxes)

If having problems come back and I will email it to you.

best wishes

karandex3 years ago
 i want to make a smaller ver with 12 dc hobby motors , and a l293 motor driver. But can u suggest changes to motor driver part of code ?
As i can see its a closed loop robust system so can i scale it to a segway design or small self balancing robot ?

karandex3 years ago
 What your say on using wiimotion plus and nunchuck because the part you suggesting is twice the price of both in my country and i already have nunchuk
what changes should i make to code and hardware ?
Accentrix3 years ago
I think this project has globally caused the 'Razor E100 rear wheel set' to be out of stock.
Yes ! should have new stock 03/05 or 05/05 I don't remember what they said
I have all of the part to build this with exception of the wheels... :(

Razor should have been better prepared for this :)
MonsterScooterParts ETA is now June 14th -_-'
I managed to order and receive mine from:

Although it was a bit mor expensive at $29.99 each.... : /

Razorama has stock!
XenonJohn (author)  Accentrix3 years ago
Any chain driven wheel from rear of a small electric scooter would probably do. It was just that the razor one seemed so "all inclusive" as a package.
Snoochy3 years ago
Hey John, I found your Instructable inspirational and decided to get off my procrastinating butt and try and build one for myself. For the past two months I've been slowly saving for and purchasing the parts and just made the final one for the Sabertooth motor controller. I'll post where I sourced and the prices if anyone wants to see the cost involved from my round of purchasing (I live near Seattle, WA).

For anyone else doing this (with less experience on the electronics side, like me), I strongly suggest starting out by buying the Arduino board and some supplies...or learning to recycle from old equipment. I bought my first board with a couple used books as my first purchase and have thoroughly enjoyed playing with it while saving for the other parts. It's kind of an eye opening journey. 

Thank you for the wonderful Instructable and great responses to comments and questions. I'm sure I will have some before I successfully complete the project.

TSC3 years ago
5 stars!!!
djdenny563 years ago
will the file for testing the gyro and accelerometers outputs work with ONLY the IMU 5 dof connected to the arduino and nothing else? or do i need the motor controller, steering etc. connected as well?
XenonJohn (author)  djdenny563 years ago
Motor controller does not need to be connected.
It will display the value from the overall gain potentiometer so you can check it is working but will still work if pot not connected.
Steering inputs all disabled.

All you need is arduino powered up and the IMU connected.

Start it with IMU tilted and stationary, then slowly bring it level (IMU board board now perpendicular to ground as it would be in real board) and it should start spitting out data into the serial viewer window.

hey, i am building my own but i am modifying more to a segway type thingy and just so you know it costs roughly $350 in u.s. i should be done with the instructable in about 4 months because i have to save up for the motor controller and gyro. pretty cool, this instructable is.
Kresjan3 years ago
Hey thanks for this great instructable!
im building my own at the moment.

Could you tell me a little about the lithium battery you bought for your other board?
the problem is we're running two motors and its hard to find packs with a bms that can handle the peak currents this build theoretically can do.
what are the specs of your pack and where can i buy it?
XenonJohn (author)  Kresjan3 years ago
The other thing is that I really would not spend big money on batteries until you can get it to balance.
Could always use 2 car batteries and some 6ft long wires if it came to it. That would be enough to test it. Due to the reduced weight of not having the batteries "on board" you might have to turn gain down a bit (or put some weight on it) else would be a bit twitchy, but it should still balance.
XenonJohn (author)  Kresjan3 years ago
It was a 24V 10Amp-hour LiFePO4 e-bike battery from a Hong Kong supplier on ebay. It was not this one but very similar to it:

You are right though: The max "rated" curent is 10Amps and as you say, the Sabertooth and motors can in theory draw more than that.

I have not had any problems so far however but have not tried this board up hills just very slight inclines.

My monowheel worked up hills but that had 2 biggish lead-acids in it.  
Also when dissecting the ebike battery, I noticed the metal strips joining the banks of cells together were very thin, like thick foil almost. Therefore I am not sure if the 10Amp rating is due to the thin metal inter connections, or a property of the cells themselves.  What happens when an e-bike goes up a hill? Does everything just burn out? I find this “rating” odd when the intended commercial application (an e-bike) is such that the battery pack will be used most when going up hills – where all the same problems and concerns would also apply.

Maybe best to try an e-bike forum as these guys spend a great deal of time discussing different types of batteries.

 Best wishes  John
technoguy943 years ago
I know you're trying to keep it cheap, but could you at least have the wiring diagram+program for the nunchuck? I don't know about anyone else, but I would prefer it if/when I build one.
XenonJohn (author)  technoguy943 years ago
Here is an instructable on a general purpose arduino / standard Wii Nunchuck interface I have just done. There is plenty on the net on this but this should be a reasonable way to get something working.
XenonJohn (author)  technoguy943 years ago
Having enough trouble keeping up with all those attempting to self-balance!

I think best thing would be for me to make a separate instructable on how to steer something with a wired and a wireless nunchuck and then put a link to it here.

My wireless nunchuck board uses an arduino just to continuously read data from the wireless nunchuck. It then varies voltages on the output pins which are sent to the steering inputs of a separate (older, non-arduino) board that is controlling the balancing and power to the wheels.
Montspy4 years ago
Thanks a lot for this awesome Instructable !
I'm trying to modify your code to use it with Nunchuk and Wii Motion Plus IMU but I don't understand this line :
x_accdeg = (float)((accsum - (350 + balancetrim))*0.862);
- How did you found the 350 value ?
- if I understand, accsum is the filtered value of the Z axis accelerometer, so how do you find an X axis accel value ?

Thanks again.
XenonJohn (author)  Montspy3 years ago

accsum is a value from 0 – 1023. It is derived from the most recent seven accraw readings (also on the 0 – 1023 scale) from the accelerometer (one reading per loop of the program). You could just use mean of last 7 readings but the Savitsky Golay filter I have used (hence the strange maths to calculate accsum) filters out more noise than a rolling mean and yet still gives a more up to date “true” value. A rolling mean is always slightly out of date.

If the mid point output voltage from the IMU (when IMU held vertical) for the accelerometer we are using was 2.5V then the arduino analog input pin (which reads 0V as a value of 0, reads 2.5V as a value of about 512 and reads an input of 5V as 1023) would return a value of 512.

However this particular IMU is supplied with 3.3V, not the 5V we are maybe more used to, and when level (board perpendicular to ground) the voltage coming out is about 1.7V (I measured it with a digital voltmeter), not the 2.5V we might be more used to expecting.

So 1.7V at the arduino input (designed for inputs from 0V to 5V) gives a value of about 350 when board balanced (i.e. not 512).

Tip it one way and the value will drift below 350 and the other way and it will be more than 350.

In all our subsequent maths we want "balanced" to give a value of 0, tilt one way and value goes -ve but tilt other way and it goes +ve.

So we get the value of accsum (which using above logic will be 350 when board level) and we subtract 350 from it to get a value of zero when the board is level. Tilt one way and the value will now go -ve, tilt other way and it will go +ve. We add a small "balancetrim" value to the 350 that is then subtracted (it can be a -ve or a +ve number) according to use of the balancetrim switch. This adds a little bit to the 350 or takes a bit away from 350 before their total is then subtracted from accsum and this feature just allows user to fine tune the balance point of the skateboard.

We then multiply [accsum - 350 (plus or minus the small correction factor)] by 0.862 to convert it to an angle in degrees - just a small tweak - a scaling factor. We use degrees at this stage just because we remember from school what 90 degrees looks like, and can roughly work out what 30 would look like and so on.

I use the Z accelerometer simply because the way the IMU is bolted to my skateboard, it is the z-accelerometer which actually ends up in the correct plane of movement to measure the tilt of the board - that is all.

I hope this helps everyone

Thank you !
I unerstood everything, I hope my board will balance !
jongscx4 years ago
Just a couple of things that might have been addressed already:

1) I'm sure it was because you already had the board up side-down when you were building, but mounting the electronics on the underside seems super risky.  Sure, it's fine when you're demonstrating in an controlled environment, but one stray rock and you could brick your arduino or ESC.

2) Same thing wth the exposed motors and drivetrain.  you could probably add some cheap sheet-metal skid plates and it'll double as a chain-guard.

3) wiimote nunchuck! as hand controller.

hope that helps.
XenonJohn (author)  jongscx3 years ago
I agree, my board with the batteries in the deck has the controllers etc under the board but encased in polycarbonate so you can see everything but damage resistant to small stones etc.

There is still no way I would ride it on a wet surface though!

It does take longer than you think to make neat enclosures.
dbasner4 years ago
 First I would like to say that you are doing a really great job documenting this, as well as answering everybody's questions.  I am a highschooler trying to scavenge some leftover parts to build something like this.

  Here is my question:
although they are of a much lower spec, I have a few Victor 884 motor controllers (handle 12V, I know, pretty low) laying around from FIRST robotics (dean kamen sponsors it!), and I was wondering if I could use them instead of OSMC's as they are really expensive, specs:

      Victor 884:
PWM input
40A capacity

If they aren't up to spec, could I use lower power motors and just deal with the slower speed? If so, any motors in mind? If you can't answer the last question that is fine, I don't expect anybody to know any off the top of their head.  Again, I really appreciate you documenting your build!

agent dbasner4 years ago
Test the Victors, then see if you can test some Jags :D
Foxx dbasner4 years ago
 Criten and I have made a board that works rather well in less than 4 days. As he mentioned, we're using Victor 883's, 2 CIMs and the Kit Transmissions from 2005. here is a video of it balancing and riding around a small space. It doesn't have controls for turning yet, but its a work in progress
Criten dbasner4 years ago
 I'm using Victor 883s and they work great. I am using them with CIMs and they are MORE than powerful enough for this application. Although you do need to re-do the motor controller code. IM me if you ever get around to the coding part and ill send you what you need. Unless you already got it figured out :P
dbasner Criten4 years ago
 Thanks for the information! I sent you a private message thing, but it didn't give me any conformation on if it was sent, so I will comment here as well.  I want to do the coding myself, but if I could look at your code/whatever you plan on sending for a basic idea of what need to happen, that would be great! what exacty is wrong with the original motor control code? my email address is (dbasner (at) gmail (dot) com) I really appreciated this!

dbasner dbasner4 years ago
 Also, I already have a broken electric scooter (the pin on the charger got bent and fell off, inside is OK I think), Could I just use the motors and wheels from the scooter? Its the same model if not more powerful/new.
XenonJohn (author)  dbasner4 years ago

I think the smallest scooters like this have 100W motors. Not sure if a 2x 100W skateboard would be powerful enough to balance your weight but it might ust about be on a level surface.
If not, well you would have just built yourself a self balancing robot platform.

The hardest part is getting it to balance. If you get that far you might have the confidence to scrounge/beg/blow some more money on bigger motors - you would already have done the hardest part.

2 x 200W or above would be fine. The board I showed has 2x 250W motors and I am a far from "average" 70kg male (think heavier!).

By the way, there are two other guys from FIRST robotics also having a go at building one of these from old robot parts and things they already have lying around.


XenonJohn (author)  dbasner4 years ago
They would probably work OK on level ground.

12V 40A is equivalent to 24V 20A in terms of power they can handle in Watts. The sabertooth controller I used is 24V 25A each channel (40A peak) per channel, so I presume yours might work OK.

Also they have to be able to run in both forward and reverse directions to enable balancing on the spot (but interestingly not while moving along where it is just acting as a variable throttle - think of a motorbike doing a very long wheelie).

The guy who built the "emanual" board measured just a  couple of amps being drawn when he rode it along a level sidewalk.

You only really need max power when going up a hill, or about to fall off when motors need to speed up very fast to rebalance underneath you.

Could use a pair of powered wheelchair motor/reduction box/wheel combinations but I think they are usually 24V as well.

Alternative is motor/rear wheel assemblies from two broken electric childrens scooters. Smaller ones are 12V. Not sure if powerful enough to keep you balanced but might be if you are taking things easy on a smooth level surface.

I hope this helps a little.
it is cool. could you put a few tilt sensors or some thing in it so it balances it self and all you have to worry a bout is direction and speed 
Can't you read? "Easy build self balancing skateboard"
XenonJohn (author) 4 years ago

4th April 2010:
I have added pages at the end showing the same hardware now mounted onto a large skateboard deck. This has allowed me to ride it and compare with my other board.

Consequently I have adjusted the software to tighten up the ride, fixed a small bug, and have also altered the steering so the rate of turn is now held constant under guidance of the second gyro.

Link to new code is still on page 1.
Everyone who has previously emailed me for the code has been sent a copy of the improved version.


Have you considered an "in line" arrangement of the wheels along the length of the board instead of parallel? I mention this with a throwback to the cars on orbs in the movie iRobot. I think orbs on the far ends would allow much greater turning torque potential (for those crazy enough to attempt a triple lutz). By using orbs, you can operate the balancing feature in more dimensions and not just in the same direction of travel. It seems like this orientation is the next step.
cdogjune4 years ago
Has anyone started playing with the cheaper accelerometer?  Is it a direct wire?  Do you need to modify the code?
XenonJohn (author)  cdogjune4 years ago
For any gyro / accel combination you may have to modify the code. The thing is to look at the datasheet (usually downloadable as a pdf). It will tell you how much for example the output voltage from the gyro changes for any given rate of turning.
The things to alter in code then are the scaling factors.

In my code I always start by calculating rate of tilt (tipping) in degrees per second, or in the case of accelerometers, the angle from vertical in degrees. -ve values are tilting/tipping anti- (or pehaps counter-) clockwise, while +ve values are tilting/tipping clockwise.
If the scaling of the voltages from the sensors allows you to get that part right, the rest of the code should then still work OK.
Also is very easy to accidentally get one of the accel and gyro pair back to front, so the effect of one is opposing the other! Not such a problem nowadays as they tend to come on the same small circuit board.
Kresjan4 years ago
Hey great instructable i am thinking of building this and was wondering about the Sabertooth can it run on 29v and can the motors be 350w? would this kill the sabertooth or will it be ok?
XenonJohn (author)  Kresjan4 years ago
It does say 24V max (6v min) on data sheet.

It can supply 25A per channel. (50A peak)

Watts is Amps x Volts so can theoretically cope with 600 Watts per channel.

So, 29V - maybe risky.  350W no problem by the look of it.

Check out combat robot websites if you want to look at other makes of controller that will take higher voltages, lots of them out there. Sabertooth is just quite easy to set up, has lots of modes, just 2 input wires, and current overload protection which is why I chose it.
OSMC for example has 5 input wires as opposed to just 2 on sabertooth so a little more fiddly to set up, bearing in mind I was trying to make this project as easy as possible to build.
Kresjan Kresjan4 years ago
 oh and also can i use a Pot for directianal control as in left right?

XenonJohn (author)  Kresjan4 years ago
Yes you can. You need to change the code slightly. There is one spare analog input I have not used. You could read that pin with a potentiometer sending a variable voltage to it, then use the value to control the relative power sent to each motor.
Basically you let the balancing algorithm do its job then when it has worked out the motor speed it wants, add a bit to one motor setting and subtract same amount from the other depending on the pot value.

If you look at the code you will see what I mean.

I have also just worked out some code to make the second gyro control the rate of turn proportionally to the pot setting.

Maybe I should post 2 sets of code. Basic to get it balancing (the most important part by far), then another set with some extra features added.


My parts are ordered. The 10K potentiometer has three connecting points. I can only see where one wire is connected. Would tell me where to connect all three wire's. I can't wait to get my parts and start riding.
XenonJohn (author)  fixitmankeith4 years ago
Potentiometer has three pins in a row. Resistance across the far left and far right ones should be 10K Ohms. This means centre one is the "wiper" moved by the control knob.

Connect the far right one to a +5V supply pin on arduino (designed to supply things like this).

Connect the far left one to one of the GROUND pins (marked as Gnd).

In each of these 2 wires put a small resistor about 150Ohm just to stop the full 5V being sent to the analog input pin with no limit on the current when wiper is turned fully across to the 5V side. May not be essential but I have done this just to be on the safe side.

The wiper (middle pin) now will read anything from 0 to 5V (approximately)as you move it around, if you put a voltmeter between it and ground - worth doing just to check it is working properly.

The wire from this centre pin therefore is now connected to the analog input for the "overallgain" control.

Once you have it working you might want to just fix an "overallgain" value in the arduino code later on and get rid of the potentiometer. However it is also useful for experimenting with other variables in the program while machine is running.
john henry4 years ago
i live in the US and i found all this would cost me 366 but i picked 350V motors so its a little more costly . i added 2   12V jell acid batteries. and not including shipping cost.
it would be 189.62 GBP but some of my parts dont ship internationally sorry UK.
but for US people here my list.
motor driver

your welcome!
alienwear4 years ago
I don't have any idea how realistic this comment may be, but how about using some form of piezoelectric for turning? This would enable leaning and remove the need for any form of hand controller (so long as the adjustable balance point was not needed).
XenonJohn (author)  alienwear4 years ago
I agree. The turning software is at present quite crude - tacked on at the end. I want to use the gyro that stops sudden spins to actually maintain a set rate of turn, slower turn rate if you are going faster, and make it proportional to input (joystick or pressure sensors). That way the nature of the terrain within reason should not affect it.
By making the turns feel better for the rider this way, should be able to turn while going fast and lean into the turns, like you do on a normal skateboard.

Incidentally, for balancing, the machine does not have to be symmetrical i.e. weigh the same each side of the wheels, as you just stand a tiny bit off centre to compensate.
For turns though at speed it would matter (think of an early Porsche 911 swapping ends on a bend).
mspark4004 years ago
Excellent project and excellent documentation. The world of diy self balancing projects was really in need of a step by step low cost solution, myself included.
One question however. your motors peak at 250W each. your motor controller is much much less than that. Now i understand that you would probably need to have a death wish to try an use all of the motors power but couldn't speed be greatly increased (if desired) by using a higher wattage motor controller. This might increase cost a little but an OSMC (1 or 2) might be an option to consider for those seeking speed. The batteries would  be able to provide more amperage (shorter ride time of course) but also higher amp hour batteries would increase speed and runtime if the constructor was willing to pay a little more. However your design is an excellent one for the price and I am sure it will be very helpful to those wishing to duplicate this design.

XenonJohn (author)  mspark4004 years ago

Well spotted error of mine!

I have changed page 26 describing the Sabertooth. I said 2x25Watts when of course I should have said it can handle 2x25 AMPS (40 peak) per channel (forward or reverse).
   This is a Sabertooth 2 x 25Amp (40Amp peak) robot motor controller for medium sized robots with 2 motors.
The motors I have are 250 Watt 13.7 Amp peak (that is what it says on them). Watts = Amps x Volts and I have 24 Volts so that makes 10.4 Amps using that calculation. Anyhow, well within limits of the Sabertooth. Could actually go up another motor size.
   My one wheeler has an OSMC and a golf cart motor rated at 500W but it is a real beast of a motor. It will easily get up a modest slope. Have not tried it on steep uphill as don't want to risk burning out the OSMC (although you probably wouldn't).
   On the Emanual 2 website he had 2 hub motors from ebikes and measured just a couple of Amps being drawn when going along a level pavement.
   Re batteries: My really nice twin wheeler has LiFePO4 batteries from an ebike (good for 20 miles plus) dismantled and laid out flat within the deck. Entire deck is actually a battery. This was a seriously expensive battery, even from Hong Kong supplier, and it ran all day long at maker faire and charge status LED bar was still saying full charge. Lead acids however do have an advantage that they can throw out a very high current for a short time - useful in this sort of project if you are about to fall off as motor wants to boot up very fast to prevent this happening.
   With this project I have really seriously honed in on bringing down the cost. If someone is unsure of they will get it to balance - a reasonable concern, they don't want to spend a fortune straight away. Once you can get it to balance, you then have the confidence to blow a load of money on a clever battery, I agree. Could have bigger wheels, bigger motors, sure.
   Combat robot builders point out that best way to burn out a motor controller is go go for full power while motor i.e. wheel is jammed stationary for some reason. However, the Sabertooth has an overload cutout that should save it from burning up in this way.

Thanks for spotting my mistake and nice words.

PS I am really amazed, I am getting about 200hits an hour right now. It must level off soon. Can only be so many people out there into this niche subject.

It's not a niche subject by any means.Loads of us would like to have a Segway,but this is a neat,fun,CHEAP alternative,that people can say"I made it myself"!!Excellent Job! You were posted on

XenonJohn (author)  lgcalex4 years ago
Instructables viewers seem to be a much nicer and more constructive bunch of people!
Heh, this came at an opportune time - the day after we learned our final project for my Control Systems course will be to write a control code (from scratch) for a self-balancing robot.  Granted, ours won't be applicable to Arduino platforms without serious revisions, but I'm quite tempted to build something like this myself now.  I'd like to see if I can create my own custom code.
Excellent instructable!
Rportal4 years ago
would it be possible for a parts list, for the two wheel.
all you have on your site and instructables are for the one wheel
XenonJohn (author)  Rportal4 years ago

The parts list on front page is for the two wheeler in the instructable. You do need two of the motors and two of the E100 rear wheel units.
I have said wheel sets (x2) and used the word motors.
I should maybe say chains with an "s" at the end.

You only need the one sabertooth 2x25 though as it is designed for 2 motors, one for each side of a robot, one arduino board and one IMU. I will change the parts description slightly.

Best wishes,

godofal4 years ago
this looks pretty interesting, and im thinking of building one, but i could use some more specs on the parts, especially the battery, the motors and the wheels that you used.

and any chance on an instructable with the nunchuck version?
XenonJohn (author)  godofal4 years ago

Battery was nothing special. Two 12Volt 7 Amp/hr lead-acid batteries in series to make 24V. Can be any physical shape. My monowheel has 2 x 12V 14 Amp/hr batteries - just gives you more endurance.

NOTE: Don't put 24V into Arduino board - the smoke will come out. This is why in mine I gave it its own 9V battery.

Car batteries would be fine for playing about but way too big for finished vehicle.

Electronics shops like Maplin just have them in stock all the time, as do robot websites if nowhere local has something you can use.

thanks for the quick response!

ive been looking at the razor site, but they dont ship to the netherlands as far as i could tell...

as for the motors, i can find alot of 24V 250W motors that look like the ones that you used, and the price is about the same, but shipping is about the same price as the motor itself, did you have this also?

as for the battery, how long do you last with those 7 amp/hour?
i can find alot of 12V lead-acid batterys, so that shouldnt be a big problem...
godofal godofal4 years ago
one more question, how do you charge those batterys?
XenonJohn (author)  godofal4 years ago
Electronics catalogues have small 12V trickle chargers with clips on end of red and black wires. I got mine from a local Maplin store. Not fast but safe. Buzzes when battery fully charged (overcharging can shorten battery life).
All online robot shops have chargers too.

Car charger might be too fierce.
hmm, i might have a try with the barebones atmega328 (interested in pictures?)

i loved the fact that the euro is high and the dollar is low, so i might check some other shops online in the US, and maybe the netherlands, to see wich one sells the stuff the cheapest (hey, its supposed to be low-cost XD )

and about the charging, ive got a 12V trickle charger solar panel, im guessing it wont charge fast, but would it charge or just maintain the voltage?
godofal godofal4 years ago
i just found this:
razor e100 rear chain driven wheel

this is the cheapest i could find, but they dont do international shipping standard, so im not sure if anyone outside the US can get them easy, havent tried yet, il post my experiences with them when i get them...
XenonJohn (author)  godofal4 years ago
OK, here we go, this is the webstore in UK I got the rearwheels from. Scroll down page to the E100 rear wheel (has picture to left of it):

They may not ship from US, but you may be more lucky with an EU distributor like this regarding shipping to Netherlands.

Motors are strange. 2 years ago there were masses of them on ebay. Now far fewer. Not sure why. Again if you are desperate, the scooter shops themselves sell them of course.
NOTE: the “proper” motor for the Razer E100 is actually quite small. You need motor designed for a bigger scooter (if you are trying to get it from a scooter shop spares dept, around 250Watt or more I would say).

godofal godofal4 years ago
btw, i just realized.
isnt it cheaper to just use an atmega328 with some components like the crystal and such soldered to eachother on a protoboard of some kind?
just use a 6pin header for the programming (use a DAPA cable if you want it really cheap)

maybe im talking really dumb atm, i havent exactly looked at the prices, but i cant imagine that a loose chip, some components and a piece of protoboard is more expensive than a full arduino...
XenonJohn (author)  godofal4 years ago
Yes, you are probably right.

There were 2 aims, low cost but also relatively easy buildability (no welding for frame for example).

I am using a standard Arduino board just to make the microcontroller part as simple as possible to build and program.

XenonJohn (author)  godofal4 years ago

Find an electric scooter website thats sells the Razor E100 scooter.
Early versions had a belt drive but most now have chain drive.

Go to spares section and find an "E100 rear wheel assembly" this gives you entire wheel, with sprocket fitted, bearings, and axle all assembled for you.

Go to ebay and look under "electric motor".

Among all the rubbish, some motors that look exactly like the ones I have used will come up. They just vary in maximum Wattage rating up to about 500W. They have a small sprocket already fitted.

One or two old stock smaller ones have toothed belt drive wheel fitted - you do not want one of those. Check the image before you order and check there is a chain sprocket on the motor spindle.

I dont want to really post links to any specific sites but google will find them for you.


What is the top speed?  You dont seem to cover distance in any of your videos either.
XenonJohn (author)  PerfectionLost4 years ago
Not sure why so many (on other forums mainly to be fair) find the top speed so important. When you are riding on 2 wheels being balanced by a computer you are limited by raw fear rather than the mechanicals. Not the best design for outright speed.

500Watts of combined motor should push you along pretty fast on the level if you have courage enough. My 2 wheeler seems to peak at about 10mph at the moment but that may be software related (always need some power in reserve in case you are tipping forward at speed so it can speed up some more to correct it). Monowheel has a buzzer warning you when at 75% of max power to motors (have never been brave enough to make it go off).
  Distance: Segways, electric scooters, go-peds etc all banned from public sidewalks in UK. Will actually be stopped by police. Private land only i.e. my front driveway in early videos (which slopes).
Makerfaire video was first time I had big space to ride it round (a large marquee and an indoor exhibition centre). Also rode around large open square (not filmed).
UK much smaller, built up and densely populated than US!
Maybe should take it to the Netherlands: big, flat, open, everyone cycles, segways legal. Someone there may build one by the look of it.

For speed I would get an e-skateboard, the big ones do up to 35mph.

The advantage of these are actually low speed control: I could ride it between all the visitors at any speed down to completely stationary (but still balanced) also able to turn round while stationary. The visitors didn't have to jump out of the way when they saw me coming.

Top speed is important, though I suppose actual speed is just if not more important.  My car can probably go around 200 mph even if I usually only drive it around 65.

Maybe a better question is, would I want to use this for a short commute, where I would be walking otherwise.  All the videos seem to be using it in a fairly confined space.  That would make this a novelty item.  If you could use it for a short commute, or while bar hopping that extends it to something that is generally useful and awesome.

As someone who has never been on a device like this its somewhat important for a frame of reference.  I've biked distances, and I tend to go between 10-15 mph.

Fox-san484 years ago
Uk rules :D,

and i love it, altho i dont know what that aurd... thing is, i have seen it in loads of insturcibles
XenonJohn (author)  Fox-san484 years ago
The Arduino is an AVR microcontroller (a small computer on a chip) mounted on a small circuit board. The board has power supplies sorted out for you plus pins down one side that accept variable voltages from sensors for example (0-5V) and pins on the other side to that can be used to control other devices (in my case the unit sending power to the motors).
It is open source so anyone can make and sell them. Anyone can write software for them and put them on the forums. Loads of code on the forums you can use and modify for what you need to do. They are great for beginners as you program them in a version of the language "C" that essentially has had most of the tricky bits taken out and done for you.
You program via a USB cable. You can send data (various variables in your code for example) from the program back to the screen of your PC very easily to help debugging. Also they are quite cheap for what they do.
If you look on Amazon for example, there are books on getting started with Arduino. If you are more keen on getting something up and running fast than having perfect code, at reasonable cost, with huge friendly forums to help if you get stuck, Arduino is a great way to go.
Hope this helps,

thanks, although is "C" easy to learn, atm i know Batch basicly and some html. i looked Arduino up, im guessing having a soldering iron would be useful for connecting to other devices? unless ofcourse they have those screw connetion things. sorry about my bad techical language, funny i did electronics last year and year before only reason i stopped is i moved to australia (sucks i know, england is better still lol) anyway getting off topic
thanks anyway :)
it did help
XenonJohn (author)  Fox-san484 years ago
I bought an arduino beginners kit which some websites sell that gives you an Arduino board, a breadboard, a set of small peripherals (simple temperature sensor, small motor, some LEDs and so on) and a set of tutorials that take you through basics of writing code, reading from sensors and controlling things as a result.

Work through that (wouldn't take that long) then start looking at examples of code on the forums.

I would say that is probably fastest way to learn.

Don't need to solder to get that far just use the breadboard and jump wires.

I think for projects generally though it would be worth learning to solder. It's a bit like how you learn to weld (get some old steel and just start having a go) but a lot easier - just get some old components and boards and start having a go!

Maybe start by trying to make up one of those small electronic project kits where everything is in the kit.

Hope this helps,


ah thanks, i was just wondering, i know how to solder though, did it during electronics
thanks :)
everywhere4 years ago
for the one wheel verioin how wide must the wheel be like could i use the wheel form a e200?
XenonJohn (author)  everywhere4 years ago
Wheel has to be wide enough to stop you falling off sideways. The Ben Smithers monowheel (the first one I think of the skateboard monowheels) had a go kart wheel one size smaller than the one I used.

If you have a great sense of balance, you might get away with a smaller wheel in terms of width. I played it safe with widest wheel I could find!

Also, the higher the deck off the ground, the easier it will tip you off sideways if one side of wheel goes over a pebble for example.

In terms of fore-aft self balancing (controlled by the motor),  you could make machine as tall as you like - use a ladder if you want and sit on top! It might even work better.

Just remember with a monowheel, a lower centre of gravity makes it much easier to ride and steer (by tilting left or right) in terms of falling off sideways.

This is why I rebuilt my monowheel with deck lower to the ground. I found out this the hard way.

Hope this helps,

thanks i just have an old e200 in my garage and wanted to convert it

XenonJohn (author)  everywhere4 years ago
Here is another related monowheel idea:

Lock two wheels with pneumatic tyres to one single axle, driven by one sprocket (so both wheels driven together).

So long as tyres not inflated rock hard, then leaning to one side will compress one tyre more (reducing effective diameter of that wheel) and skateboard will gently turn.

Adjust wheel spacing according to your balancing skill!


gabo904 years ago
Congratulations!!! I think it woulb be so cool if the board was made of plexiglass instead of wood, so people could see through and how it works... ;)

XenonJohn (author)  gabo904 years ago

Motors bolted to deck to avoid welding. Has to be pretty rigid else chain tension would vary as base flexed. Maybe very thick plexiglass might be OK!

Could put motors on top and batteries underneath, see page 13, that would give you a machine with loads of visible moving parts.

Also, I spent so much time dismantling an e-bike battery and arranging the cells flat in the deck of my own twin wheel board that I did make the underside of clear polycarbonate.
Also I can then see if anything is melting when I am charging it!
Unfortunately as the cells are pink it looks like rows of sausages.

EmmettO4 years ago
 I've been slowly collecting parts for a personal vehicle like this (slightly larger). Other than the Sabertooth I have all the parts! The code for the Arduino will be very helpful. If I'm ever rich (unfortunately don't bet on it) I'll gladly fund your ultimate skateboard project.

One question. I have two lead acid battries that are for a lawn tractor. They're not as big as full car batteries, but a bit bigger than the ones you show here. The question is, would they have enough juice to do things like climb hills? I'm using big knobby tires so I would like it to be able to handle grass etc. Do you think these motors with lead acid batteries would hack it?
XenonJohn (author)  EmmettO4 years ago
I am not sure is honest answer.
Lead acid batteries would give high current no problem and get you up hills, the endurance would be the unknown factor. Huge amount of discussion on this on ebike forums by the way. They obsess over battery types / motor ratings. Vehicles are different but the maths is probably similar.

For a big machine going up hills the bulletproof way is to use two OSMC controllers. These can take huge currents, but cost a lot more than Sabertooth as you need two of them. The Sabertooth is described as being for "medium sized robots" You need something that will run uphill with maybe 100-120kg total all up weight.
This is where the costs and the size of the machine start going up. Really big motor controllers are not cheap. 

Take a look at this website for example. It is a segway clone called the "Meta" by Geoff Bennett with biggish lead acids and two OSMC's. It illustrates these points.

Based on original segway clone by Trevor Blackwell.
 So I should keep it light or pony up for a pair of OSMCs. That's actually why I've been waiting to finish the project. I think I'll try the Sabertooth and see if it's enough. If it isn't I can use it on another project.
Could you add the cost of each item on this page?
XenonJohn (author)  PerfectionLost4 years ago
Can do.

It's on page 36 at moment.

£273 plus batteries, a few cheap switches and a some thick wire.

Actually, I meant to put that on Step 1.  A list of each part and price w/ the pictures would be a huge help.  I think I might give this project a shot with a friend.
EmmettO4 years ago
 This is a brilliant point. 
BHStibal4 years ago
 how very very cool. I love this idea, and it gives me a ton of ideas. What did this whole project cost you, material wise?
XenonJohn (author)  BHStibal4 years ago
£273 plus batteries and a few odds and ends.

Would be cheaper in US I suspect though.

joren4 years ago
Really nice 'ible.  Thanks for posting.  I've ordered parts and hope to build one soon.  350w motors and 8" mountainboard wheels.  Q:  What is the chain ring tooth count on the razor wheels you use?

To further reduce cost, have you considered using a wii motion plus and nunchuck for the IMU?  Would you need a second serial port on the arduino?

Alternately, although I'm not sure if it'll work as well, cheaper IMUs can be found that are 1/3 less the price than sparkfun:

XenonJohn (author)  joren4 years ago

About 50 teeth on the razor E100 wheel chain ring.

The motors I used have 11 teeth.

The more powerful motors of the otherwise same design on ebay seem to have 16 teeth.

If there are cheaper IMU's I would go for it. Take some photos as you go along for the rest of us!

If you go on Arduino forums there is an ongoing discussion concerning the Wii Motion Plus module. Basically there IS now an arduino hack that will read data from the Wii Motion Plus unit. NOTE: This has gyros in it only as it is designed to augment the accelerometers already in the Wii-Mote handset.

Nobody has yet managed to read both the 3 axis accel data from WiiMote as well as the 3 axis gyro data from the wiiMotionPlus (only a matter of time though)

However there IS an arduino hack for the WiiNunchuck and that WILL read the 3 axis accel data from those within the chuck.

If you can combine the code to read a WiiMotioPlus with code to read the Wii Nunchuck accelerometers this would give you all the data you need to control a self balancer - in all 3 axes.

This would be a great programming challenge for someone much better at it than I am.

Best wishes



PopEye424 years ago
Wow.  this is great man.
Senseless4 years ago
Excellent Instructable!

Faved it for future use super nice job on everything.
merijnvw4 years ago
 cool, happened to make a mini segway on school just today from legos together with lego dacta! But yours is much more stable haha
grunff4 years ago
Wow, what a fantastic write-up! Thank you very much John for putting all that effort into documenting it so well. I've long admired your original board (with the gokart wheel). You've made this an easy weekend project, so I'm off to buy some parts :-) 
xesive4 years ago
I am excited to get started on recreating this project but have a few questions before i start getting my hands dirty:

Do you have a copy of the arduino code available?

What is the max speed? (estimate)
What is the max incline?

I live in a city that is more or less a big hill, I want to ensure that this is powerful enough to travel up hills.

Thanks for such a grerat and comprehensive instructable :D
XenonJohn (author)  xesive4 years ago

Electric motors are quite efficient things. PWM from motor controller very fast so not much loss as heat.

Someone may help you here. Should be able to calculate how many watts power needed to get say a total of 100kg up a 1 in 10 slope for example. Then work out motor requirements, take account of gearing between the small and large chain sprockets, and motor controller requirements from that.
My one wheeler went up hills, in early videos (on YouTube) you can see a huge sprocket on wheel and tiny one on motor (500Watt with hefty OSMC combat robot power controller).
Not sure if this smaller one will go up hills. Have not tried. However, the motors I have used can be found on ebay up to 500 Watts each (but they usually have a larger 16 tooth sprocket on them - which would also make it faster on the level of course).
Also this is why you can adjust the balance point: otherwise to go up a hill you would tip nose down and it would hit the hill. So now you adjust until nose up position with balance point adjust switch, then tip nose down (i.e. back to level position) to get up a slope.
Also link to the sketch is now on first page of the instructable.

Best wishes

Awesome job, well done.  I have been working on my software but has a few bugs.  Can I get a copy of yours and see where I am going wrong please.

Thanks, this is a great project that I am going to get a bunch of kids in our neighbourhood to build.
jeff-o4 years ago
Another excellent project.  Well done, and thanks!
me4 years ago
 that looks really awesome
knife1414 years ago
Wow!  I can't even begin to imagine the time you spent putting this instructable together.  Great job!
unigamer4 years ago
lovely instructable! Well written and clear. I definitely want to make one in the summer.
rimar20004 years ago
 This is A-WE-SO-ME!!!


Get More Out of Instructables

Already have an Account?


PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!