What is it?
Twin wheeled skateboard that works like a Segway. Electric skateboards exist already - motors on rear wheels. The 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 an 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 version, with pneumatic tyres and Headway LiFePO4 batteries which was built to see how far you could push this overall concept.
What's new on this Instructable?
FORUM: A nice person has started a forum on this topic. Just posted the first message to get it going. 1/6/13
www.selfbalancingskateboard.com
- Working on code to use the new Sparkfun 6dof DIGITAL IMU. FIRST VERSION ATTACHED 8th March 2012 TO PAGE 53. Only tested as sensor/arduino but prints out believable angles etc, have posted it for those who want to experiment with it.
VERY IMPORTANT NEWS 27/4/13:
Thomas Feminella has almost managed to get a Unicycle working with Sparkfun DIGITAL 6DOF IMU, Arduino and SyRen motor controller. YouTube vid here: http://www.youtube.com/watch?v=mEee1iI6emE&sns=em
Examples of his code are here on an Arduino forum: http://arduino.cc/forum/index.php?topic=153496.0
NOTE: Since this instructable was made, analog IMU's which just output a voltage from each accelerometer and gyro axis have stopped being made as hobby boards by Sparkfun. This is a pity as all you had to do was read the voltages on the analog input pins of your arduino.
IMPORTANT NOTE May 15th 2013: You CAN, AGAIN, buy an analog IMU here on ebay:
http://www.ebay.com/itm/181004141876?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649
Polulu also still sell accelerometers and gyros with analog outputs. They may work if set to their most sensitive ranges if anyone wants to try them:
http://www.pololu.com/catalog/product/1252
http://www.pololu.com/catalog/product/1270
May 2013: I am building a new skateboard. Photos here:
https://sites.google.com/site/onewheeledselfbalancing/Home/18-2013superskate
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 in engineering terms is called a "PID" control system and is used for all sorts of things. For example think of the 300+ 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:
http://www.youtube.com/watch?v=_PEGi3k6yNQ
A: They had engines mounted on gimbals (swivelling joints) hydraulically controlled by a PID control system (lots of analog electronics I think involved too).
Background:
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. http://www.robosys.co.uk/ Video: http://www.youtube.com/watch?v=HGbbag9dklU
It turns out he was a Lotus cars controls system engineer - which makes sense.
Also see Trevor Blackwell's site: http://www.tlb.org/eunicycle.html
Meanwhile I wanted to teach myself microcontroller programming and, totally underestimating the task, thought this would be a great fun way to do this. I built several machines some with one wheel and some with two. Advantage of two wheelers is that they turn more easily and can turn and balance even when stationary - which is fun.
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. Clearly 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.
Skills:
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! Robot motor/gearbox combinations are pretty expensive.
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. Lithium batteries etc are expensive!
Why do it?
i) For the challenge of doing something original. Most things have been invented, indeed self-balancing machines have been invented. 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. You will learn a huge amount.
iv) These things are really good fun to ride! I have taken this to 2 UK Maker Faires now and both times people are wanting to have a go. Last time the BBC cameramen who also had an exhibit politely waited until the end of show, then they too asked to try it out.
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 with no gaps.
Additional information:
I have documented all my machines both good and bad on another website here:
http://sites.google.com/site/onewheeledselfbalancing/
I have a page of links to dozens of other self-balancing projects from around the world here:
http://sites.google.com/site/onewheeledselfbalancing/Home/links-to-other-self-balancing-projects
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:
http://www.instructables.com/id/Self-Balancing-Scooter-Ver-20/
Here also is the Thatch No-Way Segway using my code almost unaltered: http://www.youtube.com/watch?v=R4ax3N0UW38
Has anyone else built one of these?
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: http://www.youtube.com/watch?v=kSW7YXLCjqk
2) Skateboard: http://www.youtube.com/watch?v=u-uUidBZEnM
3) The Velociryder: http://www.youtube.com/watch?v=xvfUIxusPZw&feature=player_embedded
4) Great board video - Buffalo State College senior project: http://www.youtube.com/watch?v=FEaTxahyQxc
5) Another board based on this Instructable: http://www.youtube.com/watch?v=vhbH_AmIKZA&feature=related
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): http://www.youtube.com/watch?v=Vh9LpNQ_S0k&feature=related
7) Carbon fiber racing car seat with 2 - the SciChair: http://www.youtube.com/watch?feature=player_embedded&v=HtivH7INpZ4
8) Carey's self-balancing platform, good video: http://www.youtube.com/watch?v=ngMJcxeB7og
9) Really cool video (on clifftop path by the sea): Skate auto-balancé http://www.youtube.com/watch?
10) The KSLURP board from Malaysia: http://www.youtube.com/watch?v=x3O2NkjJOlg
11) The MIT Seboard, video clip: http://www.youtube.com/watch?v=zZQb-w_wyhM
12) The SITWAY sit-on machine by the 81year old gentleman above, with video: http://www.instructables.com/id/SITWAY/
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: http://www.youtube.com/watch?v=WsYukdSO64A&feature=player_embedded
14) New one wheeler from team cosmos with some technical information and video here: http://teamcosmos.com/skateone/index.shtml
NOTE:
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! http://vimeo.com/2013773
Have fun. Treat it as an adventure. Once you get it to balance there are many ways to improve it.
John
Remove these ads by
Signing Up
























































































Visit Our Store »
Go Pro Today »




I'm using a wii nunchuk as the controller. My question is, should I put resistor at pin 9 for the deadman switch?
Thanks
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!
John
Can anyone tell me the specific instructions to run this part?
Is it the same as the Just Balances part where I need to put one end of the skateboard to the floor, count to 5, slowly bring it level and it will start balancing? If so, when exactly do I step on the skateboard? What is the purpose of the balance point toggle switch? What is the "softstart function"? When exactly can I pull out the USB from the Arduino? I know I ask too much, but I really need to know so I won't screw it up..
Thank you :)
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!
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?
350watt motors would be fine, but do have to have the correct reduction as in the examples in the instructable.
John
http://imgur.com/jaxF4Yv
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 www.selfbalancingskateboard.com I will post many pictures and videos of my own board very soon. Thanks again!
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
John
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.
Kenny
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.
John
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.
John
I'm just wondering, is it possible if we don't use hand controller?
I mean like, we only need to use body motion to move the skateboard.
Thanks!
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?"
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?
http://www.benl.ebay.be/itm/High-Power-50A-Dual-Channel-motor-drive-module-Arduino-Compatible-and-library-/130717806584?pt=LH_DefaultDomain_0&hash=item1e6f636ff8
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!
Stijn
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.
John
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.
John
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.
Any update on on the SIXDOF digital unfinished code?
Thanks.
Regards
William Seow
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,
John
Does your Just Balance act like this http://www.youtube.com/watch?v=MJLbAxnqPfE (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?
Thanks,
Tim003
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.
Thanks,
Tim003
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).
Here is a picture of what I did.
https://www.dropbox.com/s/z3m8vkhdwi3pvmc/IMG_20120910_160508.jpg
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.
Thanks,
Tim
Did you try changing the values already?
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
"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 (http://pastebin.com/LpUd3PFp) 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.
3,9
\n
balancegyroDegrees:7.07 accelDegrees:-1.11 overallAngleofTilt:1.90 accsum: 345.29
3,9
\n
balancegyroDegrees:5.23 accelDegrees:0.49 overallAngleofTilt:2.92 accsum: 343.43
3,9
\n
balancegyroDegrees:6.53 accelDegrees:2.26 overallAngleofTilt:4.35 accsum: 341.38
3,9
\n
balancegyroDegrees:6.76 accelDegrees:3.61 overallAngleofTilt:5.84 accsum: 339.81
4,9
\n
balancegyroDegrees:5.00 accelDegrees:6.57 overallAngleofTilt:7.06 accsum: 336.38
3,9
\n
balancegyroDegrees:0.46 accelDegrees:7.92 overallAngleofTilt:7.73 accsum: 334.81
3,10
\n
balancegyroDegrees:-4.61 accelDegrees:6.90 overallAngleofTilt:6.93 accsum: 336.00
3,9
\n
balancegyroDegrees:-6.76 accelDegrees:5.71 overallAngleofTilt:5.48 accsum: 337.38
3,9
\n
balancegyroDegrees:-2.38 accelDegrees:3.82 overallAngleofTilt:4.58 accsum: 339.57
3,9
\n
balancegyroDegrees:-4.92 accelDegrees:3.49 overallAngleofTilt:3.65 accsum: 339.95
3,9
\n
balancegyroDegrees:-6.69 accelDegrees:2.26 overallAngleofTilt:2.18 accsum: 341.38
3,9
\n
balancegyroDegrees:-9.15 accelDegrees:0.00 overallAngleofTilt:0.12 accsum: 344.00
4,8
\n
balancegyroDegrees:-6.99 accelDegrees:-2.83 overallAngleofTilt:-1.81 accsum: 347.29
4,9
\n
balancegyroDegrees:-9.45 accelDegrees:-4.27 overallAngleofTilt:-4.10 accsum: 348.95
4,8
\n
balancegyroDegrees:-6.92 accelDegrees:-6.44 overallAngleofTilt:-5.95 accsum: 351.48
3,10
\n
balancegyroDegrees:-9.61 accelDegrees:-8.99 overallAngleofTilt:-8.32 accsum: 354.43
3,9
\n
balancegyroDegrees:-2.92 accelDegrees:-10.59 overallAngleofTilt:-9.39 accsum: 356.29
3,10
\n
balancegyroDegrees:-4.07 accelDegrees:-11.45 overallAngleofTilt:-10.43 accsum: 357.29
3,9
\n
balancegyroDegrees:2.38 accelDegrees:-11.70 overallAngleofTilt:-10.15 accsum: 357.57
3,10
\n
balancegyroDegrees:6.07 accelDegrees:-10.67 overallAngleofTilt:-8.86 accsum: 356.38
3,9
\n
balancegyroDegrees:8.22 accelDegrees:-7.88 overallAngleofTilt:-6.95 accsum: 353.14
3,10
\n
balancegyroDegrees:9.30 accelDegrees:-6.53 overallAngleofTilt:-4.70 accsum: 351.57
3,9
\n
balancegyroDegrees:8.53 accelDegrees:-3.74 overallAngleofTilt:-2.60 accsum: 348.33
3,10
\n
balancegyroDegrees:9.38 accelDegrees:-1.11 overallAngleofTilt:-0.46 accsum: 345.29
3,9
\n
balancegyroDegrees:5.61 accelDegrees:3.16 overallAngleofTilt:1.42 accsum: 340.33