A workshop weather station, a temperature probe on a cable and a room humidity monitor need different sensors. DHT22, DS18B20 and BMP280 all report temperature, but the measurement you actually need is the best place to start.
In this guide
DHT22 vs DS18B20 vs BMP280
Write down the job before choosing a board: air temperature and relative humidity, temperature at a remote point, or atmospheric pressure. That keeps a familiar part number from steering the whole project in the wrong direction.
| Sensor family | Measures | A useful starting point for | Connection |
|---|---|---|---|
| DHT22 / AM2302 | Air temperature and relative humidity | A ventilated room, workshop or protected greenhouse monitor | Dedicated DHT digital data protocol |
| DS18B20 | Temperature | A cabled sensing point away from the controller | 1-Wire data bus |
| BMP280 | Barometric pressure and sensor temperature | Pressure trends or an experimental barometric altimeter | I2C or SPI |
For a weather project, combining a humidity sensor with a pressure sensor can be more useful than asking one part to do everything. For a temperature-only logger, start with one sensing point and a reliable reading before adding screens, wireless reporting or more probes.
DHT22: measure the air around your project
The DHT22, also sold as AM2302, suits slow environmental measurements. Its humidity value is relative humidity: the reading changes with temperature as well as moisture. Positioning the sensor beside a warm regulator can therefore distort both values.
Give the ventilated housing access to representative air while protecting it from rain, spray and condensation. A sealed box protects the electronics but prevents the sensor from following the room properly. Keep the sensing element away from chemicals and direct sunlight. The AM2302 technical manual describes its operating conditions and handling limits.
NZN's module uses a red breakout with a soldered three-pin header and a fitted pull-up resistor. Read the DAT, VCC and GND labels on that board. A wiring picture for a bare four-pin DHT22 is not the pin layout of this module.
In Arduino IDE, the Adafruit DHTtester example is a useful first check. Select DHT22 in the example and leave at least two seconds between readings. Install its listed dependencies when prompted. DHT data uses a different protocol from DS18B20 1-Wire, even though each uses one data conductor.
DS18B20: put the sensing point on a cable
A DS18B20 probe lets you separate the measuring point from the controller and its heat. NZN offers 1 m, 3 m and 5 m cable options. Choose a run that reaches comfortably without pulling on the cable exit or leaving a large unnecessary coil.
The DS18B20 chip supports multiple addressed sensors on one 1-Wire bus. Its datasheet specifies ±0.5°C accuracy from -10°C to +85°C, with a wider operating range and different error limits outside that band. These are chip specifications; the cable, seal and probe assembly also set limits. The DS18B20 datasheet does not establish the finished probe's food-contact suitability, long-term immersion life or cable temperature rating.
Begin with powered three-wire operation: supply, ground and data, plus the required data pull-up. A 4.7 kΩ pull-up is a normal starting point for a short bus; longer wiring and multiple branches need more care. More resolution also takes more conversion time, so wait for a completed measurement before displaying it.
For the wiring table, example code and common error readings, use our DS18B20 wiring and pull-up guide. Prove one probe works before expanding the bus.
BMP280: pressure first, temperature alongside it
The BMP280 is a barometric pressure sensor with temperature measurement used in its compensation process. It is useful for watching pressure trends and experimenting with altitude calculated from pressure. Its temperature reading can be influenced by the board and surrounding electronics, so placement matters if you also use it as an air thermometer.
BMP280 and BME280 are different parts. BMP280 measures pressure and temperature. It does not measure humidity. A library choice cannot add a sensing function that the chip does not contain.
Altitude is an estimate derived from pressure and a reference pressure. Weather changes can move that estimate while the sensor stays on the same bench. Use a current local reference when absolute height matters; do not treat fine numerical resolution as guaranteed height accuracy. See the BMP280 datasheet for test conditions and interface details.
NZN lists a 3.3 V module and a separate GY-BMP280 module described as accepting 3.3 V or 5 V supply. Select the exact breakout you will wire. A regulator and signal-level conversion perform different jobs: a 5 V supply label alone does not establish that every signal pin tolerates 5 V.
Use a BMP280 library and confirm the I2C address, normally 0x76 or 0x77. The Adafruit BMP280 library reference documents address selection and sensor identification. Check CSB and SDO configuration against the exact breakout rather than leaving pins floating by habit.
Check power and logic before connecting data
| Before power-up | What to check |
|---|---|
| Controller identity | A classic Uno uses 5 V logic. ESP32 boards use 3.3 V GPIO. Identify the exact board and pin labels. |
| Sensor supply | Use the voltage specified for the complete module. Do not apply 5 V to the bare 3.3 V BMP280 breakout. |
| Data voltage | Pull-ups must suit both devices. For a sensor powered at 3.3 V alongside an ESP32, keep the data pull-up at 3.3 V too. |
| Shared reference | Connect controller ground and sensor ground. A loose ground can look like a software problem. |
| Header orientation | Read the silkscreen. Similar-looking boards can arrange VCC, ground and data differently. |
| Bus and library | DHT, 1-Wire and I2C are different interfaces. Use the library and wiring for the part you actually have. |
When connecting a 3.3 V sensor to a 5 V controller, confirm both the input thresholds and pull-up voltages. Use suitable level conversion where needed. The same USB connector on two development boards tells you nothing about their GPIO voltage.
Make the first readings useful
- Start on a short bench connection. Use one sensor, sound connections and the simplest example. Leave networking and displays until the readings are stable.
- Let temperatures settle. Handling the housing warms it. Put it down and allow the sensor, probe and reference thermometer to reach the same conditions.
- Measure the place you care about. A sensor beside the controller describes that warm spot, not necessarily the room. A probe on a wall describes a different location from the centre of the space.
- Change one thing at a time. Extend the cable, move the sensor or add another device separately. That makes a new fault easier to trace.
- Record context with the reading. Note the time, location and sensor identity. A pressure trend or room-temperature log becomes much more useful when readings can be compared consistently.
Common symptoms and the next check
| Symptom | Next check |
|---|---|
| DHT example returns a failed reading | Confirm DHT22 selection, DAT wiring, supply and the interval between reads. |
| DS18B20 reports an error or a repeated startup value | Check power, ground, pull-up and completion of the temperature conversion. Use the dedicated guide for diagnosis. |
| BMP280 cannot be found | Check the BMP280 library, 0x76/0x77 address, SDA/SCL and the breakout's bus-selection pins. |
| BMP280 reports no humidity | That is expected for BMP280. Add a humidity sensor if the project needs it. |
| All readings seem warmer than the room | Move the sensor away from regulators, sunlight and your hands, then allow it to settle. |
Sensor options at NZN
Open the product page for the current price, cable or board options, stock and available technical documents.
DHT22 / AM2302 moduleView options
DS18B20 cabled probeView options
BMP280 3.3 V moduleView options
GY-BMP280 moduleView options
Build around the measurement
Choose humidity for the air, a probe for a remote temperature point, or pressure for weather trends. Then match the wiring to the exact board.
Explore more practical guides