Raspberry Pi Pursues Ping-Pong Balls

Ping-pong balls are light and apt to bounce around a lot. Players have a hard time running after them, and when many are playing, finding a number of balls on the floor is a common sight. This was the case at the office of the 37signals at Chicago as well, until their system administrator, Will Jessop, who runs the North West Ruby User Group in Manchester, decided that enough is enough. He designed a solution for the problem with a Raspberry Pi running a robot to pick up the balls and collect them in a basket.

Raspberry Pi or RBPi is a low-cost, credit card sized single board computer with Linux as its operating system. Will designed the original version of the robot using the Custard Pi breakout. However, he changed over to MotorPiTX motor controller developed by Jason Barnett, as this was a much neater board. Will then sourced some of the parts necessary for the robot and built the others.

For example, he designed and 3D printed the motor mounts, the caterpillar track mounts, the ball basket and even a new base. In the end, he added a PiCamera mounted with a fish-eye lens. This made the whole contraption a neat little camera robot, reminding one of Wall-E.

Since the robot had to move around and pick up ping-pong balls, it needed its own power source to allow it to roam free. Will looked at the power requirements and tested its power usage while it was running all its motors. The RBPi robot had its own lifter arm fitted to the chassis and while this was controlled independently, the robot itself streamed video over wireless. Will finally opted for a lithium battery rated at 5AH, 7.4V.

For the software, Will decided to use Go. This, he found, was a great language for the RBPi, as he could use Go to create small, efficient statistically compiled binaries. Additionally, he could also fit them easily within the resource limits of the RBPi. Will runs the Go binaries alongside his gamepad library on his laptop, and these are available as a Ruby gem in C. To allow the RBPi to shutdown cleanly via the MotorPiTX, Will had also to write a power controller script.

Now that the robot was capable of roaming free on its battery, Will controlled it with an Xbox controller, with its camera feed streaming over Wi-Fi. By watching the video stream on a laptop, it was easy to let the robot pick up ping pong balls; see it in action below.

There were some suggestions that Will considered. One of them was to allow the robot to recognize the ping-pong balls on its own and pick them up. Initially Will did think of using OpenCV for accomplishing this, but then he found that people are more excited at driving a robot around and had more fun. Another suggestion that Will is considering for the future is using a vacuum pick up, since ping-pong balls are very light, and easily slip away from the robot’s fingers.