Published on February 14, 2017
We're using the light sensor to distinguish between colored marbles and white marbles. Using an arduino, you can actually distinguish between white marbles, yellow marbles and red or blue marbles. We're showing a basic setup here that doesn't require an arduino.
The setup is very simple: an LED is mounted under a LEGO ball track and the light sensor measures the light that's reflected by marbles passing by. Colored items reflect less light than white items. Using a threshold, you can filter out the colored items and count only the white ones.
This setup only works with low ambient light. You can add a light shield around the track and the sensor to make it usable in normal lighting conditions.
Update: added arduino code. More info at step 5.
Duration: 15 minutes