Elik R. | BlueStamp Engineering

Elik R.

Ball-Tracking Robot

This Raspberry Pi-powered robot uses a camera module to detect and approach a ball. The trick is in the ball’s color: the Raspberry Pi isolates the color of the ball, making identification much more simple.
Engineer School Area of Interest Grade
Eli R.
Irvine High School
Mechanical Engineering
Rising Senior

DEMO

FIRST MILESTONE

For my final milestone, I added the camera to the car, and programmed the robot for ball tracking. First, I secured the camera. I also secured a portable phone charger to the robot, which had the correct voltage to power the Pi, finally giving my robot mobility. Then, I worked on the code. Programming was difficult, and I ran into some trouble getting all the code to work, but I ended up fixing all the issues. Once the code worked, I still had to fine-tune the logic, which was just trial and error. When it was all finished, the robot worked surprisingly well.
For my first milestone, I tested the camera module with a color-filter. First, I set up my Raspberry Pi. I uploaded an OS for the Pi to a micro SD, and plugged it into the board. Then, I downloaded PuTTY and VNC Viewer to interact with the Pi through my laptop. Once I could access the Pi, I installed necessary camera packages to be able to use the camera module, then I installed OpenCV for the capability of color-filtering. I plugged in the camera module, and set to writing some test code. The completed code provided three displays, a preview of the raw camera stream, that same camera stream with the color red isolated as white, and finally, the camera stream with the color red isolated as red. It encouraged me, because the test showed a major part of the completed prototype in a functional state.

SECOND MILESTONE

For my second milestone, I developed the car module itself, and programmed it to avoid objects. First, I assembled the car module kit, including the chassis, motors, wheels, and battery pack. I secured my Raspberry pi and an H-bridge to the chassis, as well as three ultrasonic sensors, and then I wired together all neccesary devices. The battery pack did not produce the correct voltage to power the pi, and I would end up using an alternative power source, but for this milestone, it stayed connected to its charging cable. Once everything was in place, I set to programming. I tested the motors (using pwm) and the ultrasonic sensors respectively, before I tried to program obstacle avoidance. Both tests went well, but obstacle avoidance proved tricky. The logic I used had the motors randomly stopping and glitching. Finally, by playing around with delays and the duty cycle for the pwm, I got the code to work. It was nice to complete such a large part of the finished prototype.

FINAL MILESTONE

For my final milestone, I added the camera to the car, and programmed the robot for ball tracking. First, I secured the camera. I also secured a portable phone charger to the robot, which had the correct voltage to power the Pi, finally giving my robot mobility. Then, I worked on the code. Programming was difficult, and I ran into some trouble getting all the code to work, but I ended up fixing all the issues. Once the code worked, I still had to fine-tune the logic, which was just trial and error. When it was all finished, the robot worked surprisingly well.