The DHT11 is a composite sensor that measures relative humidity and ambient temperature. It contains a resistive humidity sensing component and an NTC temperature sensing element, communicating with the microcontroller via a single-wire digital protocol.
1. Hardware Specifications
- Operating Voltage: 3.3V to 5.5V.
- Humidity Measurement Range: 20% to 90% RH (accuracy ±5% RH).
- Temperature Measurement Range: 0°C to 50°C (accuracy ±2°C).
- Sampling Rate: 1 Hz (requires 1 second between consecutive readings).
- Pin Configuration:
- VCC: Connect to 3.3V or 5V.
- DATA: Digital I/O pin (requires a 4.7kΩ to 10kΩ pull-up resistor to VCC on bare boards).
- NC: Not Connected.
- GND: Common Ground.
2. Communication Protocol & Timing
- Single-Wire Bidirectional Protocol: The microcontroller pulls the DATA pin low for 18 milliseconds, then lets it pull high to start the transmission. The DHT11 responds by pulling the pin low for 80µs and high for 80µs, followed by transmitting 40 bits of data (8-bit integral temp, 8-bit decimal temp, 8-bit integral humidity, 8-bit decimal humidity, and 8-bit checksum).
- Time-Gated Protection (Python only): To prevent sensor errors and communication failure, the generated Python code enforces an explicit 2-second rate-limiting guard (
_dht_measure_PIN(), shared across every DHT11 block for that pin) — rapid consecutive calls silently skip re-measuring and reuse whatever the sensor last returned. The C++ code path has no equivalent custom guard; it callsreadTemperature()/readHumidity()directly every time, relying entirely on the real AdafruitDHTlibrary's own internal timing.
3. Component Properties (Property Inspector)
- Temperature (
temperature): Simulates ambient temperature.- Default:
25°C - Range:
0°C to80°C
- Default:
- Humidity (
humidity): Simulates relative humidity.- Default:
60% - Range:
0% to100%
- Default:

