Make Your Raspberry Pi Follow Walls

The versatile single board computer, the Raspberry Pi or RBPi, makes an excellent base for an autonomous bot using a rover 5 platform. The bot uses custom laser range finders for basic wall following. It features speed control of each track, regulated by PID using feedback from its quadrature encoders, giving it the ability of directional control. The basic features are explained below.

Batteries power the bot, feeding two separate switching mode regulators. One supplies power to the motors via the H-bridge, while the other powers the RBPi and other electronic devices. The H-bridge and the SMPS reside on the lower layer of the bot, while the sensors and the RBPi are on the upper layer. Mechanical standoffs separate the two layers, and the physical separation between the two layers creates a barrier for the electromagnetic fields from the power system that would otherwise affect the compass.

A Pixy CMUCam and a line laser form the laser range finding system of the bot. A simple piece of PVC pipe with slots cut into it breaks up the beam from the line laser. That allows the cam to recognize the color of the laser blobs as it reports this data via I2C to the RBPi, which then uses simple trigonometry for converting the data into vectors representing range and angles.

A sonar device mounted on the front of the bot implements a fairly simple crash prevention mechanism. The laser range finding system may also be used for a more sophisticated crash prevention system. Even though the bot is meant for autonomous operation, it also has a basic user interface built-in to allow control for testing purposes. The interface allows simple operations such as setting the heading and limiting the forward and backward speeds. It uses some feedback from the current heading of the robot.

For testing the laser range finding, the bot has a built-in GMR or graphical mapping representation, but in a minimal configuration. Using the GMR reveals a basic difference between the mapping from the sonar device and that from the laser range finder. For example, the sonar data interprets long flat surfaces as convex, but the data from the laser shows them to be perfectly straight – implying the laser range finding is linear.

A custom mount holds both webcams and the laser line. As the cases of the webcams made it difficult to mount them, they had to be removed from their casings. One of the cams faces 25-degrees to the left, while the other faces 25-degrees to the right. That gives a 100-degree field of view to the bot. Both the cams are tilted upwards such that the bottom-line of their images is just below the horizontal.

The software processes the images and locates the laser line to calculate ranges. It makes 30 vertical scans from the top of the image looking for the laser line. Looking specifically for a laser line makes it simpler as the line is never vertical. Therefore, every point located on the line has a neighboring point.