Arduino ambient light sensor

Product Description

This is a light sensor that I’ve been waiting for, for a long time. If you use photo cells or phototransistors, or other light sensors such as the useful TAOS TSL series, you know that every one leaves something to be desired. In robotics for example, sensors either tend to saturate in dark corners under tables, or else in bright sunlight when they go for walks outside, rendering the robot blind. No light sensor that I have used seems to output numbers the same way I see light and shadow – until now.

This is because the way human eyes see light -– and incidentally the way the human ears hear sound –- is logarithmic. Which also explains why the F-stop scale on cameras, and the Decibel scale for sound, are both logarithmic scales. But until recently I haven’t been able to find a light sensor with a logarithmic response curve; the useful TAOS sensor line doesn’t even include one. So to cut to the chase, I was really excited when I found this Sharp chip, with a built-in log amp, which behaves the way I think most light sensors should. When it’s in an extremely dark room, it reads zero on the Arduino’s 10 bit A/D, when it’s taken outside into direct sunlight it reads around 960 (which is not even saturated yet – maybe in the tropics it would hit 1023). Other values are in between, in a nice even manner.

No longer will your robots be blind when they roll into a dark corner, or when you take them outside for a walk in the sun. In the past it was impossible to “equalize” two sensors, say for light seeking, or line following, just by adding or subtracting a constant amount. I believe that technique will work beautifully with these sensors.

We have cooked up a sensor board called “AMBI” (for ambient light sensor) that carries a Sharp GA1A1S201WP surface-mount ambient light sensor. The AMBI’s 3-pin interface can mount directly into the analog input of a JeeNode, into the analog block of a BBB, or into the analog pins on an Arduino (since the sensor draws under a milliamp the other two pins are used to provide power).

The light sensor has a spectral response similar to that of the human eye, which means the sensor is highly accurate when used as the basis of an ambient light sensor, and can capture an astonishingly wide range of light values (3 to 55000 lux). It performs very similarly to a light meter, and will be useful in a wide range of light sensing applications. The sensor works at up to +7V, or down to 3 volts, and operates accurately across a wide temperature range between -40 and +85 C.

One thing that should be said is that the output of this sensor is current. This current is converted to a voltage by a 50K load resistor. So you can’t really power anything such as an LED with the sensor, it’s only really useful for running into an A/D converter. Also the spec sheet recommends a 27K load resistor and we have used a 100K resistor, to get a little more sensitivity on the dark end. If you are using this outside in direct sunlight, you may want to add another 50K resistor in parallel with the output, so the sensor does not saturate (go to maximum).

The sensor produces a voltage output, so all you need to do is run the output into an A/D converter, such as the analog pins on an Arduino. It is not a high current output, so don’t try to drive anything with this sensor directly, you must hook it up to an op amp follower if you want to use the voltage for something such as driving LEDs or a solid state relay etc.

Here’s the one-line Arduino code:

Serial.println(analogRead(0));   // print out value of light sensor on analog pin 0

The board comes with all surface mount parts fully assembled and a loose 3-pin male header.

Applications

  • General photocell replacement
  • Weather stations
  • Robotics: light seeking / avoiding behaviors, proximity (by light obstruction), motion sensing
  • Room occupancy detection and or light adjustment
  • Calculating camera exposures

Specifications

  • Supply voltage: -0.3 to +7.0V
  • Output current: 1 mA
  • Operating temperature: -40 to +85 C
  • 3-pin interface: GND, +5Vin, and readout

Resources

Additional Information

Weight 45 g

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top