top of page
Presentations: About My Project

Color Tracking

One key aspect of our project is color tracking. A color tracking camera was used to determine the position of the golf ball. Using color tracking allowed us to accurately know the position of the ball, while keeping the amount of hardware needed at a minimum.  

The color tracking was achieved through the use of the Pixy2 camera. The main advantage in using the Pixy2 is that is does the color tracking internally to the camera and just sends positional data to a microcontroller. This eliminates the need for the microcontroller to do the (time consuming) color tracking.   

Camera.jpg

Communications 

Inter-Integrated Circuit (I2C) was used as the communications interface between the Pixy2 and the microcontroller. 

The communications protocol dictates that a request is sent to the Pixy2 and the Pixy2 will send a response. A example of this request and response can be seen below:

"getBlocks" function request/response:

Color Tracking bitmap.jpg

The "getBlocks" function was the main Pixy2 function used. The microcontroller sends a 6 byte request and the Pixy2 responds with the position and size of a

"block" of pixels of a color specified in the request. 

Velocity Measurement 

Color Tracking Diagram.jpg

If the X and Y position of the ball are know at two know times the velocity and direction of the golf ball can be determined using the following formulas: 

Color Tracking Equation 1.PNG
Color Tracking Equation 2.PNG
Color Tracking Equation 4.PNG
Color Tracking Equation 3.PNG

Code

To the left are the libraries written to interface the Pixy2 with a microcontroller. The libraries are written for the KL25Z freedom board, however the functions in the my_Pixy2 library use calls to general send and receive functions which can be rewritten to work with a different microcontroller. The my_Pixy2 only has code for the functions need for this project, more can added using this reference.  

 

bottom of page