In this section, we will learn how to interface our Arduino board with different sensors. We will discuss the following sensors −
- Humidity sensor (DHT22)
- Temperature sensor (LM35)
- Water detector sensor (Simple Water Trigger)
- PIR SENSOR
- ULTRASONIC SENSOR
- GPS
The DHT-22 (also named as AM2302) is a digital-output, relative humidity, and temperature sensor. It uses a capacitive humidity sensor and a thermistor to measure the surrounding air, and sends a digital signal on the data pin.
In this example, you will learn how to use this sensor with Arduino UNO. The room temperature and humidity will be printed to the serial monitor.
The DHT-22 SensorThe connections are simple. The first pin on the left to 3-5V power, the second pin to the data input pin and the right-most pin to the ground.
Technical Details- Power − 3-5V
- Max Current − 2.5mA
- Humidity − 0-100%, 2-5% accuracy
- Temperature − 40 to 80°C, ±0.5°C accuracy
You will need the following components −
- 1 × Breadboard
- 1 × Arduino Uno R3
- 1 × DHT22
- 1 × 10K ohm resistor
Follow the circuit diagram and hook up the components on the breadboard as shown in the image below.
Open the Arduino IDE software on your computer. Coding in the Arduino language will control your circuit. Open a new sketch File by clicking New.
DHT22 sensor has four terminals (Vcc, DATA, NC, GND), which are connected to the board as follows −
- DATA pin to Arduino pin number 2
- Vcc pin to 5 volt of Arduino board
- GND pin to the ground of Arduino board
- We need to connect 10k ohm resistor (pull up resistor) between the DATA and the Vcc pin
Once hardware connections are done, you need to add DHT22 library to your Arduino library file as described earlier.
Comments