What is a Light Sensor?

From ROBOTC API Guide
< Tutorials‎ | Arduino Projects/Mobile Robotics/VEX
Revision as of 20:03, 26 July 2012 by Pgp90 (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Light Sensors

A Light Sensor is something that a robot can use to detect the current ambient light level - i.e. how bright/dark it is. There are a range of different types of light sensors, including 'Photoresistors', 'Photodiodes', and 'Phototransistors'. The light sensor we will be using (VEX's standard light sensor) is called a Photoresistor.

The VEX light sensor uses a photoresistor.

As you have already learned, a resistor is a simple electrical component that impedes the flow of electricity.

The two main circuit diagrams of a resistor.

A photoresistor is very much the same - it also resists the flow of electricity in the circuit. The difference lies in the fact that the resistor uses a material called Cadmium Sulfide - useful because its resistance changes depending on the ambient light level. With a little bit of circuitry within the sensor, it can be used to tell the robot information about the ambient light level.

Circuit diagram of the VEX light sensor, including the symbol for the photoresistor on the right.

How does a change in resistance allow the robot to understand the ambient light level? That's where the concept of an analog signal comes in.

What is Analog?

As of now, you have only used the board's Digital ports, which can accept either a 0 (a value of 0 volts) or a 1 (a value of 5 volts) as input, and give the same as output (PWM just cycles this on and off very quickly). Analog ports, on the other hand, can accept an infinite range of values between 0 volts and 5 volts. This means that our robot can translate these into meaningful sensory input that can convey far more data. In the case of the photoresistor, this means that we can tell not only if it is 'dark' or 'light', but all the values in between. This is vitally important for an application like this, and indeed, for many other sensors.