## My Electric Unicycle

Posted on August 21, 2012.

### Introduction

I recently built a partially self-balancing electric unicycle called “Bullet,” featuring:

I say “partially” self-balancing because it only balances along one axis (forward/backward), and the rider still needs to balance left and right (it’s analagous to riding a bicycle “no hands”). It operates much like a Segway—you lean forward to accelerate, and lean back to brake. The top speed is about 15 mph, and it easily goes 5 miles on a single charge. This is my primary mode of transportation on the MIT campus.

The thing I’m holding in my right hand (in the video at the bottom) is a “kill switch”—if I let go of it, the unicycle deactivates the motor, much like a treadmill safety key.

Also, you may notice that the circuit is fully exposed. When the unicycle falls forward, the circuit has about two inches of ground clearance (so it never hits the floor). However, I’m currently building a proper case for more protection.

### Details

To estimate its orientation, Bullet integrates readings from the gyro and accelerometer using a complementary filter. To balance, the angle estimate is fed through a PID loop (with no integral term). The loop runs at 625 Hz. The output from this stage determines the duty cycle of a 1.22 kHz PWM signal, which is connected to the H-bridge. The code was written in C, and is in the public domain.

The circuit itself is essentially a pretty standard microcontroller setup—filtering capacitors on the power rails, RESET pin held high (for AVR microcontrollers), external 20 MHz crystal oscillator, some indicator LEDs, and the IMU connected to the ADC pins. Two of the digital output pins are wired to the motor controller, which is connected to the motor and the batteries. The motor controller has an onboard switching voltage regulator that powers the logic subcircuit (and also the charge pump for the high-side MOSFETs of the H-bridge). I expect that most undergraduates in electrical engineering could probably reconstruct the circuit given this description, burn the code onto the microcontroller, and have a working electric unicycle controller. A trip to the machine shop to construct the chassis and voilà, you’ve made your very own self-balancing unicycle!

I am working on an Eagle version of the circuit, which I will of course make freely available upon completion.

### Learning to Ride

Unfortunately, one cannot simply pick up a self-balancing unicycle and ride it with ease. It took me several hours to be able to ride in a straight line without crashing, and it took several days to learn how to turn in a controlled manner. Many of my friends have tried riding it, usually with little success (including some actual unicyclers). However, my talented friend Harry can ride it about as well as I do.

Here are some riding tips:

1. Don’t let go of the safety switch unless you crash. Bullet is designed to help you balance—let it do it’s job (even while mounting). If you ever let go of the safety switch while riding, you will fall (however, it was designed so that if you accidentally let go for a fraction of a second, you can usually recover).
2. Bumps in the terrain are always bigger than they appear.
3. Put most of your wait on the seat, not the pedals.
4. Gain weight! An inverted pendulum with a high center of gravity is easier to balance than one where most of the weight comes from the motor and wheel. To illustrate this fact, try balancing a long broom on your hand (with the broomstick in your palm) vs. a short broom.
5. When you first press the safety switch, Bullet will assume an upright position as fast as it can, even if you are in the way. So don’t be in the way (it can run into your ankles or run over your foot)!

### Practicality

As I said earlier, Bullet is the primary way I navigate MIT and the surrounding Cambridge area. I often zoom past students, faculty, custodians, and tourists, with generally positive reactions from everyone. I’ve been told one can be fined for riding a scooter in the Infinite Corridor. Fortunately, Bullet ain’t no scooter.

However, Bullet is heavy. I live on the fifth floor of a dorm with no elevator, so carrying Bullet up and down the stairs can be quite tiresome. If I were to start over, I would try to minimize weight with a wheel hub motor, NiCad or NiMH batteries, and an aluminum frame (instead of steel).

Bullet’s small size (compared to a bicycle, scooter, moped, etc.) means I can take it on the bus or train with no problem, so I can take public transportation to the stop nearest my destination and ride Bullet the rest of the way. With over 5 miles of range on a single-charge, battery life is usually not a problem in my urban hometown.

### Related Work

I am certainly not the first person to build an electric unicycle. Perhaps the most well-known self-balancing unicycle is Trevor Blackwell’s Eunicycle, which also uses the OSMC. His design is similar to mine, but uses a much more expensive battery pack ($218 for his vs$44 for mine). Also, the Eunicycle’s motor and gearbox cost a grand total of $644, whereas Bullet’s drive system (including the wheel itself) was$195. Finally, the IMU he uses is about $100 more than mine. Overall, Bullet is several hundred dollars cheaper than the Eunicycle, but this comes at a price (mostly weight). Focus Designs (of whom Adam Savage is a customer) manufactures a commercial electric unicycle called the SBU (“Self-Balancing Unicycle”). At$1,795, the SBU is much more expensive than mine, but it has extra safety features and a hub motor, which results in a smoother ride. For comparison, Bullet uses a toothed belt drive, and the Eunicycle features a metal gearbox. Because of the belt drive, I can often feel Bullet’s motor engaging the wheel with a slight jerk.

### Video

Here is a video of me riding it and some of my friends trying it out (sorry no audio):

Tags:  home projects