DIY Segway

The main reason that I wanted to build a DIY Segway was simply because I wanted to see if it was possible. I also liked the idea of building something that strongly interacts with humans. I will now describe how I built it.

Hardware

The motors, wheels, chain, gears and batteries came from electric scooters like the one to the right. You need hardware from two since the electric scooters only have one motor and gear setup. The motors are some cheap china unbranded ones. They are rated as 300W 24Volt, 2750 rpm

The gearing is made in one step from the small gear on the motor to the bigger gear head on the wheel. The ratio is approx 6:1, a higher ratio would be preferred to get a better torque and a lower top speed. Now the motors have to work pretty hard and currents above 30A(in total from both motors) have been registered since the fuse burned.

The fasting of the gear on the 12” wheel was based on a freewheel mechanism therefore I had to open up the freewheel and remove all the grease and then use epoxy to make it possible to drive it in both directions. In the picture below you can see the freewheel after it has been filled with epoxy as well as a tool made to be able to open it up.

There is one fixed axle on which both wheels rotate, this axle is attached with three aluminum blocks which fixates the axle with 5mm set screws.

Steering, to be able to turn left and right by just tilting the handlebar a rigid joint was needed, the design was made in SolidWorks and then produced in a CNC mill. The transfer from the CAD drawing to the machine instructions (g-code) was made with CAMBAM. The same method was used to produce the box for the electronics and the assembly for the emergency brake.

The handlebar is a normal bicycle handlebar, the pipe on which it is connected is a 25mm hollow steel pipe. To keep the pipe centered and to give some force feedback two springs are attached with steel wires. On the handlebar there is also an emergency button which is connected to a standard car relay which directly cuts the power to the motors. Two 12V 12Ah lead batteries are used in series since the motors run at 24V

Electronics

All PCBs are custom made, the main board (top left in image above) takes care of the computation, gathers data from sensor such as gyro(ADXRS614), accelerometer(ADXL203) and a trim potentiometer which is modified and positioned in the steering joint to detect in which direction you want to turn. The main processor is an AVR AtMega168. The communication to my laptop is made over Bluetooth using a RN-41 from Roving Networks (the same is used in Sparkfuns BlueSMiRF Gold).
The two H-bridges (right-hand side in the image) which convert the control signals from the main board to the power to the motors are designed by friend named Benjamin Vedder. Each H-bridge also have an AtMega168, the communication between the boards is done via UART, originally I2C was used but due to the high currents produced by the motors too much noise was generated and was influencing the I2C communication. All the electronics run on a separate battery (a LiPo 7.4v 900mAh).

To have easy access for charging the batteries, programming the main board and changing parameters to the control loop a small box with several connectors, a switch to turn on and off the power to the electronics and trim potentiometer is positioned on the top side.

Software

The software in the microcontroller mainly consists of a filter for the gyro and accelerometer and a PD control loop. The idea from the beginning was to have the DIY Segway as a platform for testing different types of control methods. However since the power of the motors and the mass of the system was quite big it turned out that it is not such a great test platform (at least if you don’t like getting lots of bruises and destroying the interior of the place you are testing it at).

A better option would be to have a smaller balancing setup which fits on a table and with a mass of less than 1kg for this purpose.
Regarding the filtering of the gyro and accelerometer I tested both a Kalman filter and a Complemenatry filter. It turned out that the performance was very similar of the two filters but the Complementary filter required less computation and is therefore currently used.
On the computer I made an application written in Java where I can see all the sensor values and control signals, battery status etc. It’s a great way of debugging the system.

Cost

I didn’t keep a strict log over my purchases so this is mainly an estimate, however I have tried to overestimated all costs to not give a too optimistic result. The biggest cost was the motors wheels and batteries. I managed to reduce this cost pretty well by buying a second hand scooter which was malfunctioning due to an electrical error, the parts I scavenged from it makes up one setup of wheel motor and gears. Since I needed parts from two scooters I also bought a separate setup as spare parts so these were completely new. Regarding the electronics I bought several items via eBay which can give great prices.

You are a very capable person Peter, respect!
Could you please send me all technical information that is needed to DIY your project. Really Awaysome Idea to propably be abke to do what you did! I would keep you updated. Greeetings from my wife Stella, she is origin swedish from Stockholm.

i study mechanical engineering. my teacher want me make presentation about how segways work, which equations use for its balance, SW-Source, circuit diagrams etc. i should present that simply. i thought you know something about that. could you help me little please?

Hello , Peter , Your segway project is excellent . I would like to make my own segway. Please , can you send me the schematics and code for this project.
Thanks in advance.Best wishes and all the best in NEW YEAR
Sincerely …Igor

Hello , Peter , I am delighted with your segway project. I would like to make my own segway. Please send me the schematics and code for this project.
Thanks in advance.Best wishes and all the best in NEW YEAR
Sincerely …Igor

Dear Peter
I would like to construct your DIY project. I would like to learn how to build it. I am new to these projects.
Would you please be so kind to send me your description and files.
Many thanks
Patrick

Could I please have the Source, circuit diagrams and details for your DIY Segway Project. I have a small workshop and in the process of planning a engineering weekend with my 13 year daughter and friends over the xmas break and thought building one of these would teach the kids lots of skills whilst having fun.
Thanks in advance
Kind Regards Shane

Dear Peter.
Great job! My name is Dang The and I from Viet Nam. Can you share electronics and code? Without electronics and code, I can’t do my segway
Please Share your Electronics and Code.
Thanks so muck!

Hi Petter,
I am an engineering student in Poland. With my team we decided to do a segway as a project. Could you send me the schematics and the code for this project? It would be a great reference.
Thank you in advance.
Mikołaj

Super project. I would like to make one.
I am a retiring engineer and would like to build one for my grandson!
Could you please send me the schematics and code for this project.
Tank you for taking the time to share this fantastic project with us.
With kindest regards,
Sean

it’s really amazing project, I would really like to do same kind of Segway project,
if possible, please can you send me the detailed schematics and code at my email address ? do you need many tools to perform final integration?

Nice to meet you.
I am a teacher of Japanese industrial high school.
I want you to let used in the Industrial training.
Would you please send me the SW-Source, circuit diagrams and details for your DIY Segway Project.
Thank you very much.

You made some good work and I am very interested in your projekt and I also want to try building such a machine on my own. Would you please send me the SW-Source, circuit diagrams and details for your DIY Segway Project.
My e-mail is:

You made some good work and I am very interested in your projekt and I also want to try building such a machine on my own. Would you please send me the SW-Source, circuit diagrams and details for your DIY Segway Project.
My e-mail is: huayofe@hotmail.com
Thank you very much!

You made some good work and I am very interested in your projekt and I also want to try building such a machine on my own. Would you please send me the SW-Source, circuit diagrams and details for your DIY Segway Project.
My e-mail is: schorli0815@gmx.at
Thank you very much!
Georg

Hi Peter, excellent work! Im very interested in your project I also would like to build my own segway, could you provide the diagram or something? Im beginner in all this of electronics devices. Greetings and good work again!

I’m realy interested in your project. I also would like to do my own. Could you send me please the SW-Source, circuit diagrams and details for your DIY Segway Project.
My email is havran.istvan@chello.hu
Thanks in advanced,
Steve

Hello Petter,
thank you very much for this amazing project.
Can you send me please the SW-Source, circuit diagrams and details for your DIY Segway Project.
My email is risimon@web.de
Thanks in advanced,
Richard

For us to proceed with your investment request, kindly send us your business plan or project summary about your investment.

Are you having financial distress or you want to fulfil that dream of yours with funds? Do you need a loan to pay off your bills, Start or expand your business?

Are you having difficulties in obtaining a loan from hard Lenders or Banks because of their high loan fees/requirements? Do you need a loan for any legitimate reason?

Then worry no more as the ” ARGYLE FOX FINANCE LIMITED ” has come to offer loans to interested applicants both locally and overseas no matter the sex or location but age must be 18 years and above. Getting back to us for a negotiation on the amount you need would be wise decision.

Hello Friends
Iam just preparing my Segway contoller programming Projekt
for my University in Germany ,
Please i am looking for Projekt Explikation Code
Any One can help???
Thank you very much
Aliinconservi@hotmail.com

Glad to see that you resonated your intellect mesmerizingly well with the development of this flamboyant creation. Kudos to your work. I want a help from your good side, inspired your creation I started working on the same but I am facing problem how to interface the potentiometers to the microcontroller. Can you help me with the same. Moreover I require the schematics and the gyro analyzing software to meet the same perfection as reflected in your segway. Your work is magnetizing a huge number of students in my university. So help us in doing the same.
My email Id is ( pavleen.bali@gmail.com ).

Hi Peter
My name is Silviu ,
I’m runing a project similar to your and because of the high price of comercial h-bridges, could you help me with schematics and all the parts for H-bridges if possible,
silviu83 @ gmail.com
Thanks

I’m from Brazil and I am also building my segway using zzaag information.
Already mounted the mechanical and electronic, however I am with many doubts in programming and atmega32 configuration.
Now seeing your segway project who knows not change my mind, because I can take a lot has mounted.
It is possible to use the Arduino UNO in this adaptation?

hello, i am also trying to make the segway project but i dont no how to coding for that and also not understand how to install that coding in it so please please give me your suggestion for that my e-mail id is mukeshtidke777@gmail.com

We are a group of electrical engineering student from Hong Kong engage at a final year project around “Segway”. Would you be kind enough to provide us more detail about your great project especially the motor controller schemetic diagram. My e’mail is lcming142@yahoo.com.hk. W/ 1000 thanks!

I’m realy interested in your project. I also would like to do my own. Could you send me please the SW-Source, circuit diagrams and details for your DIY Segway Project.
My email is havran.istvan@chello.hu
Thanks in advanced,
Steve from Hungary

Hi,
I am doing master in electrical in Concordia university in canada. Our team is making segway with all functions.
Can you provide more details about your segway. That will helpful for us
Do the needful
Thanks in advance

I’m trying to build one for my daughter and your design and segway performance are really impressing. Question I have is more mechanical type: would you be able to share details on wheel/axial connections? why did you choose single axial for both wheels? thanks a lot and look forward.

Hi Petter!
I’m a technical student from austria and I am graduating this year.
As a diploma thesis we are going to build a segway.
Do you have some information or tipps for me?
I would be really thankful about an answer.

Hi Peter, sorry my english, I know that you against patent rights in violation if you sell a Segway, but as a kit where only the wheels must be mounted, it would be possible. If you sell it to me as a construction set, I would also be willing to pay significantly more.

Hello Peter.
Great job! My name is Anatoliy and I from Ukraine. Can you share electronics and code? Without electronics and code, I can’t do my segway
Please Share your Electronics and Code.toliy1@yandex.ru
Thank you

Hi Peter. I am also interrested to buy all the spares if possible and assembling the unit myself. I was scammed by a Chinese company HK-Products and lost over a $1000 also in effort to build a Segway. Thanks Peter.

Hello Peter !
I am also interested in building Segway , but I got some troubles with code. Is there any possibility to get a code from you ?
I would be so grateful .
Thanks ! Janko (jankokobal3@gmail.com)

If you could integrate two pressure plates on or in the “floor” you could maybe us e theese to calculate the drivers weight distribution. En then use theese values to turn. Then you could maybe remove the steering bar altogehter. Just two wheels and a flatt surface to stand on, would look quite cool!

Hi Peter,
your diy segway is SUPER, Im fond of Segway and planning to make a segway, can you help me by giving diagrams and codes you have, that would help me a lot,, thanks a lot man.
best regards,
Taras

Hello Peter, can you share electronics and code?
Without electronics and code, we can’t finish own scooter
All the work without the electronic control it’s nothing
Please Share your Electronics and Codersmastech@gmail.com

Hi Peter,
A job well done! i like your simple and clean set-up, i hope you have a diagram for an easy and quick-to-follow wiring installation….. and the codes for arduino…
Hope you make a single wheel too….. if you have a diagram set-up pls email me… vinnfernandez@yahoo.com… thanks!

Hi Peter,
your diy segway is SUPER, Im fond of Segway and planning to make a segway, can you help me by giving diagrams and codes you have, that would help me a lot,, thanks a lot man.
best regards,
Taras

Hi, I love your seg way !
I am not so able than you to built it… but I pro mess to my soon to have one.
Is it possible to by one in kit?
It will be too funny
my mail : jjrobin@me.com
tell want price for a kit

Hello Petter,
I really liked your project, I’m doing a similar project for the course of Mechatronics.
Could you help me by sending some tips to my email? rodolfo_rayol@hotmail.com
I live in São Paulo, Brazil.

I came Form germany and i am trying to rebuild your human transporter …. I habe bought an arduino Bord the gyros and accel.. But i am not gold at programming … Is it possible that you send me your code so that i can look at it while i Programm it ??? That would be very nice if you could send it.

Hey datz an awesome creation . . i m planning to make a segway as my final yr mechanical engineering project since it involves all aspects mechanics , electronics and coding . . can u please helpme with the components and the coding language . . it wud of gr8 help . .

GOOD JOB Peter,, your diy segway is really amazing,, Im an Electronics Engineering looking for my final year thesis.. I’m planning to make a segway,, can you help me by giving diagrams and codes you have,, that would help me a lot,, thanks a lot man.. ur amazing,,
best regards,,

Hi Petter,
you have done a great job man,i m from kuwait, i like it very much. that makes me to start to make one too. but i have got no any idea how to find the balancing device ( H-bridges) mother board and soft wear, could you please guide me how to get them?

Hi Petter,
you have done a great job man, i like it very much. that makes me to start to make one too. but i have got no any idea how to find the balancing device ( H-bridges) mother board and soft wear, could you please guide me how to get them? or are you able to supply them to me? if you can supply, could you please tell me the cost.

Hi Peter I plan on building my own segway for my senior year college physics project. I know you wrote the application in java but what were the robotics programed in? I’m thinking C++ would be best and would like to know if that’s what you used? I’m currently planning on teaching myself C++ for this project. If you did program in Java or C could you please send my a sample of your code? I figure the programming and debugging will be the hardest part of the project. Thank you for your time and great work on the segway!

i am a masters student and even i am working on diy segway….the mechanical designing is done. And i have already designed the motor drivers too. Right now i am working on the balancing part.

i am using atmega32 microcontroller. I wont be using gyro and accelerometer , but i will be using some other tilt sensors to control the speed as well as providing balance to the bike. Do you think its a good idea?? And can you plz send me some logic or atleast dummy codes for the processing of the inputs from these sensors.

Nice Vehicle but this whole Page is of no use for others who does’nt have enough knowlege to build this on their own since you are not willing to give details. On the other hand those with enough knowlege how to build it can do this on their own, but those don’t need this page also.
So its of no use for nobody except for your self-praise which makes People getting mad at you.

Hi Petter, i was wondering if you could send me the code for your Segway. I was also wondering if you could be so kind to enlighten me on what kind of potentiometer you are using to determine right or left when turning? Much appreciated.

Peter
I have just discovered your self-made Segway Mobile Scooter. I am not only impressed, but very jealous. While my capabilities are not up to the ingenuity you possess, I am of the mindset ‘why cannot I do the very same thing’? In truth I cannot, however I do admire your skil.
I am disabled and have limited mobility and have long asked why I am not able to use a device such as you have designed. To be able to use this in a home setting is my thought here, as opposed to a Rollater. A ‘rolling walker’.The traditional large scale marketed Segway has been shown to be first of all priced above what the average low income individual can reasonably afford, and second is not, what I have seen as easily manuevable as your prototype. My thought here is – your device is perfect for the mobility limited individual like myself. I do believe you have a definite market. I know I would love to be able to secure (purchase) one. Possible? I definately would love to be able to use a device such as your magnificent ‘Segway’…
Than you for listening…
Sincerely
David Norris
Sacramento, Californianorris299@sbcglobal.net

Hello David.
Thank you for your kind words. Regarding your idea,
it is very interesting but there are some disadvantages that you need to consider for example when not moving around the Segway is still using power just to balance itself. Therefore it is not very energy efficient compared to a three or four wheeled alternative. Another thing to consider is thresholds and similar obstacles, the Segway is not so good at climbing thresholds. You kind of need to gain some speed to “bump” over it which might be a bit hazardous in indoor environments.
Best Regards

Nice job I think your segway is perfect for my friend that is handycaped and I am going to try and make one that the handle bars will be replaced with a bluetooth head gear he can only use his body from the neck up
Do you think the head gear would work like the handelbars do
would love to here your thoughts on the modifications thanks for your time and giving me the idea for my friend and maybe the Disabled
Kevin

Hi Petter,
Wondering if you would be willing to supply your code as a reference for others? I have a completed segway running on an Arduino using the kalman filter, though it’s not perfect. Thinking of switching over to a less complicated complementary filter. Which do you use?
Your DIY segway is the best I’ve seen by far.

Hello Peter !
I am also interested in building Segway , but I got some troubles with electronics . Is there any possibility to get a electronic PDF projector from you ?
I would be so grateful .
Thanks ! Kate ( kejt3@buziaczek.pl)

Petter, i want to ask you about your project.
I’m very interest with your DIY segway.
And now I want to make DIY segway.
I want to ask about the gyro and accelero. Should we use gyro and accelero ?Or we can use one( accelero or gyro) ?
And how to program the accelero or gyro so that the DIY segway can control the velocity of the motor ?
Thank you Petter..

found your website searching the web. I bought two electric scooter from an estate sale–neither worked for lack of parts or missing stuff. I tried to build a working scooter using the two but gave up when I fried the controller board.

I can work with metals, some electronics but not programming. Us types who lack programming skills or PCboard building really need a source for completed boards or a good kit. and of course the program. are you or anyone else working to provide such?

Hi Petters,
Your product is extremely interesting.
Can you have a look at our P-personal project – http://www.p-buggies.com/p_perso.htm – and let me know your comment ?
We are trying to go a little further than the existing Segway…
Cheers,
Franck

Just wondering if you would be so kind as to post your code for us unworthy mortals:)
I have tried the code that is supplied further up in the comments pages but it does not debug. I think it was done with an earlier version of the Arduino code.
You have gone to so much trouble to make a beautiful machine and website, all that is missing is unfortunately YOUR code.
Thanks very much.
Mart

I’m working on it, my plan is to produce new code that runs on Arduino hardware. I will make it available on Github. But still a few months before I can post it, have to many other projects consuming my time. Regards

Hello. Good project. I also Would like to collect on the Atmega, a stepper motor as the driving force. It will be a miniature model. Can you lay out chip cards. And a program for Atmega. I would really be grateful. Yet in Russia to not sell such devices.

Hi.is it possible for you to send me the h-bridge circuit.I´m bildding a custom made segway but i´m having problems with mosfet driving circuit.The motor that i have are 24v 250w from electric scooter like yours.I´ve also tried diferent PWM .What the frequency that you have used.

Hi Petter,
you have done a great job man, i like it very much. that makes me to start to make one too. but i have got no any idea how to find the balancing device ( H-bridges) mother board and soft wear, could you please guide me how to get them? or are you able to supply them to me? if you can supply, could you please tell me the cost.

Hi all! I´ve also started building one. Regarding motors and stuff: I bought mine at http://www.sunds-sportartikel.de/ Cheaper than the swedish firms I´ve found, and very good delivery (20 euro regardless of weight, I bought batteries as well, and about 4 days).

My problem now is the H-bridges, does anyone have an idea of instructions for building these? I will use an Arduino Mega card and 36V/500W/18A motors.

I bought the motors and wheels from a Swedish online shop selling scooters like the one I mention in the beginning of this article. Ebay is a good place to find cheap electric motors. This type of motor can be found in different electric vehicles.

Petter,
Excellent work! Very good information on the design also.
I am planning to make one just to try. Do you think I can use Arduino UNO or Arduino MEGA as controller instead of creating board with AtMega168?
I am not good Hardware or software engineer, just trying it out as hobby.
Thanks for sharing.
-N

Hi Petter,
Congratulation for the great work! Really amazing.
I’m tryng to do similar project using Arduino and relevant motor shield.
I did the 80% of the job, now I’m fighting with the tuning of parameters and I’m going crazy.
If you want I could share with you the arduino code.
Regards,
Manuel