Source: https://mokxi.com/dht11-simulator

Simulator

# A DHT11 simulator with a temperature and humidity you set

Mokxi is a free online DHT11 simulator that runs in your browser, with nothing to install and no account needed. An Arduino Uno reads a DHT11 on pin 2 with the DHT library and prints the temperature and humidity every two seconds. Change the sensor’s readings on the canvas and the next line follows.

Start building free or see the DHT part

- 455 parts on the bench
- 43 boards running now
- 1.00x real time, on every board

Click to open it in the editor

Change the sensor’s temperature or humidity on the canvas, or click anything else to open it in the editor.

## What you can do here

In the circuit above, or in the editor it opens.

- Read temperature and humidity with the DHT library
- Set the sensor to any reading and watch the sketch follow
- Switch the part between a DHT11 and a DHT22
- Pull the data wire and see the sketch report the missing reading
- Show the readings on an LCD or an OLED
- Run the same sensor on an ESP32 or a Raspberry Pi Pico

## What the running circuit shows

Forty bits on one wire.

The DHT11 has a small chip of its own. The Uno pulls the data line low to wake it, and it answers with forty bits: humidity, temperature and a checksum, each bit a high pulse whose length says 0 or 1. The DHT library does that handshake and checks the sum; the sketch only asks for the two numbers.

In the engine the sensor starts at 22 °C and 45 percent, and the serial monitor prints “temperature 22 C, humidity 45 %” every two seconds. Set it to 31 °C and 81 percent and the next reading says so. Pull the data wire and the sketch prints “no reading: check the DATA wire”.

## DHT11 or DHT22

The same three pins, different answers.

The part is a DHT11 or a DHT22, picked in the properties panel. The DHT11 reports whole degrees and whole percent, from 0 to 50 °C and 20 to 90 percent, and the part holds a setting outside that range to the edge of it, as the real sensor would: set it to 60 °C and the sketch reads 50. The DHT22 reports tenths and reaches further. They frame their forty bits differently, so the sketch has to name the right one: make the part a DHT22 while the sketch still says DHT11 and the serial monitor reads “temperature 0 C, humidity 1 %”, the nonsense a real mismatched pair gives.

What it leaves out: a real DHT11 is slow to follow a change in the room and only good to a couple of degrees, and here it reports exactly what you set. The data line’s pull-up is built into the part, a 5.1 k as on the three-pin modules, and it is a property you can turn off to watch the line fail.

DHT22 and DHT11 with Arduino The LCD simulator The OLED simulator The ESP32 simulator

## Questions

Is it free?

Yes. The circuit on this page, every part in it and the editor it opens in are on the free plan, with no card.

Do I need an account?

No. The circuit runs the moment the page does, and the editor opens without one. A free account is only for saving a project to the cloud and sharing it by link.

Can I simulate a DHT22?

Yes. Set the part’s model to DHT22 and change DHT11 to DHT22 in the sketch’s DHT dht(2, DHT11) line. The DHT22 tutorial has a weather station circuit ready to open.

Why does my DHT11 read nan?

The library got no answer, or an answer whose checksum did not add up. Check the data wire and the pull-up, and that the sketch names the sensor you have. This sketch prints “no reading: check the DATA wire” instead of nan.

How often can I read a DHT11?

Not much faster than it can measure, so the sketch waits two seconds between readings. Ask too soon and the sensor answers with the reading it already had.

## More simulators

Each one opens on a circuit that is already running.

Online circuit simulator Breadboard simulator ESP32 simulator Op-amp simulator Logic gate simulator LED circuit simulator Servo simulator LCD simulator OLED simulator NeoPixel simulator 7 segment display simulator LED matrix simulator Stepper motor simulator Motor driver simulator Ultrasonic sensor simulator Rectifier simulator Digital circuit simulator Potentiometer simulator PWM simulator Relay simulator Shift register simulator RFID simulator Accelerometer simulator RGB LED simulator Buzzer simulator MOSFET simulator Circuit simulator for kids Flip-flop simulator Multiplexer simulator Full adder simulator I2C simulator UART simulator Thermistor simulator PIR sensor simulator Oscilloscope simulator Multimeter simulator DC motor simulator Traffic light simulator Diode simulator Capacitor simulator Series and parallel circuit simulator Wheatstone bridge simulator Voltage regulator simulator Soil moisture sensor simulator Zener diode simulator Solar panel simulator AC circuit simulator Thevenin simulator Decoder simulator Encoder simulator PID simulator Robot arm simulator Load cell simulator IR sensor simulator LM35 simulator HC-05 Bluetooth simulator nRF24L01 simulator

## Read a DHT11

Open the circuit, change the humidity and press Run. Nothing to install, and no account needed.

Start building free Open the editor
