browsing through my collection of
sensors I found quite a few which deal
with measuring of light today we will
have a look at these sensors bring them
in some order and test them in the end
you should be able to decide which
sensor is best for your project
pretty youtubers here is the guy with
the Swiss accent with a new episode and
fresh ideas around sensors and
microcontrollers remember if you
subscribe you will always sit in the
first row in my last video we covered
current sensors there we mainly have to
distinguish between DC and AC currents
today we deal with light which is more
complicated because we have many sorts
of light so we will look at all sensors
I have in my boxes for sure there are
much more available please comment on
your finds together we are stronger the
focus is on sensors available on
Aliexpress and as breakout ports we will
classify the available sensors according
to the purpose and we will test them in
the end you should be able to select the
right sensor and know how to use it when
we talk about light we have to speak
about wavelength in video number 269 we
used a spectrometer to visualize the
visible and IR light this sensor
captures all wavelengths from UV to IR
in one scan because it is clumsy
relatively expensive and very
directional it's not a useful sensor for
our daily projects but it will be
helpful for comparison and understanding
today's selection covers the following
areas RGB sensors Lux sensors UV sensors
IR sensors and proximity and gesture
sensors the first sensors try to detect
the color of the light source the source
of the light by the way can be active or
passive active means that the source
creates light like a bulb or an LED and
passive means that the light is
reflected
it the sensors cannot distinguish
between these two light sources to
roughly detect the color of light it is
only necessary to measure at three
wavelength red green and blue this is
what these sensors - in this category I
found the following sensors the TCS 3200
is a programmable color light -
frequency converter which means it
outputs a variable frequency signal and
our MCU has to measure the frequency to
get the value a little bit more
complicated than just read an analog
value the sensor consists of 64 diodes
16 of each value and the sketch shows us
the respective values for red green blue
and clear we need 5 pins to connect the
chip here we see the sensitivity curve
of the different photo diodes in a small
test I show you why it is essential to
look at such diagrams if I take an IR
diode and illuminate the sensor all four
values increase not good they should not
react because they are not red green or
blue if we have a closer look at the
diagram from before we see the reason
all photo diodes have their highest
sensitivity in infrared the supplier
should have added an IR filter but we
can fix it an add one typically used in
CCTV cameras it can be switched on and
off which is quite handy if we switch it
off we see similarly high values in all
channels as without it if we switch it
on these values are much lower cool one
thing has to be clear this Center is
only sensitive in 3 particular
wavelength if a light source emits on a
wavelength in between it is probably not
seen or detected on two channels let's
check it out with these 4 diodes I first
check their real spectrum using the
spectrometer the blue diode has a
wavelength of 460
in 520 yellow 590 and red 630 nanometers
so yellow is between red and green now
let's check the values of the TCS 3200 I
did not like the sketches and libraries
I found on the Internet this is why I
created my own it reads the time between
two pulses using the pulse in function
then we can calculate the frequency and
normalize the color values and set the
highest Valley to 100 like that it is
easier to see if the sensor works
Green is okay red is okay and blue is
detected - yellow is as expected
caught in the red and in the green
Channel but closer to red so this sensor
works fine and can distinguish
differently colored things it also comes
with 4 white LEDs for illumination
because we can we also check their
spectrum they emit a lot of blue so pay
attention if you use them a white sheet
of paper seems to be blue these are the
LED panels by the way have a completely
different spectrum similar sensors from
the same company are the two I square C
sensors the TCS 34:14 and the TCS 34 725
both have 4 channels with 4 ADCs and an
I square C interface this is easy to use
and faster than the frequency signal of
the TCS 3200 we also get a library and a
sketch for both the most significant
difference between the two is the
built-in IR filter for the TCS 34 725
however the TCS 34:14 is much more
expensive than the other two so the TCS
34 725 seems to be the better choice
an interesting alternative is the is
l-29
125 it also has an i square c interface
and a built-in IR filter it has no Clear
Channel
typical applications for the last three
sensors are color correction in display
back lights or other colored
illuminations so they should be suitable
for many of our color experiments I'm
not sure which sensors are also suitable
for outdoor usage in full Sun the is
l-29 125 for sure needs a strong ND
filter because it is too sensitive for
bright Sun by the way I printed these
small pieces to stick the IR filter to
the sensor for my tests you also get
many other IR filters because they are
widely used now we leave the color and
go to the illuminance which is measured
in Lux it should show the light
intensity as perceived by the human eye
this is why it measures with a standard
human brightness perception such sensors
are widely used in photography to
determine the aperture and time for
taking pictures I have here a cheap
looks meter to compare the sensors and I
have an additional plan last year I
tried to steer our awning using open
weather map torque I wanted to extend
the awning if a lot of sunlight is
expected to keep the inside temperature
down unfortunately I was not successful
because the weather data was not exact
enough and my wife made quite a few
jokes about that fact and my engineering
capabilities this is why I have to fix
it before this summer a connected Lux
meter should do the job I found the
following selection of Lux sensors in my
boxes a pH 1758 ESL 2561 and 80 SL 25 91
to be complete I also add an LDR and a
photo transistor as a rudimentary Lux
meter let's start with the bee
1750 it is a simple photodiode an ADC
and an eye square see interface the
spectral response as expected covers the
visible wavelength its range is from 1
to 65535 flux what does this mean
here I have a table with looks values of
typical situations according to this
table this sensor should work in
daylight till the dusk but how does it
compare with my looks meter I try three
different light levels and you can't
compare the readings there is a clear
correlation I do not know which one is
right but I tend to believe the unity
device is closer keep also in mind that
the difference compared to the possible
light levels we saw in the table before
is small next I try the TSL 2561 it has
no IR filter but a second channel for
the IR illumination also here you see a
difference and a clear correlation
the TSL 25:9
is a similar chip if we look at the
homepage of AMS which bought Telos in
2011 we see that both should not be used
anymore for new designs but they are
still sold in different versions on
different platforms LD arse or light
dependent resistors are cheap and
straightforward parts to detect light
levels even cheaper is to subscribe to
the channel or to like the video but it
makes a big difference for me anyway
together with a two point two kilo ohm
resistor it produces different voltages
if it's covered or not you only need to
connect it to an analog input and
program a threshold in your sketch
please keep in mind that the resistance
is high when the light level is low LDRs
are not precise nor is their range big
the same applies to phototransistors I
have here one with an IR filter the
diagram is the same as with the LDR and
its reaction is also somehow similar if
you want to detect I are only the
phototransistor with an IR filter is the
better choice for example I built a
small device for my brother to supervise
the error led of its heating system as
soon as it is on the esp8266 sends a
message and he can react before the
house becomes cold now we come to a
particular part of the spectrum
ultraviolet here I have the ml 85 11 UV
sensor it has an analogue output by the
way here we see something also other
breakout ports use they offer a three
point three and a five volt pin I used
an ESP 32 for all tests so I connected
the 3.3 volt pin the ml 85 11 also is a
straight forward sensor it just contains
a UV photodiode and an amplifier and it
measures UVA and UVB light the output
voltage without UV light is 1 volt
I use a special UV flashlight for the
test you see that my overhead light does
not have a lot of UV content the voltage
is 1 volt as soon as I move my
flashlight closer to the sensor we see
an increase in the output voltage also
here you need to use an analog input of
a microcontroller why detect UV because
it would be interesting to see how the
UV level behaves around our homes like
that you can decide how much Sun cream
you have to apply before you leave your
house for example on the other side of
the spectrum is infrared light it is
widely used by makers and you find a few
videos on this channel about this topic
as we saw some of the above sensors are
sensitive to IR without the filter they
can also be used to detect IR besides
that I want to mention a special IR
sensor the TSS opie 18:38 it is used for
IR remotes and it's speciality is that
it detects only modulated infrared in
this case it only detects IR which is
switched on and off with the frequency
of 38 kilohertz this is done to prevent
that pure sunlight can switch your TV on
the next sensors are a little special
proximity and gesture sensors I include
them here because they also measure
light and one even has a built in RGB
sensor I found an apt s 99 60 and an AP
32 16 see the APD s 99 60 is quite
complicated compared to add our sensors
from before it has eight channels and
one led I could imagine it fits into
home automation systems for contactless
switches it can sense proximity and
gestures can detect the amount of light
in a room and even give you information
about the color it has an UV and an IR
filter and it features an I square C
interface a very cool sensor
let's check it out first the colors it
detects the right colors but if you have
a closer look the separation is not as
good as with the true color sensors from
before especially between green and blue
next we try proximity you have to go
quite close to get some readings so it
is good for a switch behind class for
example it also should be able to detect
different directions of your hand at a
distance of around 15 centimeters or 6
inches first I was very frustrated with
the sensor until I discovered that the
Sparkfun example works with interrupts
and I had to adapt the sketch to the ESP
32 as usual I leave a link in the
description to my sketches after I fixed
it it works fine all in all a lovely
sensor as the English would say the AP
3216 see only has proximity and ambient
light it also connects to I square see
please do not forget to power the LED
using a 220 ohms resistor between the
3.3 volts and the LED pin also here the
distance for detection is rather small
these were the sensors I found in my
boxes I'm sure there are many others
available maybe you have a favorite
please share it in the comments
summarized we tested various sensors
which detect light all sensors are
specialized on particular wavelength one
detected UV light quite a few measured
the visible light because the photo
transistors or photo diodes used on the
chips seem to be quite sensitive also
for infrared either the chip has a
built-in IR filter or we have to add one
otherwise we can't get completely wrong
readings because the light levels are
very different indoors and outdoors we
either have to select sensors which have
a high dynamic range or we have to adapt
them to the use case with dark glasses
for color recognition the TCS 34 725
is probably the best choice for me the
looks sensors simulate the light
sensitivity of an eye to show us the
brightness as we see it for elementary
on-off applications light dependent
resistors or photo transistors are a
cheap and a good choice the apts 99 60
gesture and proximity sensor worked fine
and detected gestures as well as sensed
RGB light proximity detection also works
fine on a short distance the AP 32 16 C
is slightly cheaper than the APD s 99 60
so go for it if you do not need RGB or
gesture one sensor not covered here was
the VL 53 l0x distance sensor it was
covered in an earlier video and it is
very good in detecting proximity also on
longer distances up to 1 meter it uses
laser light most sensors had an I
squared C interface and I found
libraries to use them only the TCS 3200
uses frequency a very special interface
and maybe a little outdated
as always you find all the relevant
links in the description I hope this
video was useful or at least interesting
for you if true please consider
supporting the channel to secure its
future existence thank you bye