Skip to the content.

My project is a robot that uses the OpenCV Python library to track and follow a ball of uniform color through the Raspberry Pi camera. It performs color filtering and circle detection on each individual frame captured by the Raspberry Pi camera to detect the ball and moves towards the ball until it reaches a calibrated distance, at which point it stops moving until the ball moves out of the calibrated distance again.

Engineer School Area of Interest Grade
Vince Palo Alto High School Computer Science Incoming Sophomore

Headstone Image

Final Milestone

My final milestone is my completed robot with a modified version of the software I developed in Milestone #1 and hardware I built in this milestone. At the beginning of this milestone, I found out that we only had one of the two wheels I needed to build a functioning robot with my motors, so we managed to find a spare acrylic kit with two small 3-6 volt motors with two matching wheels that I could use to build my robot instead. This was a setback initially, but ended up working out fairly well since these low-power motors could be properly powered by the Raspberry Pi 5 volt output, making it so that I only needed to have a mobile external power source for my Raspberry Pi and the whole robot would be powered. For the majority of the milestone, I was trying to use a 9 volt battery pack in tandem with a voltage regulator to power my Raspberry Pi while the robot moved freely. The Raspberry Pi can only take 4.75-5.25 volts safely, and we didn’t have any battery packs that provided power in that range, so I needed to use a voltage regulator to safely provide battery power to my Pi, which provided some good soldering experience. Unfortunately, while the battery pack didn’t fry my Raspberry Pi with overvoltage, it generally had the opposite problem of undervoltage. The battery pack would drain its batteries extremely fast, rendering a full 6-pack of batteries mostly useless for my robot after just a few hours of usage. And even when I had a pack filled with fresh AA’s, the poorly made battery pack would constantly cease providing power entirely for a few seconds, cutting off the power to the Raspberry Pi, causing it to reboot and stopping whatever program was running. At one point, one of the wires pre attached to the battery pack fell off and I had to resolder it, which was a very annoying hurdle that nonetheless gave me some more good soldering experience. Fortunately, some portable power banks with USB plugins arrived after a few weeks, and I promptly switched to the vastly more consistent power source. I also had some difficulty finally integrating my movement and image-processing software with my physical robot, but we eventually worked through all of those issues to create a working robot.

First Milestone

My first milestone was writing code that could successfully power a basic demo with a Raspberry Pi, an H-bridge motor driver, and two 12 volt DC motors. The original online guide for this project was both outdated (made in 2016), and the robot shown in its demo video didn’t work very well. Plus, I enjoy programming and partially chose this project because I wanted to do some software-hardware integration, so I decided to mostly make my own code from scratch, only partially taking the image filtering and processing algorithms from the original guide. I also decided to start by only using the camera to calibrate and determine distance and wait to see if I had extra time to implement echolocation sensors to reduce complexity initially. In this phase of the project, I ironically mostly faced difficulties with hardware, despite this being a software-heavy phase. I didn’t have access to a battery pack at this point, and since my motors were 12 volt DC motors, I couldn’t use the built-in Raspberry Pi 5 volt power source. In order to provide enough voltage to power my motors, I used a 12 volt power cable that was difficult to get working. I also faced a lot of struggles with setting up my Raspberry Pi, eventually leading me to switch microSD cards, and various other hardware components either broke or didn’t work altogether from the start. Despite those issues, I was able to complete this part of the project and learn more about circuits and Python OpenCV.

Starter Project

My starter project was a custom Arduino project. For this project, I chose a pushbutton as my input and an LED as my output. Since this was essentially the first time I had worked with circuits, initially, I just individually followed the official Arduino tutorials for the pushbutton and the LED to get a basic understanding for how to wire circuits on a breadboard and what resistors to use for the individual components. Afterwards, I used the knowledge I had gained from the tutorials to think of an original way to wire on the breadboard so that I could control the LED with the pushbutton. I faced a few struggles with my original pushbutton not working and figuring out how wiring worked, but it was a good experience that allowed me to learn a lot more about wiring and Arduinos.