1
SKILL
LEVEL
Ringo Educational Guide Rev04.1 ~ Plum Geek
Using Ringo’s Light Sensors
tells Ringo to send this value out his serial port to the programming adaptor,
and the programming adaptor sends it to your computer. Open the serial monitor
window and you will see the sensor value pop up in the window. The next line
Serial.println();
tells Ringo to print a line with nothing on it. This is basically a
carriage return in your serial monitor window to create a space between readings.
The last line
delay(250);
causes a quarter second delay between readings.
When you run this code, you should see a value between 0 and 1024 pop up in
your serial monitor window four times per second. Let this run for a few seconds,
then place your hand over Ringo’s right eye. You should see the value go down a
bit. It should go really low if you cover Ringo in a towel or blanket that will almost
completely block out the light. If you turn him toward a bright light or window, you
should see this value go up.
You may notice a few interesting things. First, it is impossible to bring this value
all the way down to zero. This is beyond the scope of the lesson, but the light
sensor always leaks a tiny bit of current which prevents it going all the way to
zero. This is normal. In a similar way, the light sensors are designed to never
totally max out the input of Ringo’s brain, so even in direct sunlight you won’t
reach all the way to 1024.
You will also notice that the value goes up and down a bit even when the light in
your room isn’t changing. This is normal and can be caused by several things.
Most room lighting actually flashes brighter and dimmer 60 times per second,
which Ringo’s sensors can pick up. This can also be caused by tiny bits of
electronic “noise” coming from Ringo’s power supply. If Ringo is charging his
battery you’ll see even more noise caused by the charging system.
A final item to note, is that Ringo’s top side light sensors are “logarithmic”. This
basically means that they respond to differences in light levels the same way your
eyes do, and they can see differences in a wide range of light ranging from very
dim to very bright.