Color Sensing Robot

University of Manitoba Introduction to Robotics Final Project:

I have designed a robot using raspberry pi and Matlab that detects color and moves accordingly.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Parts Required

- Raspberry Pi 2 (with standard peripherals)

- USB Webcam

- L298 Dual DC Motor Driver

- Tamiya Double Gearbox with DC Motors (or any gearbox with compatible motors)

- Access to Matlab/Simulink

-Computer Vision Toolbox

-Raspberry PI Hardware add on

-Image Acquisition Toolbox

Step 2: Assemble Gearbox

Follow the included instructions to assemble the Tamiya gearbox or follow a youtube guide. After assembling the gearbox solder wires to the DC motor connections. These will attach to the outputs of the L298 motordriver.

Step 3: Connecting the L298 to the Gearbox

Connect one of the DC motors to the A+ and A- of the green terminal block. Likewise for the 2nd motor but with B+ and B-.

Step 4: Connect the Raspberry Pi to the L298

Connect the GPIO's from the Raspberry Pi you have chosen to the following pins on the L298:







*Pin numbers vary from model to model

Step 5: Upload Matlab Code Onto Raspberry PI

Instructions for running Matlab on a raspberry pi can be found on the Mathworks website. Upload the provided code onto the Raspberry Pi. What the code does is detect if there is more green than red in frame and than move the robot forward. Basically if it's a "Green Light" the robot gos.

Be the First to Share


    • Made with Math Contest

      Made with Math Contest
    • Multi-Discipline Contest

      Multi-Discipline Contest
    • Robotics Contest

      Robotics Contest



    3 years ago