About the post
This sensor comparison is the conclusion of my series on ambient light, gesture, motion and distance and proximity sensors. Surely, there are many more sensors that fall into these categories and that I haven’t tested. Accordingly, of course, my series cannot be complete. But I think I’ve covered the most common representatives.
In the last posts I have systematically gone through sensor by sensor (except the UV sensors, which I have covered in a single post). In this sensor comparison, on the other hand, the functions are the ordering principle. Many of the sensors have several functions and therefore appear more frequently in this post. It is about the following sensors:
And here are the links to the posts:
A little hint before we start. There is another addendum to this series. It’s about how to build an IR proximity sensor yourself. You can find the article here.
Sensor comparison – (visible) ambient light
The problem of lux measurements
The sensor modules shown above use photodiodes to measure the luminous intensity. To achieve this, the sensors measure the photo voltage or the photo current, digitize the measured value and save it to a data register, where you can read by I2C. The size of the measured value depends, among other things, on the amplification factors, the sensitivity of the photodiode and the measurement time (usually referred to as integration time). Except for the APDS-9960, the sensors there are formulas to calculate an absolute value in lux from the bare reading.
However, the following factors complicate the lux calculation:
- Common light sources have a more or less large, invisible infrared (IR) content. To some extent, the photodiodes are sensitive to this radiation, which results in too high readings.
- The photodiodes do not have a constant sensitivity over the entire visible light spectrum. However, different light sources have different spectra. This results in different measured values for the same luminous intensity depending on the sensor.
Most sensors have a separate IR photodiode with which the measured value of the visible light can be corrected. However, the IR spectra of different light sources are also different. This results in the same problem as with visible light (point 2).
An experiment with commercial luxmeters
I would like to come back to the example from my last post, which illustrates how different lux measurements can be with different light sources (excuse all those who are reading this for the second time!).
Many commercially available luxmeters are calibrated for incandescent light, which is hardly to be found anymore. With the two luxmeters shown below, I have determined good matching results for incandescent light. What happens in natural outdoor light with overcast sky, you can see here:
Sensor comparison – series of experiments with light sensors
I used the two luxmeters and the light sensors to take measurements of incandescent light, halogen lamp light and LED light. I did not include the APDS-9960 because it does not provide values in Lux. I tried to align the sensors at the same distance and angle to the respective light source. My experimental setup certainly does not meet any scientific requirements. But I repeated some values and the variation was less than five percent – good enough for me. Here’s the result:
I was very surprised by the results. On the one hand, the variation is very high, on the other hand, due to the special spectrum of LED light, I would have expected a higher deviation from sensor to sensor than with the incandescent light. It is difficult to say what are right or wrong values. The only reliable value is the one from the Voltcraft luxmeter at incandescent light, as it has been calibrated accordingly. At least under these conditions, the SI1145 and BH1750 deliver very good results.
Overall a bit sobering, isn’t it? I must therefore conclude that exact lux measurements represent a certain challenge. If you require exact results, you can’t help but adjust the calculation parameters to the light sources using calibrated measuring devices or light sources.
Sensor Comparison – Distance (Proximity)
This sensor family can be divided into two groups:
- Group 1 provides distances in absolute values, e.g. centimeters
- these are real distance sensors
- Group 2 returns dimensionless values
- are often referred to as proximity sensors
Of course, any distance sensor can also be used as a motion sensor, but not the other way around. That’s why I treat the motion sensors separately.
“Real” distance sensors
Distance sensors emit ultrasonic or infrared light signals. If objects are in the detection range, the signals they reflect are detected by the sensor. The distance is calculated over the time and the speed of sound or light. With the light-based sensors, I am still very impressed that a component which costs few euros can detect such extremely short times.
Ultrasonic distance sensors
The classic distance sensor is the HC-SR04. There is hardly an introductory book about Arduino & Co. in which this sensor is not mentioned. An interesting variant is the JSN-SR04T, as the actual sensor is waterproof and can be flexibly installed due to its small size.
The ultrasonic distance sensors provide surprisingly accurate values. However, I find it difficult to specify an exact error because the accuracy of a measurement depends on the size and geometry of the object to be captured. In addition, the results depend on whether influences on the speed of sound such as temperature and humidity are considered in the calculation.
Time of Flight Distance Sensors
Sensors that detect distances over the speed of light (ToF) include the VL6180X, the VL53L0X and its bigger brother, the VL53L1X. The three differ mainly in their range (see table at the top) and thus in their typical applications. The VL53L1X is the latest model. This makes it (still) expensive. For 16 to 22 euros it is available European shops, directly from China you get it already for half of this price. Then, however, with several weeks of delivery time. In my experience, the accuracy of the measurement results is slightly worse than with the ultrasonic sensors. The smaller size of the modules, on the other hand, is advantageous. More information can be found in my posts related to these devices.
We had already learned about these proximity sensors earlier as light sensors. They have IR sensors that they use to measure or correct the luminous intensity. Equipped with an additional IR LED, you can capture the IR light reflected from objects in range. Since the IR LEDs only send short pulses, the sensors can distinguish the ambient IR light from the actual signal. The SI1145 does not have an integrated IR LED. Instead, you have to connect it externally to the “LED” port.
It is in the nature of the matter that the sensors cannot detect real distances with this test methodology. The size of the signal depends on the distance, the degree of reflection and the size of the object. However, it is possible to read from the data whether an object is approaching or moving away.
The three sensors first differ in range (see table at the top). The interrupt function of the APDS-9960 and AP3216 is also worth mentioning. You can set upper and lower limits at which you want to trigger an interrupt. The interrupt function of the SI1145, on the other hand, informs about completed measurements.
Sensor Comparison – Motion
Pure motion sensors indicate when motion occurs within their detection range. On the other hand, they cannot measure the distance to the object.
The classic among motion sensors is the HC-SR501. Its measuring principle is based on the pyroelectric effect. This causes the electric potential of a pyroelectric crystal to change with temperature. The temperature change is generated by the infrared radiation of warm bodies (people or animals) in the detection area. I described this in more detail in my post about this component.
The measurement principle of the RCWL0516 could not be more different. The module emits microwaves that are reflected by all objects in the detection area. If the object moves in the direction of or away from the sensor, there is a very low frequency shift (Doppler effect) that the RCWL0516 detects. Everyone knows the phenomenon from sound effects. The siren of an approaching ambulance or police car sounds higher than when the car is moving away.
Despite the different measuring principle, both motion detectors have many similarities:
- The range is up to about 7 meters, whereby the RCWL0516 from 5 meters becomes a little less reliable.
- both can be regulated in terms of their range
- both have an output pin that turns HIGH when a signal is detected
- in both, the length of the HIGH phase can be adjusted
- in both, you can set whether another motion during the HIGH phase extends the signal or it is ignored
A big difference is that you can make the settings on the HC-SR501 comfortably with jumpers and potentiometers. With the RCWL0516, on the other hand, you have to solder. A nice feature of the RCWL0516 is that you can attach a photo resistor (LDR) to deactivate the motion alert in daylight.
Sensor Comparison – Gestures and Color
Gestures, of course, don’t have much to do with color. I only summarize the two because among the sensors discussed, only the APDS-9960 has these two features.
For those who take it exactly: all proximity and distance sensors can detect one-dimensional gestures, namely “approaching” and “moving away”. But I leave this simple form of gesture detection aside. The APDS-9960, however, has four directed photodiodes and can therefore also detect left-right and up-down movements. This makes it possible to realize very nice things, such as switching on and off lamps by moving your hands.
Color recognition works via photodiodes with appropriate color filters. As a measurement result, you get an RGB value. One should not expect too much of it, but a pure red, green or blue are clearly distinguished from each other.
If you only need the color detection function, the TCS230/TCS3200, which I did not discuss in my series, might be egligible for you: