The main role of a light sensor is to generate an analog or digital value according to the light intensity. These sensors are simple, cheap and are supposed to be day 1 of electronics.
With an Arduino microcontroller and a light sensor you can try to build a robot able to navigate in a room according to ambient light, control a stepper motor, etc.. You could also combine a light sensor with another sensor type to play at the same time with different types of detection. In other words, the possibilities to use a light sensor with a microcontroller such as Arduino are endless in electronics and robotics applications.
In this article, I explore the most common and most budgeted light sensors used with the Arduino microcontroller including the well-knows LDR, and continue with TSL235R, LM393, BH1750, GUVA-S12SD, TEMT6000, VCNL4000, ColorPAL, Analog Ambient Light Sensor, and Parallax QTI. All these sensors can be interfaced very easily with a microcontroller and has different features to cover a broad range of functionalities.
Light Dependent Resistor
The LDR is definitely the most popular and cheap light sensor in robotics. The sensor is also known as photoresistor due to its resistance that varies with the amount of light falling on it. It has two pins and can be interfaced very easily with the Arduino microcontroller. At a price of €4.89 ($5.48) for 20 pieces, the sensor is one of the cheapest and easiest parts to find in any electronics store.
- Step-by-step tutorial to interface the LDR sensor with an Arduino UNO board: Seeing the Light: Using Photoresistors (LDRs) with an Arduino;
The €2.63 ($2.95) sensor is engineered to sense the varying light and converts the light intensity to frequency. For this reason, the output of the sensor is a series of pulses used to measure the light intensity. It can communicate directly with the Arduino microcontroller and can be powered anywhere between 2.7 and 5.5V.
- The Arduino sketch to read the TSL235R outputs: TSL235R Light to Frequency sensor;
The LM393 is a special light sensor that can sense the direction of the light and the light intensity. It has a price of €2.39 ($2.68) and an operating voltage of 5V or 3.3V. The sensor can be directly connected to the digital or the analog pins of the microcontroller. Its features include a digital potentiometer to adjust the sensitivity, and if you need more precise values, the analog output of the sensors is more precise in the measurement of the light intensity.
- A comprehensive guide that shows you how to interface the sensor with ATMEGA328 UNO V3.0 R3: Light Sensor LED Brightness Control System with ATMEGA328 UNO V3.0 R3 for Arduino;
The BH1750 is one of the most advanced sensors that can be used in robotics to measure the light. The €11.65 ($13.05) sensor has digital signal output and is compatible with the Arduino I2C bus interface. The output is the value of light in Lux (Lx), and is the easiest way to measure the light without making any calculation.
- A tutorial that explains you the datasheet of the sensor and how to interface with an Arduino microcontroller: BH1750 Digital Light Sensor;
The GUVA-S12SD sensor has a linear analog voltage output and can be powered with 5V or 3.3V. At a price of €8.48 ($9.50) you have a sensor able to detect the UV radiation in sunlight, a small size part to build a wide range of applications, and a sensor that can be interfaced very easily with an Arduino board.
- A simple guide that shows you how to interface the sensor and read the values returned to the microcontrollers: Use UV Sensor with Arduino;
The €4.42 ($4.95) piece is one of the faster sensors that can be used to detect the light intensity. It’s designed to act as a transistor and can reach a reaction time under 15 microseconds.
- In this project you can see in action the TEMT6000 sensor: Peril-Sensitive Sunglasses;
The VCNL4000 is a multipurpose sensor designed to sense very small changes in light. It’s so sensible that can detect even the shadow. The sensor supports I2C bus and the typical voltages +5 V or +3.3 V. With a price of €8.88 ($9.95), the VCNL4000 works better for short distances (no more than 20 centimeters).
The ColorPAL uses three LEDs (red, green, and blue) to illuminate the components and measure the light reflected back. Even it seems complicated, the sensor has a simple serial protocol that returns the color detected. If you want to build a robot able to detect a full range of colors, the price for this little piece is €17.84 ($19.99).
- Arduino sketch to return the colors detected by the sensor: ColorPal Arduino Demo;
Analog Ambient Light Sensor
Fully compatible with Arduino boards, the DFRobot Analog Ambient Light sensor helps you to detect the light density in the range of 1 – 6000 Lux. It has an analog interface and works with a supply voltage between 3.3V to 5V. The analog light sensor has a price of €4.02 ($4.50).
- A tutorial that shows you how to interface the sensor and read the output values: DFRobot Ambient Light Sensor;
The €8.91 ($9.99) sensor is designed inside the Parallax laboratories and uses a QRD1114 infrared (IR) reflective sensor to determine the light intensity. It can be interfaced with an Arduino microcontroller via analog or digital outputs.
- Guide that shows you how to work with the QTI sensor: QTI Sensor;