b• or la Elekt kt
la b
• Ele k t
or
la
kt
or
AL b
Ele
ORIGIN
lab or
Ele
project
Light Switch DeLux A Solution for High-Precision Light-Controlled Switching
By Clemens Valens (Elektor)
Light-controlled switches are plentiful and retail for €10 or so, but most of them are changing their state somewhere in the twilight zone. Sometimes applications require better precision and more control than these cheap switches allow for. Do you need a luxaccurate light control? If so, this project is for you. There exist many, many designs for light-controlled switches and most of them work great in the application they were designed for. These applications usually consist of switching on a light when the ambient light level drops below a certain threshold and switch the light off again when the light level increases. Sometimes a timer is added too. You might think that every possible application is covered by these designs and yet this is not true. The reason is that they all lack precision. Based on an LDR or phototransistor, they tend to switch somewhere in the twilight zone. However, light levels vary much more than that.
Brightness Is Subjective
To humans, daylight intensity or brightness is fairly constant. Of course, we notice
variations due to clouds and the sun, but we are not very sensitive to them. The reason for this is the eye’s logarithmic response to brightness. On a cloudy day brightness can vary between 5,000 and 10,000 lux, yet it looks almost the same to us. Sunlight may result in levels of over 25,000 lux, which we notice, obviously, but we don’t experience it as three or more times as bright. Plants, on the other hand, are way more sensitive to light intensity than humans. Farmers know this, and they shine artificial light on some of their crop even during the day to improve its yield. On sunny days this is usually not needed, but on cloudy days it may help. To do this in an economical way, they therefore need light-controlled switches that can detect brightness differ-
66 embedded world Special 2022 www.elektormagazine.com
ences with more precision than an LDR or phototransistor can do. Today light sensors exist that convert brightness directly to a value in lux with resolutions of up to 16 bits. Some of these sensors not only measure lux, but also UV and white light intensity. With such a sensor, it is quite easy to build a high-precision light-controlled switch.
High-Accuracy Ambient Light Sensor
A popular light sensor is the VEML7700 from Vishay. This is a high-accuracy ambient light sensor with I²C interface and it can be found mounted on a small module for a few euros. From the same family we might also cite the VEML6075, a UVA and UVB light sensor also with I²C interface. Because of its digital I²C interface the sensor does not need an analog-to-digital converter and can instead be connected directly to most microcontrollers. Its output data is available in two 16-bit registers: ambient light (also called ‘ALS’) and white light. White light covers a wide spectrum from 250 nm up to 950 nm. The ALS spectrum is much narrower, from about 450 nm to 650 nm as it is optimized for human percep-