FAQ hub / Sensors
Sensors frequently asked questions
Temperature, humidity, distance and other sensors — how to read them and avoid bad values.
- 9real questions
- 3source guides
- 5related pages
Frequently asked questions
9 answers, each linked to the guide it comes from.
Do I need a pull-up resistor?
Only if your module does not already have one. Bare sensors need about 4.7 kΩ from DATA to VCC.
Why do I get NaN?
The sensor did not complete a response. Check the data pin, power, ground and the delay between reads.
Is the DHT11 accurate enough for weather logging?
For a classroom or hobby log, yes. For precise or safety-critical measurements, use a better specified sensor.
Can I use 3.3 V for VCC?
Most HC-SR04 modules are specified for 5 V. Power it from 5 V and level-shift the echo line when your board uses 3.3 V logic.
Why do I get zero forever?
Check the trigger pulse, the shared ground and whether the target reflects sound back toward the sensor. A timeout of zero means no echo arrived.
How accurate is it?
Typically within a few millimetres under good conditions, with larger errors from soft or angled surfaces and temperature changes.
Why does my sensor return zero all the time?
Usually no shared ground, the wrong pin, or a request sent too soon after power-up. Check all three.
Source: Sensor reading stuck? Fix ground, timing and pull-ups
Why do values freeze while the sketch keeps running?
A blocking read without a timeout is waiting for a pulse that never arrives. Add a bounded wait.
Source: Sensor reading stuck? Fix ground, timing and pull-ups
Why does it work alone but not in my project?
Another device is sharing a pin or supply, or grounds are not joined across the whole circuit.
Source: Sensor reading stuck? Fix ground, timing and pull-ups
How to use these answers
Three short steps.
- Find your symptom
Open the question that matches what you see on your board or in your sketch. - Read the short answer
Each answer gives the most likely cause first, then the check that confirms it. - Open the full guide
Follow the source link under the answer for the complete circuit and code.
Related guides
Five real pages to continue from here.
-
Guide
DHT11 temperature and humidity on Arduino
Connect a DHT11 to Arduino and read temperature and relative humidity: pinout, the 4.7 kΩ pull-up, the 40-bit data frame. Guide.
-
Guide
HC-SR04 ultrasonic sensor: measure distance
Wire an HC-SR04 to Arduino, send a 10 microsecond trigger pulse, time the echo and convert it to centimetres with a clear worked example. Guide.
-
Guide
Sensor reading stuck? Fix ground, timing and pull-ups
A sensor that returns zero or freezes is usually missing a shared ground, a pull-up, or a timeout. Check these causes in order.
-
Guide
Temperature Reading with a Display and Sensor
Print values from a temperature and humidity sensor on a display; build the data chain from measurement to display step by step. With fault checks.
-
Guide
I2C address not found? Scan the bus first
When an I2C device will not respond, scan the bus, check SDA and SCL, confirm pull-ups and rule out an address conflict.
Keep your progress in one place
Create a free account to save what you are working on and see your results.