Sensors
Types of Sensors- Basic electronic Device
- Convert a physical quantity/ measurements into electrical signals
- Can be analog or digital
Some commonly used sensors :
- Temperature
- Humidity
- Compass
- Light
- Sound
- Accelerometer
Digital Humidity and Temperature Sensor (DHT)
PIN 1,2,3,4 (from left to right)
- PIN 1-3.3V-5V Power supply
- PIN 2- Data
- PIN 3-Null
- PIN 4- Ground
DHT Sensor Library
- Arduino supports a special library for the DHT11 and DHT22 sensors
- Provides function to read the temperature and humidity values from the data pin
dht.readTemperature()
Connection
- Connect pin 1 of the DHT to the 3.3 V supply pin in the board
- Data pin (pin 2) can be connected to any digital pin, here 12
- Connect pin 4 to the ground (GND) pin of the board
Sketch: DHT_Sensor
Install the DHT Sensor Library
- Go to sketch -> Include Library -> Manage Library
- Search for DHT Sensor
- Select the "DHT sensor library" and install it
No comments:
Post a Comment