“With the intention of building a cheap and simple color sensor to do projects with our students, we found an idea that seemed to allow us to do this with a simple LDR photoresistor and an RGB LED. Let’s see how we combine both components and use it with micro:bit to build a simple color ball sorting machine.
The key to the operation of the color sensor is that applying for example a red light to a red object will reflect a higher intensity of light than if we apply green or blue light to the same red object. So we put the photoresistor next to the LED and emit a series of colored pulses from the latter. Reading the analogue value obtained in the photoresistor for each color pulse, we should be able to perceive differences depending on the color of the object we put in front of it, which should allow us to differentiate colors (second picture). It will not be a very accurate sensor, but well calibrated it can be useful in many situations.
- 1x LDR photoresistor GL5516
- 1x RGB LED 5mm
- 3x 100Ω resistor
- 1x 10KΩ resistor
- 1x 1x06 pin header
- 1x 6x8 (6 strips) piece of stripboard”