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: https://sites.google.com/site/onewheeledselfbalancing/Home/18-2013superskate
UPDATE regarding IMU's and CODE (December 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.
If you use a digital Sparkfun 6dof 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:
Also there is a scooter I have made inspired by the 1970's Raleigh Chopper with updated (December 2014) software using the same easily available digital IMU from Sparkfun: Raleigh Chopper inspired self-balancing scooter.
If you want to build a big unicycle check out this one I built with two friends for the 2014 Hackaday competition, called the MediCycle: http://hackaday.io/project/1156-Medicycle---Urban-...
Can I buy one ready built?
Well, looks as if you now can. The German S-Walker looks strangely familiar!
Also there is the "One-Wheel" single wheeled skateboard which was a recent Kickstarter project: One-Wheel
For a good electric unicycle you can buy check out this very recent Russian one (about US$1000): Russian electric Monocycle
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. 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. Advantage of two wheelers is that they turn more easily and can turn and balance even when stationary - which is fun. I (used to) 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, you might become a world expert, there are no textbooks so you are genuinely pushing into the unknown with each machine you make. Few things as an individual hobbyist allow you to truly do this.
iv) These machines are really good fun to ride!
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.
I have documented all my machines both good and bad on another website here:
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 and more recently the Jackal: Jackal
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: 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
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! http://vimeo.com/2013773
Have fun. Treat it as an adventure. Once you get it to balance there are many ways to improve it.
Step 2: Scooter wheel as it comes
This is great as it fits under board, has axle and bearings all with it, sprocket is ready fitted.
Reduces your work considerably.
Step 3: Closer view of scooter wheel
There is a threaded rod running through entire wheel. There is a tubular sleeve each side, one is short and one is long. The nuts each end clamp tubes to bearing in wheel so everything locks up tight (bearing can still spin though).
Step 4: Dismantle each wheel assembly
Step 6: Frame
Step 7: Axle brackets
Step 8: Trial fitting the axle
Holes have to be drilled to EXACTLY opposite each other.
Step 9: Fitting axle
Tip: Bolt the axle up like this and tighten everything.
Then, and only then, mark the amount of overlap of the L shaped brackets underneath the wheel where they will bolt to the deck.
Clamp them together and drill the holes through both layers that will be used to bolt them to the wooden deck. I just used a pair of locking adjustable pliers. I also left the axle bolted in place while I drilled the holes (from underneath). Make sure the drill does not suddenly go through and drill a hole in the side of the polyurethane wheel! My baseplate holes are located so the drill bit tip missed the wheel when I made these holes!
This way everything then bolts up straight and true with no headaches!
Step 10: Axle mounts
Step 11: Wheels fitted
Note if you want minimum width wheelbase, as for a self balancing skateboard then you can trim the inner ends of the axles as I have done here.
Step 12: Motors
You could try 300 watt ones (that look almost the same). Just make sure they are the same as each other.
Step 13: Alternative layout
However here is an alternative layout which might be OK for a skateboard and which would mean the batteries will fit under the deck while motors go on top - you would have to make a feature of them though. Chains run vertically. Has a certain symmetry. The "Emanual" board used this layout.
Step 14: Motors above deck?
I did not take this design any further.
Step 15: Chain
I bought 2m of it from "Bearing Boys" UK. Also on rght is connecting link for when you shorten it.
If unsure how to shorten a chain, bike shops will do it for you.
Step 16: Chains fitted
Too tight and motors bind.
Too loose and get lots of rattling and judddering when balancing in stationary position as motors go one way then the other very quickly.
Tempting to make the motor bolt holes slotted then slide motors forward and back until tension just right. I avoided this as on a previous project the motor was so powerful it just pulled itself along the slot so chain went loose.
If you can I would measure, measure again, then drill (circular) bolt holes for the motors only after great care taken.
I suggest: Locate motors in exact position to get just a little bit of slack on the chain. Get a pencil and sharpener and sharpen it until it is just a stub about 1 inch long. Carefully poke it through the 4 bolt holes in baseplate of the motor, without moving the motor, and mark on the wooden base where to drill the holes.
This way they should end up in exactly the right place.
M6 bolts go straight into 4 threaded holes on underside of motors.
Step 17: Chain tension
There is a way to take up a small amount of slack like this:
Step 18: Chain tension 2
Surgery forceps very useful in this project - also for holding wires for soldering etc.
Step 19: Electronics
There is a 5 degree of freedom inertial measurement unit (IMU) from Sparkfun.
This is cheapest one they do that will do the job - a situation that is always changing by the way.
It has a 3 axis accelerometer. We will only use one of these.
It has 2 solid state gyroscopes. One is used with the accelerometer (using a "combination" filter) to make the thing balance.
The other is used to allow machine to resist sudden changes in direction (one wheel hitting a pebble for example) so it does not spin you off. This is easier and more reliable possibly than using wheel speed encoders which is the other way to do this.
I like ribbon cable as it is neat. I also use blu-tack when doing this sort of soldering as it holds wire in exactly the right spot as well as holding the little circuit board still.
I tin the wire ends then solder them to the holes.
Step 20: Arduino power supply
NOTE: Some motor power controllers have a low voltage on board output to power a microcontroller, but the sabertooth doesn't have this. Having a 9V battery like this is just the simplest way around the problem.
This has several advantages:
a) Nice and safe - I fried a £100 gyro once connecting it to one of the 12V batteries (the wrong one)
b) You can debug the software without the main motor controller being powered up.
Step 21: Motor controller
This is a Sabertooth 2 x 25Amp (40Amp peak) robot motor controller for medium sized robots with 2 motors.
Each motor has to be able to go forward and reverse, and switch direction frequently and rapidly without mishap.
The ones 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.
NOTE: It will handle most forms of abuse and will shut down rather than burn out and so on. It will NOT tolerate having the power supply leads conncted up back to front however - be warned.
Also it has to be able to handle a lot of power as if falling over, motors have to be big enough to allow machine to accelerate fast to bring itself beneath you once again.
Therefore unless you really know what you are doing, designing your own is out of the question.
The sabertooth can handle many types of misuse but you mustn't connect the batteries to it back to front!
The Arduino can send control data to it in several ways but I have chosen a mode called simplified serial mode. The Sabertooth website has a lot of downloadable information on all this.
It isn't exactly low cost but worth the money.
Step 22: Sabertooth
The configuration you need for simplified serial, 9600 baud rate, and lead acid batteries is shown here. All this is also available for download from their websiite.
Step 23: Battery connections
The main power switch is in the middle and essentially "joins them together."
Again, make sure power leads go into the Sabertooth the correct way around.
Step 24: Hand controller wiring
My "de-luxe" self balancing skateboard has a wireless Wii Nunchuck as the control system.
However here we are interested in reducing cost.
Therefore we have a cable with a hand controller on the end.
This has a dead-man switch (cuts motors if you let go i.e. fall off)
Also has steering left and steering right plus a switch to fine-tune the balance point of the platform.
See links on first page to my newer Instructables desribing how to wire up newer IMU's to an Arduino and the Sabertooth, with code.
Step 25: Hand Controller
I used 2 cable ties to locate the end of the cable so it cannot easily be ripped out of the end of the box. Cheap and simple.
Dead man button is on the end.
Step 27: Handcontroller input wiring to Arduino
Arduino analog inputs all used apart from one for balancing etc.
All handcontroller inputs go in through the digital input pins on other side of the Arduino board.
The cable is fixed to the deck using simple cable ties again so the wires are not stressed where they are soldered to Arduino input pins. The cable itself is screened cable with 6 or more wires inside it.
You can also see the 10K potentiometer used to control the "overall gain" function. This allows simple user adjustment of the machine between feeling "squishy" and "tight" as you ride it.
NOTE: See my links on page 1 to my newer Instructables describing how to wire up newer IMU's to an Arduino and use it to control the skateboard, with code.
These newer versions do not use the potentiometer any more.
Step 28: Testing
I fixed the IMU with blu tack to start with as you always end up with it back to front or the wrong way around!
When you get it working then fix it properly. Protect it from debris from the wheels and keep it near to centre of the deck by the way - it works best there.
NOTE: If you hold the IMU with Blu-tack initially, make sure it is a decent sized blob - if IMU is wobbly the board will bahave erratically and oscillate wildly.
Step 29: Anti-tamper power cutoff key
When I came back there was a small child playing at one end of the table while ??his father was flicking the on/off switch and pressing every button on the hand controller trying to make it "go" - while it was tilted to one side.
Luckily for him the batteries were flat and it wasn't working properly.
If he had been successful, this heavyweight hunk of metal would have thought it was tipping hard over and would have hurled itself at the child with the full 500W motor power. No doubt I would have been blamed.
If you plan to take your creation anywhere public like an exhibition, and leave it for any period of time, I suggest you fit some sort of disabling device like an ignition switch and high current relay (from car spares shop) perhaps, or easiest would be one of these which is a race/rally car emergency battery cut off switch with a key you can remove and carry with you. It will easily handle the high current and adds very little weight.
Step 30: Working
This version has same motors and motor controller as my previous twin wheel self balancing skateboard so should perfom the same.
Wheelbase is 24cm but if you spaced them further apart clearly you could build a Segway style vehicle.
The idea is that you just bolt whatever you want to the top of it, Segway, skateboard deck, R2D2 or whatever takes your fancy! One of those R2D2 trash cans if modified would fit just perfectly on top.
Main parts (all new):
Motors: very variable on ebay but about £35 each
Razor E100 rear wheel sets: £24.99 each from a big online electric scooter shop spares department.
Total £273 including purchase tax which I think is pretty good for any self balancing vehicle. Batteries would take you over my £300 target but not by much. Also compares well with cost of conventional 4 wheeled (one motor on one of back wheels) electric skateboards.
UK pound weak at present and Sparkfun and Razor scooters are US based, which suggests that you could do this at even lower cost in the US.
Might possibly be worth trying to buy a used Razor E100 electric toy scooter as this would give you one rear wheel unit, one motor (but might be too small), some batteries to get started with and a charger, then buy the rest as above.
Step 31: Rebuilt on a skateboard deck
This has allowed me to test ride it.
As a result of this I have tweaked the code slightly to improve (tighten up) the ride and also have used the second gyro to improve the steering:
When you steer the gyro will adjust power to the motors to create a constant rate of turn. Currently this is set slow at 10 degrees per second but you can alter it in the code. Have done this after feedback from viewers.
You could also use a potentiometer to vary the "target" desired rate of turn if you want to take this on another step (see image on front page and also code attached to page 47).
Code examples attached to pages 43-47 as text files. If you cannot download them message me with a working email address and I will email them to you.
Step 32: View of underside of skateboard
Mount the accel/gyro as close to centre of board as possible. NOTE: I have since moved it to the top of the board, see later pages.
Also if using blu-tack as I did originally for temporary adjustments, make sure it is a big blob and holds it firmly. If it wobbles about the board will oscillate and you cannot work out why!
The board was largest skateboard deck I could get.
Also, it bends down each end very slightly when you stand on it. This makes the chains go slack!
Therefore need to brace it with wood/metal strut down centre or along sides on top of deck. It only has to run out as far as each motor from centre line. This is important, it does matter, binding tight chains mean motor contrioller keeps cutting out, slack chains mean too much oscillation, they have to be just right.
One solution is to use a square of half inch marine ply as mounting for wheels and motors, then just bolt a skateboard on top of this!
With a little welding the motors can be mounted sideways and brought nearer the wheels. This gives room to put batteries underneath (just) and circuit boards on the top in a small housing (see photo on first page).
Step 33: Re-arrangement of components
Use a thick board to mount the motors and wheels to that will not flex.
On top of this bolt a large size regular skateboard deck.
Mount batteries to underside of the skateboard deck, just outboard of the motors, which themselves should be as close to the wheel sprockets as you can get them.
If distance between top of wheels and skateboard deck is 3-4cm you will find the batteries can be fitted underneath. With suitably large (but not too large) wooden bump stops under each end of the deck you can arrange things such that the bump stops hit the ground before the batteries do - which would not be good for them.
Electronics now placed on top of skate deck in small housing. This as also makes them more easy to access.
Step 34: Mounting IMU correctly
One example of how you might mount an IMU and an Arduino on a board.
Step 36: Videos
The one that started it all:
Step 37: Additional Improvements (1)
There are many ways to potentially improve this project, here are just a few
Powering the Arduino
Using a 9V battery to power the Arduino is quick and simple. However it won't actually last that long and when it runs out you may fall off!
A better option therefore is to use a commonly available voltage regulator to convert the 24V from main batteries to a little over the 7V the Arduino needs and run it that way.
The problem is that to go from a big voltage to a much lower one means the voltage regulator generates a lot of heat and may need a heat sink. My batteries are already a little on the small side so I looked for a more efficient way to do this.
A solution does exist; it is called a Tracopower TSR 1-2490. This particular one puts out 9V which is fine for the Arduino. The way it works is very clever but it is very efficient and generates almost no heat.
Similar devices exist to power radio receivers in R/C aircraft from the main batteries, but the one I have used is small and reasonably priced.
Step 38: Pneumatic tyres
You could build this project with a welded frame and pneumatic tyres if you are feeling more ambitious.
Frame is much harder to make however.
These wheels/tyres are Razor E200 rear wheels with drum brake mechanism removed and axles shortened.
Step 39: Rewiring a Nunchuck as a hand controller (1)
Take Nunchuck apart. Get a proper Nintendo one if you can as potentiometer has higher resistance than cheaper Chinese copies.
You need a 3 lobed screwdriver which you will have to get from ebay.
Also when the 2 screws are out, you still need to v carefully "pop" it open as there are still some clips holding 2 halves together.
Then, cut back half of circuitboard off completely.
Step 40: Wii Nunchuck rewiring as a hand controller (2)
Potentiometers have to have +5V supplied to one end of the carbon track and the other end run back to GND on Arduino.
The "wiper" middle pin of the 3 on each potentiometer, reads variable voltage as joystick is moved and wire from each of these 2 central "wipers" is sent back to the spare 2 analog input pins 1 and 5 on the Arduino board.
The sketch that works with this is attached to page 47 of this Instructable.
NOTE: The ends of the internal tracks of each potentiometer are joined via the circuit board they are soldered to, so you only have to connect a +5V wire from Arduino and a GND wire to ONE of the two potentiometers and then run 2 more wires (one from wiper of each potentiometer) back to the analog input pins on the arduino.
Last of all, You need to supply +5V to one side of the contact pad of one of the end buttons, and run a wire back to Digital Pin 9 on the rduino to make one of the end buttons into the deadman switch (see diagram).
This is all very fiddly, if you are not experienced I would suggest sticking with the simpler box of switches hand control method.
Step 41: Code for use with new 6dof DIGITAL IMU from Sparkfun
I have looked at the Sparkfun 6dof Digital IMU and tried to incorporate code to read the digital output from this into my existing self balance code. Did not want to do it, but this is coming so someone has to have to have a go else nobody will build any more hobby self-balancing machines.
I have used code from the web, full wiring instructions and orientation instructions are given in the attached arduino sketch.
Code to read the IMU came from here:
I have built it into my existing code for a self balancing 2 wheeler that uses rocker switches or buttons for steering and adjustment of balance point.
It is set up at present so you can test it with the IMU attached to an Arduino watching the outputs on an attached computer.
If you want to run it in a real machine then there is a section of code to comment out which then enables all the buttons including the deadman switch.
At present I am using pulldown resistors to GND on the button input pins as in my original instructable here.
NOTE: Unfinished. Not sure if even works but is here as a start for others to work with.