Color Sensor (RGB)
Put every package in the right box
12 boxes will pass on the belt. The RGB sensor measures the red, green and blue values of each box. Read the values and send the box to the right bin before time runs out. In the last four boxes the factory lights dim: the numbers get smaller and you have to compare the channels with each other.
Color sensors light up an object with a white LED and measure the Red-Green-Blue (RGB) values of the reflected light. This is how fabric color is checked on clothing lines, plastic types are sorted at recycling plants and fruit ripeness is detected at harvest.
The TCS34725 RGB sensor is the color sensor used most in kids’ robot kits. It measures RGB + IR + clear light.
If red and green are both high, the box is yellow. When the light dims, look at the biggest channel instead of a fixed threshold; real color sensors also adjust to the light around them.