Week 7 – Temperature Sensor

Arduino – Week-7


Introduction – Temperature Sensor

A temperature sensor is exactly what it sounds like – a sensor used to measure ambient temperature. This particular sensor has three pins – a positive, a ground, and a signal. This is a linear temperature sensor.

The DHT11 is a basic, ultra low-cost digital temperature and humidity sensor. It uses a capacitive humidity sensor and a thermistor to measure the surrounding air, and spits out a digital signal on the data pin (no analog input pins needed). Its fairly simple to use, but requires careful timing to grab data. The only real downside of this sensor is you can only get new data from it once every 2 seconds, so when using our library, sensor readings can be up to 2 seconds old.
Here are the ranges and accuracy of the DHT11:
⦁ Humidity Range: 20-90% RH
⦁ Humidity Accuracy: ±5% RH
⦁ Temperature Range: 0-50 °C
⦁ Temperature Accuracy: ±2% °C
⦁ Operating Voltage: 3V to 5.5V

CONNECTING A THREE PIN DHT11:

Arduino Code

include<dht.h>

dht DHT;

define DHT11_PIN 7

void setup(){
Serial.begin(9600);
}
void loop()
{
int chk = DHT.read11(DHT11_PIN);
Serial.print(“Temperature = “);
Serial.println(DHT.temperature);
Serial.print(“Humidity = “);
Serial.println(DHT.humidity);
delay(1000);
}

Link to Library
http://www.circuitbasics.com/wp-content/uploads/2015/10/DHTLib.zip
Real World Application
Building climate control systems use a temperature sensor to monitor and maintain their settings.