Summary

Every Arduino or ESP32 starter kit ships with a few common sensors that you’ll see scattered across the internet in beginner projects. They’re brilliant for learning how sensors work, how to read datasheets, and how to wire a breadboard without frying anything, but if you’re thinking of making real projects with these, I’d advise caution. These sensors are easy to use, sure, but they’re also extremely unreliable and can give readings that are all over the place. None of them give data you can genuinely rely on outside a demo project, so while they may help you get the basics down, you’d want something more accurate for a real project. The DHT11 is confident, precise, and often wrong 38% of readings fell outside the sensor’s own spec sheet The DHT11 is one of the most popular first sensors you’d like to use with an Arduino or ESP32 project if you’re just starting out in the fascinating world of microcontrollers. It’s cheap, easy to wire, and at the same time, utterly mediocre. It’s rated for just 20 to 80% relative humidity with ±5% accuracy and ±2°C on temperature, and it simply refuses to read below 0°C or under 20% humidity. Independent testing backs this up as well, with one long-term study finding that 38% of a DHT11’s humidity readings fell outside its own specified range, and it reported those bad numbers with the same confidence as the good ones. Another accuracy study measured DHT11 error bands of 1 to 7% for temperature and a staggering 11 to 35% for humidity. The DHT22 is better on paper, but run them side by side with an actual temperature sensor or hygrometer, and you’ll find that humidity readings can still be off by 20% or more. It’s usable for a basic project where you don’t need pinpoint accuracy or if you’re learning about microcontrollers and sensors, but the data you’re getting from these sensors is a suggestion at best. The HC-SR 04 isn’t great at guessing A 3.5% error before the code even runs The HC-SR04, another extremely popular Arduino sensor, measures distance by timing an ultrasonic echo and dividing by the speed of sound. That sounds simple enough until you realize that the speed of sound isn’t a constant. It shifts about 2.6% for every 10°C increase in air temperature, with humidity and air pressure further adding to the increase. This means a sensor mounted outdoors in direct sunlight can give different distance readings for the same measurement depending on when you’re taking the reading. These sensors are often measuring against a wildly wrong assumption before ever sending a ping. And then there’s the beam angle. At roughly 15 degrees wide, any surface that isn’t flat and perpendicular reflects sound off at an angle, which the sensor reads as further away than it actually is. Soft, absorptive materials like fabric or foam rarely bounce sound back at all, so the sensor sometimes reports nothing when someone’s standing right in front of it wearing a thick fabric. There are also jitters of ±1 to ±10 cm even under normal conditions, and things can get much worse if you’re operating near the sensor’s minimum range or with less-than-ideal surfaces. Infrared sensors that measure reflectivity, not distance Dark surfaces and sunlight both fool the receiver The IR obstacle sensors bundled into kits work very similarly to HC-SR04 ultrasonic sensors, except they use infrared light instead of sound. However, they also run into the same problems — they don’t measure distance; they measure a proxy for it. That proxy falls apart fast. Black or dark, matte surfaces absorb infrared instead of reflecting it, so the sensor’s effective range can drop from the rated 20–30 cm down to almost nothing. Bright ambient light or direct sunlight can also saturate the receiver, trigger false detections, or even wash out the real ones entirely. Even when used indoors, wall lights and lamps can randomly trip IR obstacle sensors that were working perfectly. Add dust, humidity, and viewing angle into the mix, and you’ve got a sensor whose detection is really just a best guess in the form of a HIGH or LOW signal. No two photoresistors agree with each other Manufacturing tolerance is the whole problem Photoresistors, also called LDRs, are cheap because manufacturing tolerance is loose, and that looseness shows up directly in your readings. These resistors can vary wildly between units, meaning one sensor can produce a completely different resistance value compared to another under the same lighting conditions. This happens because of manufacturing differences in the cadmium sulfide film used in these resistors. Even a strong overall correlation between resistance and light level (R² above 0.99 in most studies) doesn’t save you, because that curve shifts unit to unit. This means that a calibration you did on one photoresistor won’t transfer to the next one out of the same bag. If you need anything more precise than a suggestion about the light level around the sensor, you need manual and tedious per-sensor calibration. PIR sensors only work when you’re moving Sit still long enough, and the lights turn off PIR motion sensors don’t detect presence; they detect changes in infrared radiation, which means a person sitting still is functionally invisible to them. That’s why smart lights controlled by PIR sensors have a well-documented tendency to switch off on someone who simply stopped moving at their desk. They’re also prone to false triggers from sudden temperature shifts, HVAC vents, or even bright sunlight moving across a wall. Not to mention their accuracy significantly degrades in hot, humid conditions where ambient heat gets closer to human body temperature. Treat every reading as a suggestion, not a fact Averaging and outlier rejection do the work these sensors won’t None of these sensors are useless. They’re excellent teaching tools and, if you’re willing to live with the quirks and unreliable data, a cheap way to add a physical interface to your project. They’ll get you comfortable with GPIO pins, ADC readings, and basic signal processing, but that’s about it. The mistake, however, is trusting their raw output as anything more than a suggestion. Any serious project needs averaging, outlier rejection, environmental compensation, or, frankly, a better sensor entirely, like an SHT31, a time-of-flight VL53L0X, or a proper lux meter IC such as the BH1750 to get accurate readings.

By Yadullah Abidi

Original Article