Stabilizing two wheeled vehicle.

For a control systems project course we build a self stabilizing two wheeled robot inspired by the segway platform.

The device.


The two wheeled device was built earlier by the control systems group and was equipped with a motor, tachometer, gearbox, frame and wheels. We added an accelerometer, the necessary hardware and an Arduino to control it.
From the start there were problems with the gears. They were worn, and the axis allowed for some
movement. This caused the gears locking up frequently. Disassembling the gearbox and reassembling in
a way the gears move more freely fixed this problem. Another problem, the bearings the main wheel axis is mounted
through aren’t secured to the frame and fall out easily when a lateral force is applied to the wheels.

A schematic overview

Arduino connections overview

The tacho outputted a -4/4V signal. A voltage summer was made to change this into 0-5V for the Arduino to read out. A low pass filter was made for the accelerometer output, as high frequency vibrations were not desired in the output signal.

Voltage summer


We decided to use a PD controller to control our inverted pendulum. We did this for two reasons; the first being that our systems already has two integrators inside of it in the forms of the measurement/calculation of the absolute angle compared to the angle acceleration. The second reason was simply because this provided the best results. In our final code we used a Kp value of 1 and a Kd value of 0.2. These values were obtained through testing.


In the end the inverted pendulum was neither a complete failure nor a complete success. Due to a lack of time and the underestimated complexity of the task we couldn’t manage to stabilize the inverted pendulum as planned. However we managed to get the pendulum upright for at least a few seconds. The reasons for not being able to stabilize it completely were the fact that there were a lot of delays in
the system. This is mainly due to the friction in the gears, the slipping of the wheels and the Arduino code that did not manage to run at 1KHz. However there were many different other factors that influenced the system such as high frequency vibrations in the accelerometer, environmental noise in form of wind and air flow, conversion problems from the ADC and worn out gears.
Concluding we can say that the project was an interesting experience which made us realize how different a practical stabilization process is from a theoretical one.
Furthermore it can be said that to control the inverted pendulum further users of our installation would have to improve the code or use an Arduino with higher processing power and the gears should be fixed to reduce friction to a minimum.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>