Instructables

Easy build self balancing electric skateboard

Featured
Picture of Easy build self balancing electric skateboard
Titlepic2.jpg

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 (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:
http://www.instructables.com/id/Self-balancing-skateboardsegwy-project-Arduino-S/

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:
http://www.instructables.com/id/Arduino-Self-Balance-Controller-using-DIGITAL-IMU-/

Shameless part:

JUNE 2014: I am entering the Hackaday Competition with Nick Thatcher and another friend.
The entry is the Medicycle, yes it will have one wheel and yes it will be really cool. Best project yet hopefully. If you want to follow us, and we would very much like you to, here is the link:

http://hackaday.io/project/1156-Medicycle---Urban-...

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.
http://www.s-walker.com/index.php/de/products/board


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:
http://www.youtube.com/watch?v=_PEGi3k6yNQ
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 (!)

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. 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.

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! 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:
http://sites.google.com/site/onewheeledselfbalancing/
Links to dozens of other self-balancing projects from around the world here (needs an update soon):
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?
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.


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 adsRemove these ads by Signing Up
1-40 of 588Next »
Tjoydavi6 days ago

Hello,Im in search of someone that has the skills to build an electronic device.

If you can be of service let me know tyffanij5@gmail.com

umerji10002 months ago

is there any way to build this without the hand controller

anthology2 months ago

hello

i have found your code for grove analog gyro and accelerometer with the nunchuck

but actually i cant found it

can you publish this ?

thanks a lot

zetowe5 months ago

i found this IMU http://dx.com/p/gy-85-6dof-9dof-imu-sensor-module-for-arduino-148436#.Uv_JhfldVwx it is a reliable website

XenonJohn (author)  zetowe4 months ago

Hi,

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.

John

zetowe XenonJohn4 months ago

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).

DSC00351.JPGDSC00352.JPGDSC00353.JPGDSC00354.JPGDSC00355.JPGIMG_20140225_231035.jpgIMG_20140225_231119.jpgDSC00356.JPGDSC00357.JPGDSC00358.JPGDSC00359.JPGDSC00360.JPG
XenonJohn (author)  zetowe4 months 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!

John

zetowe XenonJohn4 months ago

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

zetowe

XenonJohn (author)  zetowe4 months ago

Please do. Your metalwork looks really neat and tidy.

John

zetowe XenonJohn2 months ago

Hello XenonJohn,

I have not done an update in a long time (i think about 2 months). I have been working on it but i ran into a lot of problems and i didn't quite get the time to fix them because school is busy lately. No time for excuses tough. I am gonna do an update once it is finished, nothing in between. I will make a video of me riding it and showing the inside lay out etc. I will post it right here. See you then!

Zetowe

zetowe XenonJohn4 months ago

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.

Zetowe

You are a great genius John!

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

regards,

Gerry

eyrecamp zetowe4 months 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)  eyrecamp4 months 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 eyrecamp4 months 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.

zetowe

DSC00361.JPGDSC00362.JPG
eyrecamp zetowe4 months 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 eyrecamp4 months 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.

http://m.eet.com/media/1049853/C0086-Table1a.gif

http://en.wikipedia.org/wiki/Photoresistor

I hope this was helpfull to you.

Zetowe

eyrecamp zetowe5 months ago

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

gerrymazzotta4 months ago

Hello to all,

can anyone tell me if the IMU is oriented correctly?

Thank you, Regards

ORIENTATION IMU.JPG
XenonJohn (author)  gerrymazzotta4 months ago

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

John

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)  gerrymazzotta4 months ago

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

John

XenonJohn (author)  XenonJohn4 months ago

We did sort this out and his machine works now.

John

eyrecamp5 months ago

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

eyrecamp eyrecamp5 months ago

my mail is eyre.c@hotmail.com.au

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)  eyrecamp4 months 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!?

eyrecamp eyrecamp5 months ago

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

http://www.uumotor.com/air-tyre-8-inch-gearless-hub-motor-36v-350w.html

http://www.uumotor.com/6-inch-36v-250w-small-hub-motor-20kmh.html

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 (??)

eyrecamp4 months ago
John,

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.
DR42964 months 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) 5 months 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:

http://www.instructables.com/id/Arduino-Self-Balan...

John

_Champ6 months ago

What electrical output does your skateboard produce?

XenonJohn (author)  _Champ5 months ago

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

nsandland7 months ago
Would a 24V battery charger work OK?
Noaharfarf9 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)  Noaharfarf9 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)  Noaharfarf9 months ago
Hi,

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.

John
pbecker8310 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.
1-40 of 588Next »