DHT22

Temperature and humidity sensor

The DHT22 sensor is the solution for projects that require accurate and reliable temperature and humidity measurements. It allows you to easily connect to the micro:bit using dupont wires and instantly read values in the MakeCode environment. Try measuring climate, monitoring room conditions or creating smart irrigation systems while learning the basics of programming, electronics and working with sensors in a fun way.

Description

The DHT22 is a simple input module that allows for accurate measurement of ambient temperature and humidity. It is ideal for projects focused on climate monitoring, automatic ventilation or irrigation. Thanks to the dupont wires, you can easily connect it to the micro:bit via an expansion board.

Specifications

  • Sensor: DHT22 (digital temperature and humidity sensor)
  • Power voltage: 3,3-5 V
  • Exit: Digital signal
  • Temperature measurement range: -40 to 80 ° C
  • Temperature measurement accuracy: ± 0,5 ° C
  • Humidity measurement range: 0 to 100% RH
  • Humidity measurement accuracy: ±2% RH
  • Module dimensions: 28 × 12 × 8 mm

Connection

  • OctP0 (micro:bit)
  • VCC3V3
  • GroundsGND
dht22_mb2

Program

Basic program

After the micro:bit is properly connected and programmed, the display will show the current temperature measured by the sensor. By simply modifying the program, it is possible to measure humidity.

Tasks

Task 1: Measuring temperature and humidity

Connect the DHT22 sensor according to the diagram and using the appropriate block from the tab DHT22 Start displaying temperature and humidity values on the micro:bit or an external display. Watch the changes as you blow on the sensor or move your hand closer. What values do you measure?

Task 2: Overheat or high humidity warning

Program the micro:bit to display a warning if the temperature exceeds, for example 28 ° C or humidity exceeds 70%What actions could follow in a real application – for example, starting a fan or an alarm?

Task 3: Recording changes in temperature and humidity over time

Let the sensor measure every 10 seconds and show the current values on the display. Watch how the temperature and humidity change in different parts of the room, for example by the window, in a corner or near the heater. Write down the results and compare. Where are the conditions most stable?