For a quite some time I had planned to build my own small mobile robot. During the last weeks I ordered the components and played a little bit with an Arduino and ultrasonic distance sensors (as described in an earlier post). Now I have finally found the time to put the basic setup in place and go for a first test drive. Before getting lost in potentially boring details, let’s look at a video of the first test drive (turning on the spot). Note that the Raspberry is acting as video streaming server (see here for documentation) so that the live transmission of this noteworthy event can be seen on the notebook in the back:
Now some background on the why and how of this activity. Back in the last century I had studied industrial engineering, with a focus on semiconductor physics and electronics. More than 20 years later I again wanted to do something practical that also nicely relates to the topic of AI. Thus came the idea to build a mobile robot as a simple AI system that (one day in the future) will be able to sense its environments, to reason, to pursue a plan, to act upon its environment, and to learn.
I selected the Pirate-4WD Mobile Platform as a chassis which is both inexpensive (at some 40 USD) and rock-solid thanks to its aluminum alloy body. Included in the set are 4 drive motors, 4 wheels, a battery holder and additional mounting hardware. I decided to control the DC motors with an Arduino Uno Rev3, a microcontroller that is specifically designed to interact with sensors, motors and all kinds of devices, in combination with an Adafruit Motor Shield V2. The motor shield is powered by a set of 5 NiMh rechargeable batteries which find their place in a battery holder in between the 4 motors.
The brain of the mobile bot currently is not the Arduino, but an older Raspberry Pi 2 Model B that I had lying around. The Raspberry Pi is a single board computer that is about the size of a credit card. Despite its small size, it is a very capable device. The Pi runs versions of Linux that are customized to work on the ARM processor that drives it. This puts a lot of functionality into a small device that is easy to embed into things like robots. I have equipped the Pi 2 with a Wifi dongle so that I can wirelessly SSH into it.
A USB cable connects Raspberry and Arduino (the massive blue cable which I will replace with a shorter one as quickly as possible), serving both as a power supply to the Arduino (but not the motor shield) and allowing to upload Arduino sketches (i.e., C/C++ like programs) from the Raspberry Pi to the Arduino. The Raspberry Pi is powered through another USB cable from a powerbank that I again had lying around.
In order to mount the powerbank and fix sensors I produced several parts from acrylic glass. Three ultrasonic sensors watch out for obstacles in front of the car, complemented by a Raspberry PiCamera. Since the HC-SR04 circuit boards sport about the smallest drill holes I have ever seen, thereby rendering them useless for any practical purposes, I had to fix the sensor with elastic straps, which is certainly not elegant but does the job. I will connect them to the Raspberry Pi through voltage dividers (see earlier post) on the breadboard next to Pi on one of the upcoming weekends.