A sociable, balancing robot built with a Raspberry Pi to power it. How tricky is balancing a robot via code, though?
There’s a reason a lot of robots don’t use two wheels or two legs: very simply, it’s difficult for them to balance. It’s much easier and sturdier to be on three (or more) wheels or four (or more) legs; generally, just having a low centre of gravity is a good thing. For two wheels in particular, you need some way of maintaining balance. Usually, this task is left up to humans; as Kris Temmerman shows us, though, a good bit of coding and construction can accomplish the same thing.
“The idea came after seeing some social robots, like Nao and Pepper,” Kris tells us. “Technologically they’re great, but I think they are also kind of boring. Too polite, too cute. I wanted to see if I can make a social robot with a little bit more character.”
The robot is self-balancing so that it can achieve a similar look to these personal assistant robots, and hopefully look a little less weird than the robot from Rocky IV in the process. It has facial recognition built in so it can detect and react to people properly.
“For me it’s a sandbox – a way to try all kinds of hardware and software,” Kris explains. Since he wanted to do some intensive computations, in combination with a display and sound, he opted to use a Raspberry Pi 2. “The quad-core [CPU] came in really handy. I have the face recognition running in a separate thread on its own core, so the main process that handles the graphics, sound, and motion can run smooth and uninterrupted. And I still have two cores left over for future improvements.”
While Kris says it’s certainly not a project for beginners, it’s not as hard as it seems. “If you have a reasonable amount of programming experience, it’s definitely something you can make. You can find plenty of information about balancing robots online. For the face recognition I use OpenCV, an open-source computer vision library that has the hard parts already solved for you.”
Kris made lot of the body and chassis himself with nylon sheets, together with some spare motors and drivers. There’s an Arduino layer in the build as well, to aid with the balancing.
That works well and there are a few online videos you can watch of the little robot racing around on its two wheels. The robot still has some work left to be done. In particular, Kris is looking at mounting a lidar onto it so that it can have a better sense of its environment, allowing it to move around autonomously.
“This was my first project with a Raspberry Pi, but I really like that it has a full-blown Linux distro… I’m definitely going to use it more in the future.”