This Instructable will show you how to build a ride-able Segway clone. Here are its features:
I would say that a motivated middle schooler (12+ year old) with a parental figure could tackle this project. If the motivation isn't in the technical learning and assembly, it will be in the riding fun!
----------------------------------------------------------------------------------------------------------------------------
UPDATE 12/24/2014: There is a separate Instructable here to strengthen the Segway Clone PVC to Wood junction.
- Easy to build with no welding, no complicated steering linkage and minimal soldering.
- Uses a readily available $3 digital MPU6050 accelerometer/gyro IMU board.
- Total parts cost is under $400 (including shipping). A real Segway is $5000!
- No salvage, dumpster diving or Craigslist parts.
- A detailed parts list and ALL purchasable sources are included.
- Well documented with over 50 minutes of HD how-to video, pictures and a detailed plan.
- Uses the very common Arduino UNO processor board.
- All Arduino processor code is included. NO additional Arduino libraries need to be installed.
- wood working
- metal working
- plumbing techniques
- wiring from schematics
- micro controller (Arduino) C like coding
- accelerometer/gyro basics
I would say that a motivated middle schooler (12+ year old) with a parental figure could tackle this project. If the motivation isn't in the technical learning and assembly, it will be in the riding fun!
----------------------------------------------------------------------------------------------------------------------------
UPDATE 12/24/2014: There is a separate Instructable here to strengthen the Segway Clone PVC to Wood junction.
Remove these ads by
Signing Up
Step 2: How to Ride the Segway Clone
- With the Segway clone leaning forward, it's front edge touching the ground, toggle the power switch on.
- The LED will glow red. Wait about 8 seconds for the MPU6050 Accelerometer/gyro to calibrate.
- Lift up the board so it is parallel to the ground.
- Hold in the deadman switch. The LED will turn green.
- Step on the board.
- Lean forward to go forward and lean back to go backward.
- While you are moving, you can press the steering rocker switch to go left or right.
- You can press the tilt rocker switch to adjust the neutral balancing position of the board.
Step 3: How to Build the Segway Clone Video
This video is over 50 minutes long and includes detailed instructions on how to build this Segway clone:
1-40 of 589 | Next » |
3 days agoReply
Hi Ihart!
I am nearly finished building my segway clone and owe a massive thanks to you for a fantastic instructable. I haven't added handlebars yet as I'm working on a tilt steer system built in to a nice stainless steel cover. However in testing the system I'm getting a slight vibration randomly if there is no weight on the motors this can become quite severe. My signal wires are all single wires but are all less than 1inch long. I'm using slightly larger, geared, motors with a sabretooth 2x32.
I'll attach a video and you see it shake rite at the beginning then smooth out.
Could my gain be too high?
https://www.youtube.com/watch?v=zpauHnX9E_E
I am nearly finished building my segway clone and owe a massive thanks to you for a fantastic instructable. I haven't added handlebars yet as I'm working on a tilt steer system built in to a nice stainless steel cover. However in testing the system I'm getting a slight vibration randomly if there is no weight on the motors this can become quite severe. My signal wires are all single wires but are all less than 1inch long. I'm using slightly larger, geared, motors with a sabretooth 2x32.
I'll attach a video and you see it shake rite at the beginning then smooth out.
Could my gain be too high?
https://www.youtube.com/watch?v=zpauHnX9E_E
2 days agoReply
Hi Chris,
It looks surreal to see you riding the platform without handlebars... Nice build.
re: the start-up shake, did you let the MPU6050 calibrate by waiting for 8-10 seconds at the start? The accel numbers the MPU6050 puts out are really bad for those first few seconds after power up.
Other than that, if the problem were low batteries or noise, you would see the shaking effect after start-up as well.
Please post another video when you have a final build!
It looks surreal to see you riding the platform without handlebars... Nice build.
re: the start-up shake, did you let the MPU6050 calibrate by waiting for 8-10 seconds at the start? The accel numbers the MPU6050 puts out are really bad for those first few seconds after power up.
Other than that, if the problem were low batteries or noise, you would see the shaking effect after start-up as well.
Please post another video when you have a final build!
2 days agoReply
Hi thanks for getting back to me so quickly. Although it shows in the video that it vibrates early on then stops in actual fact it seems to happen quite randomly. My two batteries are brand new and putting out around 25.8v so I'm guessing they're fine. So maybe it is a noise problem. I'll try doubling the signal wires and see if that helps. Also I'd like to ask about making it more responsive as I have a bit of a dead spot. I noticed you mentioned slowly increasing the gain. Is that all the gain values or just the angle gain?
Its been a blast building and testing. Thanks so much for the help.
Its been a blast building and testing. Thanks so much for the help.
yesterdayReply
re: the vibration, it could be wire or ground issues. The I2C and the saber serial wire need to be as short as possible. The grounds should be tied to one common point and not be daisy chained.
re: the gains, I'm not sure which to modify. You have to play with it like I did. There are 3 gains in the code. The bottom one ANGLE_GAIN makes it immediately tighter and more sensitive to angle change. The others are part of the control loop:
#define ACCEL_GAIN 18.0 //
#define GYRO_GAIN 5.0 //
const float ANGLE_GAIN = 1.20;
re: the gains, I'm not sure which to modify. You have to play with it like I did. There are 3 gains in the code. The bottom one ANGLE_GAIN makes it immediately tighter and more sensitive to angle change. The others are part of the control loop:
#define ACCEL_GAIN 18.0 //
#define GYRO_GAIN 5.0 //
const float ANGLE_GAIN = 1.20;
3 hours agoReply
Brilliant. Thanks for the advice. I really appreciate it. I'll post a vid as soon as its done.
yesterdayReply
Hi received my motors today and tried to test it. Unfortunately the motors are running in opposite directions, tilting the mpu 6050 forward or backwards does not change the speed or direction of the motor, using a toggle switch for the steering control that's not helping either. Help me please.. The batteries are brand new and charged. Tried using smaller motors (under the Samsung box) and it's the same result.. ?
yesterdayReply
Hi Syed,
Thanks for sending the pictures. Your wires are way too long. It will never work like that. Please read the Instructable and the debug instruction section. If the motors are running in 2 different directions, swap the motor wires at the Saber controller to make it work properly.
Thanks for sending the pictures. Your wires are way too long. It will never work like that. Please read the Instructable and the debug instruction section. If the motors are running in 2 different directions, swap the motor wires at the Saber controller to make it work properly.
16 hours agoReply
Hello dear sir thank you once again for your feedback. I have swapped the wires of the motor to the sabertooth controller and the motors are rotating in the same direction now. I will shorten the wires and try in the weekend. Should I use single strand wires or multi strand? Also if you can recommend the required AWG of the wires it'll be helpful. I used the pin headers wires which came along with the prototyping board.
11 hours agoReply
That's great that your motors are going in the same direction. In answer to your wire gauge question, it doesn't matter for small level signals like this. Make sure the wires are short and twisted together with a ground where possible. The important wires to keep short are the I2C wires and the serial wire going to the Saber S1.
7 days agoReply
One other thing, for anyone using geared wheelchair motors make sure you take off the "brake" on the front of the motor. It took me awhile to figure out why my sabertooth was over current so much and it was as simple as taking the mechanical brake off.
15 hours agoReply
Can you tell me a little more about the mechanical break ? Probably with the pics would be helpful as i have the same geared wheelchair motors. Thanks
4 days agoReply
Thanks alot for this tip. My geared wheelchair motors are being delivered tomorrow and I think I should be doing the same thing.. Nevertheless thanks again :)
2 days agoReply
Hi Ihart
I really like this project - well done!
I am just curious, how fast can it go? :-)
- Jacob
I really like this project - well done!
I am just curious, how fast can it go? :-)
- Jacob
7 days agoReply
ihart,
Thank you for the great project and for answering questions so long after you finished. I have just recently finished my segway and I am pleased with how easy you have made it for anyone to build. I deviated mechanically and went with wheelchair motors and atv tires, but I used your code and I am happy with it. One thing that I am changing in my design is the steering. I am going to use "tilt" type steering with a 10k potentiometer. Do you think your code could be revised to except variable steering from a 10k potentiometer? Also I have read through the code and I am wondering if there is a number I could play with to have the lean angle vs speed a little more sensitive so you would not have to lean as much? One more thing, When my deadman switch is let go my motors stop abruptly, I'm guessing this is because they are geared wheelchair motors, what do you think? Again thank you very much for all the useful information, I have never done any code before and still cant believe thanks to you that I was able to get this all to work.
Thank you for the great project and for answering questions so long after you finished. I have just recently finished my segway and I am pleased with how easy you have made it for anyone to build. I deviated mechanically and went with wheelchair motors and atv tires, but I used your code and I am happy with it. One thing that I am changing in my design is the steering. I am going to use "tilt" type steering with a 10k potentiometer. Do you think your code could be revised to except variable steering from a 10k potentiometer? Also I have read through the code and I am wondering if there is a number I could play with to have the lean angle vs speed a little more sensitive so you would not have to lean as much? One more thing, When my deadman switch is let go my motors stop abruptly, I'm guessing this is because they are geared wheelchair motors, what do you think? Again thank you very much for all the useful information, I have never done any code before and still cant believe thanks to you that I was able to get this all to work.
7 days agoReply
Wow! That build looks amazing. Please post a YouTube video of it moving if you have a minute.
re: the potentiometer modification, it can be done. Yes, the code could be modified for this. I didn't implement it this way because most people wouldn't have the mechanical ability to build the linkage for the tilt steering. It looks like you do.
To modify the code, a voltage would come off of the pot and be read by an ADC input. You would scale it from 0-255. You would have to calibrate it so 127 is neutral going forward. You would use the number to modify the SteerValue variable in the code. I can help you if you have any issues implementing it.
You can use a larger gain to make the lean angle more sensitive. The gain values are in the beginning of the code. Start with a small change and experiment.
I agree that the geared motors might stop more abruptly than the DC motors without gearing in this Instructable. That said, you should not let go of the deadman while balancing.
re: the potentiometer modification, it can be done. Yes, the code could be modified for this. I didn't implement it this way because most people wouldn't have the mechanical ability to build the linkage for the tilt steering. It looks like you do.
To modify the code, a voltage would come off of the pot and be read by an ADC input. You would scale it from 0-255. You would have to calibrate it so 127 is neutral going forward. You would use the number to modify the SteerValue variable in the code. I can help you if you have any issues implementing it.
You can use a larger gain to make the lean angle more sensitive. The gain values are in the beginning of the code. Start with a small change and experiment.
I agree that the geared motors might stop more abruptly than the DC motors without gearing in this Instructable. That said, you should not let go of the deadman while balancing.
6 days agoReply
Thanks for the quick reply, I will get some video footage this weekend and I will also be pretty close to finishing up on the steering mechanical end after this weekend. At that point I could really use some help implementing the code. I will get back to you when I am almost ready. Thanks again for all the help.
15 days agoReply
Good afternoon sir,
I am making your segway clone for a school project. While testing my segway, the error FIFO overflow keeps coming. I have put my debug off just like you said earlier. Also I have checked my cables, they are short. Also I have checked my resistors. But also those are all right. Could you help me pleas?
Thanks,
Alec V
I am making your segway clone for a school project. While testing my segway, the error FIFO overflow keeps coming. I have put my debug off just like you said earlier. Also I have checked my cables, they are short. Also I have checked my resistors. But also those are all right. Could you help me pleas?
Thanks,
Alec V
15 days agoReply
Hi Alec.
Please read the text and search the comments for FIFO overflow.
What do you mean "put my debug off"?
Does the segway run? Do the motors turn? What help do you need?
Please read the text and search the comments for FIFO overflow.
What do you mean "put my debug off"?
Does the segway run? Do the motors turn? What help do you need?
14 days agoReply
Hi sir,
At first, thank you for your answer.
When I say : I 've put my debug off I mean: watch picture 1.
I have downloaded your program into my arduino. My motors were turning (sometimes very fast and sometimes very slow) but my segway wasn't stabilizing at all.
Afther that I took a look at the serial monitor to see of I could see a error. This is what I saw: picture 2.
I saw that it was giving an" OVERFLOW FIFO"error so I started reading your texts about it. In the meanwhile I have checked my ressistors and ther are fine and good connected. Also my cables aren't too long.
I don't know what I am doing wrong : why is my segway not stabilizing?
Kind regards, Alec
At first, thank you for your answer.
When I say : I 've put my debug off I mean: watch picture 1.
I have downloaded your program into my arduino. My motors were turning (sometimes very fast and sometimes very slow) but my segway wasn't stabilizing at all.
Afther that I took a look at the serial monitor to see of I could see a error. This is what I saw: picture 2.
I saw that it was giving an" OVERFLOW FIFO"error so I started reading your texts about it. In the meanwhile I have checked my ressistors and ther are fine and good connected. Also my cables aren't too long.
I don't know what I am doing wrong : why is my segway not stabilizing?
Kind regards, Alec
13 days agoReply
Hi Alec, From what I can see in your pictures, it looks OK. That first FIFO Overflow in the printout is fine. Can you shoot a video showing the problem and share a YouTube link?
9 days agoReply
Hi sir,
I have made 3 videos when trying to use my segway:
the first:
the second:
and the third:
As you can see I also need to keep touching the deadman switch. In the first video, my segway is trying to stabilize but doesn't succeed at all. In the second and third video my segway is yust turning around for crazy. (video 2 is a close up on the wheels, video 3 is the whole body of the segway)
Thanks for have a look. Kind regards
I have made 3 videos when trying to use my segway:
the first:
the second:
and the third:
As you can see I also need to keep touching the deadman switch. In the first video, my segway is trying to stabilize but doesn't succeed at all. In the second and third video my segway is yust turning around for crazy. (video 2 is a close up on the wheels, video 3 is the whole body of the segway)
Thanks for have a look. Kind regards
8 days agoReply
Hi Alec,
Thanks for posting the videos. Nice build.
In the first video, your segway is shaking. I think that is because your wires are too long. Shorten the wire between the Arduino and the Saber. Also, shorten the I2C wires between Arduino and the MPU6050.
In the 2nd and 3rd video, it looks like one of your wheels is running in reverse. Flip the wires to one of the motors at the Saber. (DONT reverse the 24V Batt wires to the Saber by accident.) If you flipped the proper motor wires, when you tip the segway forward, it should go forward. If it goes backward in this experiment, flip both sets of Motor wires.
Let us know how this goes.
Thanks for posting the videos. Nice build.
In the first video, your segway is shaking. I think that is because your wires are too long. Shorten the wire between the Arduino and the Saber. Also, shorten the I2C wires between Arduino and the MPU6050.
In the 2nd and 3rd video, it looks like one of your wheels is running in reverse. Flip the wires to one of the motors at the Saber. (DONT reverse the 24V Batt wires to the Saber by accident.) If you flipped the proper motor wires, when you tip the segway forward, it should go forward. If it goes backward in this experiment, flip both sets of Motor wires.
Let us know how this goes.
8 days agoReply
Hi sir,
I have shorten the wires like you said. At the beginning my segway was acting in a very positif way.But afther a few seconds (30sec) he started doing crazy things again. While he was shaking, the error lamp on the Saber started to shine.
Kind regards
I have shorten the wires like you said. At the beginning my segway was acting in a very positif way.But afther a few seconds (30sec) he started doing crazy things again. While he was shaking, the error lamp on the Saber started to shine.
Kind regards
8 days agoReply
What is your battery voltage? Each battery should be over 12V. If they drop lower than this, the error LED will illuminate to indicate over current.
The batteries should never be allowed to drop below about 12V. They need to always stay charged. If they drop down, they will be destroyed and need to be replaced with new batteries.
The batteries should never be allowed to drop below about 12V. They need to always stay charged. If they drop down, they will be destroyed and need to be replaced with new batteries.
8 days agoReply
Hi sir,
The battery voltage of my 2 batteries are 12.5V. Do you have other tips?
Kind regards
The battery voltage of my 2 batteries are 12.5V. Do you have other tips?
Kind regards
7 days agoReply
The vibrating effect you show in the 1st video is definitely caused by Over current in the Saber. It actually vibrates like that on purpose to let you know the current is too low. This is usually caused by a voltage drop when the batteries go under load. (P=VI or I=P/V since P is constant, V dropping makes I increase) I would say that there is a problem with your batteries or they were not charged enough when you shot video #1.
For the other 2 videos, you have a motor wire swapped on the Saber. I bet it will balance if you fix that.
For the other 2 videos, you have a motor wire swapped on the Saber. I bet it will balance if you fix that.
16 days agoReply
Will this project work with the Arduino Pro Mini I would eventually like to print the circuit on PCB board with the mini mounted right on the PCB ? I have started this project using 2 24V 450W electric wheelchair motors, 2 12 Volt 22AH batteries, The same Gyro as you and a Sabertooth 2X25. Right now we are using an UNO. When the dead-man switch is pressed the motors will jitter some then run an 100% in one opposite directions. Also before the deadman switch is pressed one motor turned very slow and have 0.4 volts on it from the sabertooth. Tomorrow im going to try shortening some wires. Also, will I have to change some values in your code because this motor setup has a lot of torque compared to your build.
15 days agoReply
Hi Adam,
You can use the Arduino Pro mini I believe. You will need the 5V version. You can tie the MPU6050 to 5V instead of 3.3V as shown in the schematic. The MPU6050 has a regulator on the board. It looks like the Pro mini has 1/2 the Flash memory of the Uno. I don't remember how much was used in the Uno. You'll have to check that too.
You may want to consider skipping the custom board and using the UNO and just soldering the MPU6050 and all wires to it without using the solderless breadboard. Like this:
http://www.ebay.com/itm/2x-Prototype-PCB-for-Arduino-UNO-R3-Shield-Board-DIY-New-Version/261787527447?_trksid=p2047675.c100005.m1851&_trkparms=aid%3D222007%26algo%3DSIC.MBE%26ao%3D1%26asc%3D28774%26meid%3D887c0c7367d34c07b22fe57dae8150d7%26pid%3D100005%26rk%3D4%26rkt%3D6%26sd%3D371273374153&rt=nc
Try shortening up the wires to see if the jitter and slow motor issue goes away. Make sure the motors are spinning in the right direction for the tilt of the board. If not, reverse the wires at the Saber. DONT reverse the 24V Batt wires to the Saber by accident.
Don't let your batteries run down. They should both read over 12V.
Send us a video when you get it working!
You can use the Arduino Pro mini I believe. You will need the 5V version. You can tie the MPU6050 to 5V instead of 3.3V as shown in the schematic. The MPU6050 has a regulator on the board. It looks like the Pro mini has 1/2 the Flash memory of the Uno. I don't remember how much was used in the Uno. You'll have to check that too.
You may want to consider skipping the custom board and using the UNO and just soldering the MPU6050 and all wires to it without using the solderless breadboard. Like this:
http://www.ebay.com/itm/2x-Prototype-PCB-for-Arduino-UNO-R3-Shield-Board-DIY-New-Version/261787527447?_trksid=p2047675.c100005.m1851&_trkparms=aid%3D222007%26algo%3DSIC.MBE%26ao%3D1%26asc%3D28774%26meid%3D887c0c7367d34c07b22fe57dae8150d7%26pid%3D100005%26rk%3D4%26rkt%3D6%26sd%3D371273374153&rt=nc
Try shortening up the wires to see if the jitter and slow motor issue goes away. Make sure the motors are spinning in the right direction for the tilt of the board. If not, reverse the wires at the Saber. DONT reverse the 24V Batt wires to the Saber by accident.
Don't let your batteries run down. They should both read over 12V.
Send us a video when you get it working!
14 days agoReply
We made some progress today after shortening the S1 wire. The motors were balancing as we were tilting the GYRO, after a bit(a minute or two) the motors would start to jitter and act a little crazy... we assumed this is from low battery voltage but that are still reading above 12 volts a piece. We do have a voltage meter and shunt current meter (cheap little display from ebay) This reads 25.1 while acting normal and about 8 amps at full speed. When it drops to 24.9 is when things get crazy and the current jumps around even reaching 23 amps. We have the batteries on charge now at school and will try to get a video tomorrow. Also, I have ordered the Uno pro-typing shield and will probably just stick with that. Another tid bit..... before dead man is pressed one motor still turns very slow. I am going to check pin 13 tomorrow with an Oscope before the deadman is pressed to see if there is anything going on there.
21 days agoReply
Can I choose bigger wheels? Or restrict the size to 8-10 inch? I want to implement the same concept in a self balancing wheel chair.
25 days agoReply
Thank you for the great job! I'm building your
project now. But I have a question .. If I mounted the electric box
underneath the base, is is gonna work fine? Or should I edit the code??
project now. But I have a question .. If I mounted the electric box
underneath the base, is is gonna work fine? Or should I edit the code??
24 days agoReply
I would mount it on top if I were you. Then you know it will work. If you want to move it later, you can. Yes, the code would need to change to mount it on the bottom.
3 months agoReply
Ok, so you use state feedback and not PID. You could add an extra third state which does integration. at present it is prop plus derivative. the integral state would prevent you form having to have offsets for the tilt.
3 months agoReply
Hi Tom,
It looks like you have a controls engineering background. You would be a great candidate to improve the code! As you know, many real world control systems use just PD or PI. On one of my iterations of improving the code, I tried the actual Arduino PID library. It didn't improve things for me but I may not have tuned it right. I have implemented PID in FPGAs before and it took a while to optimize the machine. The Segway is a unique "plant." Your body weight makes up part of the system so it seems to behave differently for different size people. On another note, a real Segway has a much more powerful motor. These motors struggle to balance you if you are too far forward or back. (larger error)
The tilt offsets are not really part of the control loop. They just allow you to adjust the "setpoint" for the control system. This is done for rider comfort. It's awkward to ride a board that is tilting too far forward or back.
It looks like you have a controls engineering background. You would be a great candidate to improve the code! As you know, many real world control systems use just PD or PI. On one of my iterations of improving the code, I tried the actual Arduino PID library. It didn't improve things for me but I may not have tuned it right. I have implemented PID in FPGAs before and it took a while to optimize the machine. The Segway is a unique "plant." Your body weight makes up part of the system so it seems to behave differently for different size people. On another note, a real Segway has a much more powerful motor. These motors struggle to balance you if you are too far forward or back. (larger error)
The tilt offsets are not really part of the control loop. They just allow you to adjust the "setpoint" for the control system. This is done for rider comfort. It's awkward to ride a board that is tilting too far forward or back.
27 days agoReply
I did my own one - small to start with. Working on the big one soon.
http://www.instructables.com/id/Self-Balancing-Upside-Down-Pendulum/
http://www.instructables.com/id/Self-Balancing-Upside-Down-Pendulum/
1-40 of 589 | Next » |
Great tips and very easy to understand. This will definitely be very useful for me when I get a chance to start my blog. segway stockholm
ReplyDelete