Robot Color Sensor - 1
Updated 8/18/16
Key Search Words: PIC Microcontroller, CCS C Compiler, PIC Projects
Introduction: Here is my first attempt at a device which measures the color of a flat surface below the sensor, and bins it into Red, Blue, Green, White or Black. The purpose is to mount this sensor on a mobile robot, and have the robot use the color information on the ground below it to make intelligent decisions about its tasks. An example might be a particular location in the arena, or the amount of water to put on a special plant. Concept for sensor: The sensor consists of three broadband visual wavelength photocells with red, blue and green filters surrounding a 3200K white LED for illumination of the target. After a calibration on a white surface as a reference, the sensor voltages for each color are proportional to the color filters. So for a white target, the readings are the same, since white is equal combinations of all three colors red, blue and green. For a colored target such as red, the red channel will read higher under illumination than the blue or green so we can deduce the color chips color by identifying the brightest reading. For black, all colors are very low in brightness. A micro controller calibrates, reads and displays the results of each measurement, which takes around 1/3 of a second and sends it to both a LCD display and three LED's that are colored the same as the filters. Program sequence: The processor, a PIC16F876a chip first turns on the white light and allows 300ms for the sensors which are cadmium sulfide to stabilize. Then it reads all three sensors which are part of a voltage divider with a 4.7k and put out a very low voltage in dim light, and a maximum voltage in full illumination. Most readings are from 1 - 3v into the 10 bit A/D converters. The readings are then normalized by determining the multipliers for the blue and red light to equal the green reading. This will be applied to all subsequent readings. Then it reads out continuously allowing the mandatory 300ms to elapse after light turn on to stabilize the CdS. The robot will read the parallel outputs for the RGB LEDs and then know the color under the robot at that time. For now, we can see the lamps light accordingly. |
Bench setup. On the right is the LCD display for seeing the actual RGB values. The center is the board with the processor and to the left the sensor board is held half an inch over a white Styrofoam target. Styrofoam is a very uniform reflector for all colors from IR to UV. The color chips are construction paper and can be seen above. To the right of the chip are the three color LEDs. |
Micro controller board. Im using a red, green, and blue LED on the right to indicate color maximums. the crystal is 10Mhz. |
| Schematic for the micro board and sensor. Click to see full size. |
Color sensor head. The 3200K white LED in center puts out more reds and is relatively visual in output color. The filters are made by using a paper punch and making disks out of gel filters. The filters used are W25 - Red, W58 - Green, and W47 - Blue. Differentiating blue and green is not easy... Also note the black sleeve around the white LED in the center. This keeps the side light from fogging the photocells. |
Response time of CdS photocells. It takes roughly 200 - 300ms to stabilize once the LED lights up and shuts off. This has to be added to the read sequence to keep all accurate! |
Sensor over target with white light on. On the robot, the sensor will be housed in a black cylinder (read: bottle cap) to keep ambient light out. |
RED chip - see top red LED is on. |
GREEN chip - see middle LED is on. |
BLUE chip - see blue bottom LED is on. (way too bright here) |
LCD readout of white surface. |
White surface - all three LEDS are on.
The next step is to mount this on the whisker bot and see what we can do! |
HOME