Safety and scope
Use the correct sensor supply and data pull-up arrangement for the selected DHT22 module.
Plan, predict and test
Suggested virtual study time: about 20 minutes. This is a planning estimate, not a validated construction time.
Preparation: Foundation electricity and basic programming logic. Adult supervision for children. Review a foundation lesson ↗
Use paper, a spreadsheet or a simulator. This is not a verified physical assembly guide.
- Scenario: Use ADC values 0, 512 and 1023 with the reference sketch’s 0–40 °C mapping.
- Expected result: Predictions: 0, about 20.02 and 40 °C simulated values.
- Checkpoint: Write your prediction, test it in the virtual model and explain any difference.
A correct answer does not certify the physical system.
Record your validation
Use only virtual inputs and indicators until the actual components, pinouts and electrical limits have been verified.
| Case | What to record |
|---|---|
| Normal input | ADC 0 → 0 °C; 512 → 20.02 °C; 1023 → 40 °C |
| Boundary | ADC 511 → 19.98 °C, 512 → 20.02 °C |
| Missing or invalid input | The analog mapping is synthetic; humidity sensing and sensor-fault detection are not implemented. |
| Repeat test | Repeat the virtual test, record the actual output and compare with the expected result. |
These are test-planning requirements, not recorded hardware results.
Before building: understand the listed components and the relevant low-voltage safety rules. This is a concept brief, not a tested assembly manual.
What it does
Build a clear introduction to digital sensors, I²C displays and periodic data acquisition.
Engineering principle
The DHT22 contains a capacitive humidity element and a temperature sensor, and returns a digital data frame. The microcontroller validates and converts the reading, then prints the values to the LCD. A typical DHT22 reading interval is no faster than about two seconds.
Hardware and components
- Arduino UnoRequests and interprets sensor readings.
- DHT22 sensorMeasures temperature and relative humidity.
- 16×2 LCD with I²C adapterDisplays the values while using the I²C bus for a reduced wire count.
- 10 kΩ potentiometer (if required by LCD module)Adjusts display contrast on non-adjustable modules.
- Breadboard, jumper wires and supplyProvide the prototype connections and power.
Suggested build sequence
- Wire the DHT22 data line and the LCD I²C connections.
- Install compatible sensor and LCD libraries.
- Read the sensor at a suitable interval and inspect the serial output.
- Display temperature in °C and relative humidity in %.
- Handle sensor read failures and keep the previous display from showing misleading stale values.
Learning outcomes
- Digital sensor protocol
- I²C wiring and address discovery
- LCD output
- Periodic sampling and error handling
Possible upgrades
Add min/max records, a trend display, an ESP32 dashboard or threshold alerts.
Practice the core principle
This simplified exercise is not the full physical project shown above. Test in simulation first; verify real hardware against its datasheet. Children need adult supervision.
Reference components
- Arduino Uno
- 10 kΩ potentiometer (simulates sensor)
- USB serial monitor
Connection plan
- Potentiometer outer pins → 5 V and GND
- Potentiometer wiper → A0 (simulation input)
Reference sketch
void setup(){Serial.begin(9600);}
void loop(){
int raw=analogRead(A0);
float simulatedC=raw*40.0/1023.0;
Serial.print("Simulated temperature: ");
Serial.println(simulatedC);
delay(500);
}How the code works
- analogRead returns a 10-bit reading on an Uno.
- Scale the value to a hypothetical 0–40 °C range.
- Print the simulated result twice per second. This is not a real thermometer.
Practice sequence
- Connect the potentiometer with power disconnected.
- Test in simulation first.
- Turn the knob and observe the serial output.
- Choose a real sensor and datasheet before replacing the simulation.
Expected result
The simulated value changes from about 0 to 40.
Troubleshooting
Check the wiper is on A0 and reference voltage is correct.
Independent challenge
Add a simulated threshold and print an alert.