How do Segways & Unicycles work? Explained!


Hey friends, Happy Wednesday!

Last week, I went to watch John Wick 4 with my friend. And had Boba tea after ages.

Here I am with a newsletter issue on Segways and Unicycles.

Let’s look at how they self-balance on only 1 or 2 wheels without the rider’s active efforts to balance the vehicle as we do so on a bicycle, this week. I aim to write my newsletter issues in a way one can follow them while traveling on a bus, having a coffee, waiting for your food, etc. I’ve added some pictures to make it easier to read. Let's jump in!

Tweet of the week

I’m sharing a cool fact on gadgets every day on Twitter. And here is one of them for you (the following is the start of a thread)

twitter profile avatar
Chendur Singaram
Twitter Logo
@ChendurSingaram
February 28th 2023
0
Retweets
0
Likes

How do Segways self-balance on 2 wheels?

The general idea behind balancing a Segway applies to a Unicycle as well.

When you’re riding a bicycle, you actively make efforts and use your legs to balance once you come to a stop. This isn’t the case in a Segway at rest - the controller self-balances the vehicle so you don’t need to place your legs on the ground. But how is it done?

Idea 1: Reaction Torques

Let’s say we have a simple model of a long vertical handlebar with a wheel that can rotate about its center O as shown in Figure 2. Now if we apply a Torque Tw to the wheels, there is a reaction torque on the vehicle in the opposite direction equal in magnitude. To digest this fact in an easier way, you can draw similarities to Newton’s Third law of Motion - Every force has an equal and opposite reaction.

Idea 2: How does a Segway self-balance the rider?

To use a Segway and commute, a rider steps on it and leans forward to go ahead. To apply brakes or go in the reverse direction, you can lean backwards accordingly. But how does the Segway balance the rider and move ahead at the same time?

1. When you lean forward on a Segway, you are applying torque to the handlebar, making it rotate clockwise. Now we want to counteract and apply a torque in the anticlockwise direction so that the user does not fall face first.

2. We just saw in the earlier section that rotating the wheels clockwise applies a reaction torque on the handlebar in the anti-clockwise direction. This is exactly what we want. So in an attempt to balance the rider, the wheels move forward to counteract the torque.

3. You can never lean forward or backward and fall when the Segway is active. The motors are very reactive and always catch up before significant deviation in the pitch angle theta.

But how do we control and apply the right amount of Torque to make this happen? What if the motor overreacts and pushes you making you fall backward? Let’s see how this is handled.

Idea 3: How to compute and apply the right amount of Torque?

The Segway has IMU and gyroscopic sensors that can determine the lean (orientation angle theta with the vertical, aka pitch) of the user. The larger the theta from Figure 3, the more torque is applied using a PID algorithm to correct for the lean and stabilize the Segway. We went over the PID algorithm briefly in my Newsletter issue on Cruise Control. I’m attaching a link to the YouTube video again if you’d like to read about it. It basically works like your thermostat maintaining the temperature of your room.

Torque = kp(theta) + kd(thetadot)

Where kp and kd are gains - constant numeric values. Theta is the pitch angle and thetadot is the rate of change of pitch. There are more specific cases of the algorithm where the position information is used as well, but I've kept it simple here.

In this example, I’ve taken the desired theta as 0 (vertical position of the handlebar) and desired theta dot as also 0. This correction algorithm runs 100 times a second.

A different control technique called LQR can also be applied for the Segways to self-balance. I’ll leave it to you to explore this further as it’s a ton of Math and is not related to the objective of this newsletter. You can find projects that I’ve done in the past using the same on my website.

Reference: US 6538411 B1

Question of the week

But how do you turn right or left using a Segway? How does the control mechanism work in this case? Reply to this email with your thoughts, and we’ll have a discussion. I’ll answer this in next week’s issue.

Also, let me know if you’d like to read about a specific gadget/device. And I can write about it.

Gadget of the week

AI Oven: The Bespoke AI oven developed by Samsung has an internal camera and can detect the food items you place inside the oven, and can also track if it’s getting burnt or not. It can even recommend settings after recognizing the food item. This was featured in CES 2023.

Thank you for reading!

Have a nice rest of the week, and take care!
Until next Wednesday,
Chendur

twitterinstagram

How Do Gadgets Work?

Understand the inner science, tech, and AI of your gadgets with me, a Carnegie Mellon alumnus. Join 335+ readers every other Wednesday to see the world differently in just 3 minutes—regardless of your background! 🚀

Read more from How Do Gadgets Work?

Hey Reader, Happy Wednesday! Last week, I met my middle school friend after 12 years in San Francisco for dinner. Let’s look at the second part of the 4-part internet series this week. I aim to write my newsletter issues in a way one can follow them while traveling on a bus, having a coffee, waiting for food, etc. Let’s jump in! How it works: 15-second answer The internet is physical and fragile. The YouTube video is stored on a computer in a building (aka data center) somewhere in the world,...

Hey Reader, Happy Wednesday! Last week, we went to the Cherry Blossom festival in San Francisco. Let’s look at how the Internet works for the next four weeks, starting today. I aim to write my newsletter issues in a way that one can follow them while traveling on a bus, having a coffee, waiting for food, etc. Let’s jump in! How it works: 15-second answer Internet is physical and fragile. The YouTube video file is stored on a computer in a building (aka data center) somewhere in the world,...

Hey Reader, Happy Wednesday! Last week, I went to Lake Tahoe in California for the long weekend. Let’s look at how a SOS signal works this week. I aim to write my newsletter issues in a way one can follow them while traveling on a bus, having a coffee, waiting for food, etc. Let’s jump in! How it works: 15-second answer SOS is a universal distress signal used in emergencies. It works through Morse code, which combines short (·) and long (—) signals to form letters and words. The letters SOS...