Light Detection

modified on 29 August 2010 at 19:25 - 1,183 views

From RoboWiki

Jump to: navigation, search

[edit] Introduction

Detecting light has many uses in the world of robotics. We use light detection in many of our competitions to find markers that lead us around the course, or to identify a burning fire that we can put out. This article will cover how to make a few simple light detection circuits for you robot.

Light detection is shares the same technology used in Line Detectors.

[edit] Photo Resistors

Light sensor circuit design.
A Photodiode circuit.

Photo resistors are the most common type of light detector. They vary their resistance based on how much light they are exposed to. You can test this by measuring the resistance of the resistor with a multimeter as you move the resistor in and out of light. They have a very large range of resistance, from a few ohms to a few megaohms. In order to use this great range effectively, you have to tune your detection circuit to your ambient conditions. This sensor will give you an Analog voltage that is proportional to the intensity of light.

First, take a multimeter and measure the resistance of the resistor in a neutral amount of light. It is best to do this with the diode mounted in its final position. Once you have this value, you need a plain old resistor that's about the same value. For instance, if my reading from the photoresistor was 1,500 ohms, I would select a 1,500 ohm resistor for my circuit. Now we will create what is called a voltage divider circuit. Connect one end of the normal resistor to a voltage source (5v usually, provided by your microcontroller). Now take the other lead and connect it to the photoresistor. Connect the second lead of the photoresistor to ground. We will measure the resistance at the connection between the two resistors, and use that as our analog signal. Make a connection from there to an analog input port on your microcontroller, and experiment with different light intensities to see if your voltage reading varies.

[edit] UV Tron

The view volumes, from the side and top-down views, of the UV Tron sensor. Click for a larger image.

The UV Tron sensor, from Acroname, is a highly sensitive ultraviolet light sensor. Its primary use is for finding a source of a flame or UV-emitting object. Its interfaces, much like the other sensors here, is a simple analog line. This line sends pulses of 5V (high) for each reception from a UV source. The more pulses that are sent back, the more likely there is a flame facing the sensor. This device is very sensitive, so much so it may sometimes sense a UV source in a room by reading the rays that bounce off walls. When using it to find the precise location of a flame or UV source, you may want to mask the bulb and only allow a slit of light to hit the sensor.

/*******************************************\
 UV Tron Interface code
 
 Sample interface code, based on interrupts,
 for the UV Tron sensor.
 
 Jeremy Bridon
 jgbridon@gmail.com
\********************************************/
 
// Global variable that counts the number of
// pulses from the UV Tron
volatile int UVTronCounter = 0;
 
// Main application entry point 
void setup()
{
  // Star the serial com.
  Serial.begin(9600);
 
  // Register a hardware interupt function for pin 2 (which is indexed by value 0)
  attachInterrupt(0, UVTronEvent, HIGH);
}
 
// Main application loop
void loop()
{
  // Delay for a 1/10th of a second to read for
  // any UV Tron pulses
  delay(100);
 
  // Print out the number of pulses we read
  Serial.print("Number of UVTron pulses: ");
  Serial.println(UVTronCounter, DEC);
 
  // Reset the UV Tron counter
  UVTronCounter = 0;
}
 
// UV Tron impulse event
void UVTronEvent()
{
  // Grow the UVTron UV counter
  UVTronCounter++;
}