The information presented here is for reference only. Use the following information at your own risk.
This is a multiple part project that shows how I built a Segway style self balancing scooter. Each part will be posted to this page as they are completed, so please check back or subscribe to the Making Stuff Youtube channel so you don't miss any of the updates.
I have been wanting to make a self balancing scooter for quite some time. I searched on the internet and didn't find anything that I liked or the ones I did like were lacking enough information to try and build myself. So I decided to just go for it and take the pieces and parts that I liked from looking on the internet and building my own scooter. This project is still a work in progress so I will be posting files and updates to this page as I finish them. This is not a how to project, I am just showing you how I built my scooter so you can follow along at home and maybe get some ideas and inspiration to make one yourself.
I drew the frame in Google Sketchup. When I was satisfied with the drawing, I hand cut the 1 inch square tubing with a chop saw, which probably isn't the best tool for the job. A band saw would have worked much better, but the chop saw was the only tool available in which I had access. I welded the pieces with a TIG welder. The hardest part about building the frame is getting everything square. Since the frame is the foundation of the entire project, I had to take my time and pay extra attention to keeping it all square. Sketchup drawings for this project are available for download to Maker level patreons.
The steering column and steering mechanism were also drawn in sketchup and are part of above google sketchup file. I took the 2 steering plate components and sent them to a CNC plasma cutter and are cut out of 3/16" steel plate. This part of the scooter needs to be beefy. I noticed that when I looked at other self balancing projects, the steering was always a weak point. The steering column is made from 1" square tubing and has a 1/4 bolt welded on the inside of the tube. This is the pivot point for steering column. The other end of the bolt is connected to a potentiometer. The connection is made with heat shrink tubing. This allows for flex between the bolt and the potentiometer. I don't know how well the heat shrink will hold up, but the gap is only about 2mm and I also doubled up on the heat shrink tubing.
There are 2 bolts that limit how far the steering column will travel. These bolts also help to reduce flex between the 2 plates. This is the part the rider will be holding on to, so I wanted it to be as strong as possible.
I found some springs at the local farm supply store. So far the springs seem to work well at keeping the steering column upright. That may change when the handlebars are added to the steering column. I drilled and tapped 1/4" threads in the frame to hold one end of the springs. The other end is attached to a bolt that was also drilled and tapped on the steering column.
This is where I spent most of my time on this project. After painting and assembling the front panel I was ready to load the software and start riding. NOT! The scooter appeared to be working fine while sitting off the ground. When it was tilted forward, the wheels moved the correct direction. When tilted backwards, again they wheels moved. When the scooter was placed on the ground, it shook violently! At first I thought that there was too much play in the gearbox of the wheels. The hubs for the wheelchair motors are keyed and when you get free wheelchair motors, you can't complain about not getting the keys. What made this difficult is the fact that they used metric keys. Not an easy find in the U.S. As luck would have it, I found some metric key stock on the internet and a few days later they were delivered UPS. This solved the slop in the wheel problem but the scooter still shook violently. The only way to get it to stop shaking was to adjust the PID down very low. This would keep the scooter from shaking, but it did not have enough gain to keep it balanced, which made it pretty much unridable.
So at this point it seemed to be a software issue. I was able to get in contact with Ian Johnston, the author of the software that I was using. I was told that he felt the kalman filter and PID methods needed to be re-written. I tried my best to tweak them but after many frustrating hours I decide to abandon this code and try something else.
So I got in touch with a guy I met at a recent Maker Meetup. He had a segway and was showing it at the Meetup. He offered to give me the code he was using. I took him up on his offer and I'm glad that I did. His software used the same motor controller that I was using but it did not use the same MPU. This software used an MPU6050. These are easily found on the internet for ess than $10. A lot better price than the $40 I bought from Spark Fun! The only drawback for me was that the PID and tilt was not adjustable via potentiometers like the other software I had originally tried. I quickly found out that these settings really only need to be set once so losing the adjustments was no big deal. The only thing the code lacked in my opinion was some safety routines on start up. Although the scooter is ridable at this point in the build process, I don't consider it safe. I have tweaked the code to fit my setup, added a few more safety features and of course more LEDs.
If you are looking for the source code, then go to this link. It is the best I have found so far. It works with the most components and motor drivers and is also well documented.
To finish this project, I had to wait for some back-ordered parts to arrive. 3.3v components don't like 24v (they really don't). So after the replacement parts arrived, I added a few safety features. The first of which is a pull cord. This is the same concept that you see on boats and jet skis. There is a cord that attaches to the driver and if the driver falls off, it pulls the cord and kills the motor. This was 3D printed and you can see the parts on thingiverse at this link. I also added a high amp relay that will kill the power to everything on the scooter. It's important to use a relay that is rated high enough to handle the current for the motors. The Sabertooth motor controller will handle up to 60 amps, so I used an 85 amp relay.
There are a few things I have learned after riding the scooter for a while. First, the scooter is not going to set any land speed records because of the wheel chair motors that I used. Second, the stock wheels that came attached to the wheel chair motors are not big enough for this project. This causes a very low ground clearance on the scooter. This is not an issue on level ground. However, riding up hill is difficult if not impossible because the angle of the scooter in conjunction with the angle of the ground going up hill, cause the nose of the scooter to drag the ground which causes the rider to stumble off the scooter. So bigger tires are definitely next on the upgrade list.