Skip to content

FAQ hub / Sensors

Sensors frequently asked questions

Temperature, humidity, distance and other sensors — how to read them and avoid bad values.

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.

Source: DHT11 temperature and humidity on Arduino

Why do I get NaN?

The sensor did not complete a response. Check the data pin, power, ground and the delay between reads.

Source: DHT11 temperature and humidity on Arduino

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.

Source: DHT11 temperature and humidity on Arduino

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.

Source: HC-SR04 ultrasonic sensor: measure distance

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.

Source: HC-SR04 ultrasonic sensor: measure distance

How accurate is it?

Typically within a few millimetres under good conditions, with larger errors from soft or angled surfaces and temperature changes.

Source: HC-SR04 ultrasonic sensor: measure distance

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.

  1. Find your symptom
    Open the question that matches what you see on your board or in your sketch.
  2. Read the short answer
    Each answer gives the most likely cause first, then the check that confirms it.
  3. 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.

Keep your progress in one place

Create a free account to save what you are working on and see your results.