I would like to share my basic knowledge about the working of electric unicycles, so that further productive discussions can begin on this thread. I am making an attempt to keep this discussion in such a crude language, that any person, even if he/she doesn't know electronics, electrical, or computer programming, could easily make sense of what I'm trying to say.
As far as I know,
electric unicycles run on BLDC Hub Motors. The image pasted below shows, how exactly a BLDC Hub Motor looks like:
BLDC hub motors are also known as, in-wheel motors. These hub motors, are specifically designed for electric vehicle applications. Over the circumference of your motor, there sits a tubeless tyre, which makes it completely ready to be used as a wheel, in your electric vehicle. A good example to explain my point is, if you carefully observe any electric moped/electric scooter/electric two-wheeler like the one, whose image is pasted here:
In such electric vehicles, the rear wheel is always a BLDC hub motor.
For those who are not familiar with what BLDC is, for now just remember few basic things:
1.) BLDC is an abbreviation for Brush-less Direct Current. So, a BLDC hub motor is a short word for Brush-less Direct Current Hub Motor.
2.) These motors provide the best torque output and are highly efficient and durable, as compared to other types of motors. That's the reason why, everyone prefers to use these BLDC hub motors, for manufacturing an electric vehicle.
3.) The construction of a BLDC hub motor is totally different than the normal DC (direct current) motor. For further information about its construction and all, you can always Google it. So, I won't be explaining the construction of the BLDC hub motor, over here, just to keep things simple, for now.
4.) Being able to rotate a BLDC hub motor, in a desired direction, with a desired speed, is NOT AT ALL A SIMPLE TASK!!! :/
For making the BLDC hub motor rotate in a desired direction, with a desired speed, you need a huge electronic circuit, which is referred to as "BLDC hub motor speed controller". To keep things simple for understanding, I'd say that, this speed controller is built using few switches (typically 6 switches, but however the number of switches may vary according to the construction of the BLDC hub motor). In such BLDC motor speed controllers, the DC power obtained from the battery of your electric vehicle, is plugged to one side of each switch, and the other side of the switch gets connected to the BLDC hub motor. These switches need to be switched "ON" and "OFF" in a desired sequential manner to deliver the power to the BLDC hub motor, so that the motor starts rotating in a particular direction, at some desired speed. If you wish to rotate the motor in clockwise direction, there's one type of sequence for switching. And, vice versa, if you wish to rotate the motor in anti-clockwise direction.
There's a certain rate at which the switching of these switches happens. If you wish to increase/decrease the speed of your motor, then you need to respectively increase/decrease the rate at which these switches are being switched. The job of switching these switches is done by a very small computer, which is programmed to do so. To be specific, this "very small computer" is called as a micro-controller.
Now, the image which is shown below, is of a principle of physics, which is referred to as "THE INVERTED PENDULUM PRINCIPLE". The electric unicycles exist today only and only because of this principle. I have pasted an image which illustrates the principle.
So, according to this principle,
A pendulum always attains a state of equilibrium, i.e. all the forces acting on the pendulum become zero, only when the pendulum is either at the middle position or the extreme positions. Now, if you happen to catch the bob of the pendulum, and if you happen to invert it by making it upside down, and now if you happen to release it, then, due to the Earth's gravitational acceleration the bob of the inverted pendulum, would naturally fall either forwards or backwards. So, a control system can be designed which can sense the direction where the bob of the inverted pendulum is going to fall, and the control system thus can prevent the bob from falling in that direction, by applying an opposite control action, to help and make the falling bob straight.
That's how the electric unicycle works. I have pasted an image which illustrates the principle.
In this image, the circular object which is drawn at the bottom, which is seen to be touching the horizontal, resembles the electric unicycle. The stick which is drawn emerging from the centers of those circular object resembles the body of the rider, which is leaning in some direction. The electric unicycle and the center of gravity (COG) of the rider, and the perpendicular distance between them, resembles the inverted pendulum. The COG here, acts like the bob of the inverted pendulum. Now, if the rider stands still, and doesn't lean his body in any particular direction, the inverted pendulum is balanced, so the electric unicycle doesn't move anywhere. Now, let's assume that the rider has leaned his/her body in a particular direction, just as shown in the image above, the COG automatically, is shifted forward, which resembles like the inverted pendulum is facing an imbalance. So, in this case, the control system of the electric unicycle, senses the direction of shift of COG, or the direction where the inverted pendulum is falling. Thus, after understanding that, the electric unicycle's control system balances the weight of the rider, in such position, and makes sure that the rider doesn't fall anywhere. And thus, while balancing the weight of the rider, the control system of the electric unicycle makes sure to rotate the BLDC hub motor in that direction where the rider is leaning his/her body.
That's why if you stand on the electric unicycle and you lean forward, the electric unicycle takes you forward. The more you lean forward, the more it accelerates and takes you into that forward direction. And vice versa for backward direction.
This is how electric unicycles work.