Step 5: Balancing the Sensor
The way we do that is simple, we just show the sensor a sample of white (white card or paper) and a sample of black (black marker on a white paper or black paper). I say paper, but the sample can be anything, as long as the first sample is white and the second is black.
Take ten seconds, and prepare a quick sample card with a white side and a black side.
You will need to have the white sample in front of the sensor when you start up the Arduino (you only have 5 seconds to get it there). Once it flashes once (That is it scanning the white colour and recording the values it recieves), you will need to replace your sample with a black sample, you have five seconds to do that. It will flash again, wait another 5 seconds, and then start reporting.
Your readings will only be as good as your balancing values, so try and pay attention to taking the readings at roughly the same distance from the sensor. Alternating the height will certainly change the reflected light that falls back to the CdS photocell, but this is a fairly robust little setup and delivers very admiral results for the cost.
If you balanced it properly, you are now reading colours. Place things in front of the sensor and verify your output via the serial monitor in the Arduino environment. You should be getting back changing data in roughly the format I showed you above. If you are impatient you can start plugging these numbers into a colour selector (There are many free online, there is even one in the processing environment) and start entering your reading numbers and seeing what the selector shows.
Or you can follow along for one more step, where I will give you a little Processing sketch that will help you verify that your sensor is functioning well, and make it more fun to experiment with.
Remove these ads by
Signing Up
























Not Nice
















Visit Our Store »
Go Pro Today »



