Color Sensor Trade Study

By: Matt Shellhammer (Electronics & Control Engineer)

Approved By: Lucas Gutierrez (Project Manager)

Table of Contents

 

Introduction

For the Fall 2017 semester of EE 400D, all of the projects at The Robot Company will be using color sensors to navigate a colored 2D-maze, most commonly using TCS34725 1. color sensor.  This color sensor will be mounted onto each of the robots in a particular manner, decided by each project.  The goal of this trade study is to help give the projects an idea of where exactly on their robots the color sensor should be mounted in reference to the colored 2D-maze.  The sensor should be placed far enough away from the line to avoid only sensing the line all the time; however, it should also be close enough to the line so it will quickly sense the line when the robot veers off the desired route.

Methodology

In this trade study I used two devices, namely the Arduino Uno and the TCS34725 color sensor.  I connected the color sensor to the Arduino Uno in the configuration shown in the table below (Table 1: Interface Matrix).  Additionally, to read the values from the color sensor, I2C communication was used.  To implement this communication, the Adafruit Arduino I2C communication library was used, which is available online on the Adafruit website 2..

 

Table 1: Interface Matrix                       

Arduino Uno pins

TCS34725 Color sensor pins

Vcc (3.3v)

VIN

GND

GND

SDA (pin18)

SDA

SCL (pin19)

SCL

 

The color sensor was then set up next to a paper with measurement tick marks to measure the distance away from the color sensor (vertical test), and then reconfigured later to measure the distance from either the side of the color sensor (horizontal test), both as shown in the figures below.

 

Figure 1: Color sensor trade study configuration for vertical distance test.

 

Figure 2: Color sensor trade study configuration for horizontal distance test.

 

Next, using strips of vinyl tape (electrical tape) I then tested four different color tape strips. To determine the optimal vertical distance away from color sensor, I tested to see where I got a peak measurement and then called that the optimal distance for that color. The color strips used are shown in the figure below with the results for the vertical test following (Table 2: Optimal vertical distance for color strips).

Figure 3: Color strips used in trade study. From left to right: Black, Red, Green, and Blue.

 

Table 2: Optimal vertical distance for color strips

Color-strip color

Optimal vertical distance

Black

2 mm

Red

3 mm

Green

2.5 mm

Blue

2 mm

 

After this test was performed, another test was performed to determine the optimal horizontal distance for the color sensor. This optimal distance will be more subjective, since the color should be far enough away from the sensor to not always be detecting the lines, but close enough to reduce the response time of the robot’s reaction to the line. For this test, I measured two distances for each color. One at the point the colored strip was detected as well as at the point at which the amount of detection significantly spiked. The origin (zero) value was set at the middle of the color sensor. I then performed the test, from the left and the right side of the color sensor, as defined in the figure below. The horizontal test results follow (Table 3: Optimal horizontal distance for color strips).

 

Figure 4: Test setup to show which side would be the right side of the color sensor vs which is the left.

 

Table 3: Optimal horizontal distance for color strips

Color-strip color Detected horizontal distance (Left) Detected horizontal distance (Right) Detection spike horizontal distance (Left) Detection spike horizontal distance (Right)
Red 9 mm 9 mm 2 mm 2.5 mm
Green 1.5 mm 4 mm 1 mm 1 mm
Blue 4 mm 10 mm 1 mm 2.5 mm
Black 3 mm 3 mm 0 mm 0 mm

 

It can be noted that the range of detection can vary from color to color, and from left to right due to the location of the color detector on the color sensor. In most cases, the range of detection of the color strip was a small but significant distance further from the right than the range when measuring from the left.

 

Conclusion

The first result that can be inferred from this trade study is that a vertical distance from the color sensor to the detected color is optimal within a range of 2 – 3 mm. The second result that can be inferred from this trade study is that a horizontal range of 2.5 – 3 mm away (zero being the center of the color sensor) to the detected color will result in consistent readings, with no significant unintentional readings. However, if trying to ensure no color detection when driving along a path, a horizontal range of 9-10 mm might be better desired. Testing with the project specific robot and software will also be an important factor when deciding the layout and placement of the color sensors. This trade study is to be used in supplement with testing to give the engineers a good starting point when designing the color sensor layout.

Source material

  1. https://www.adafruit.com/product/1334
  2. https://github.com/adafruit/Adafruit_TCS34725