During the last 9 months I have been busy working on my latest robotic project: a two wheeled self-balancing robot. I previously wrote about the reasons; in essence I think it is a great way to better understand the technologies that surround us and also a good personal development to derive some teachings about management and leadership on which I will soon write.
In the beginning I thought it would have been a few week-ends project; now almost one year in the process I just started scratching the surface of it. I thought that I had most of the necessary knowledge, instead I had to learn new tools, new programming languages and new engineering concepts.
The purpose of this article is to outline particular aspects of the design of the robot with special regards to some tricky issues I solved long the way, not to be a step-by-step guide. In case you are interested in missing details just drop me a line and I will do my best to provide you the information.
They should have also added “… and hope for the best”
I decided to start building robots for several reasons, firstly I have always been keen on technology, when I was a kid I spent a lot of hours programming and hacking the Commodore 64. Secondly as designing and programming these things is not a trivial tasks, I hope this can teach me patience and tenacity.
My first design is a self-balancing robot; the idea is to have a system that can sense if it is falling and act consequently. Something like balancing a broom from the tip. I will describe the details of the physical model “inverted pendulum” and the construction of the robot in another post. There are various examples, the most known most-likely being the Segway personal transporter.
The robot utilizes fairly complex algorithms and hardware. The core is the microprocessor that fuses data from the Inertial Measurement Unit to evaluate the tilting angle in a similar set-up used for missile guidance systems: gyroscope, accelerometer and magnetometer. Once the data is available the next step is to translate the information into instructions for the motor: “we are falling forward, move the motor to catchup” and so on. This is done by a control method called proportional-integral-derivative (PID).
I started designing an building this about six months ago and made countless revision of the software and hardware: today, for the first time, I got something that works. Below the first video of my self balancing robot. Bailey makes a lot of efforts to balance but still seems a bit drunk (hence the name). I guess there is still much to do in terms of tuning the control mechanism (PID) as usually, after a while, it crashes full throttle against the nearest wall. You can see an hit of this self-destructive tendency at the end of this video…
Nevertheless I am very happy with these first results after so many attempts. The next steps will be to add some wireless communication facility so I can adjust the controller parameters remotely without resetting the robot.