AOST: KY-015 Temperature and Humidity Sensor

 KY-015

TEMPERATURE AND HUMIDITY SENSOR


Hello there! Ever wanted to find out the temperature without the use of ANY thermometer? You can just use the Arduino Temperature and Humidity sensor, that can find out the temperature and humidity. This is also called a KY-015 sensor. The sensor is made of electrodes, which can detect slight changes in the atmosphere relying on the electrical currents in the air. This can be translated as the humidity. The temperature can be figured out in a similar way. The KY-015, also called as the DHT11 or DHT22, has three important outlets. The ground(GND), the Signal pin, and the VCC pin. Now, let's dive in into the amazing world of the KY-015!



THE WIRING

This module doesn't need much materials. It needs:
  • An arduino board(We are using an UNO).
  • A breadboard.
  • Three male-to-male jumper wires.
  • A DHT11 or DHT22 sensor. (We use a DHT11 in this version).
  • A computer with the Arduino IDE.
  • A TYPE-B USB connector to connect to the Arduino.
Now, here is the wiring:
As you can see, you can connect the VCC pin to the 5V pin, the GND pin to the Arduino's GND pin, and the Signal pin to pin 2.



The Code

The code for this project is relatively simple. You just need to install the DHT library on your IDE. You must go to the Sketchbook>Include Library>Add .ZIP Library and search for the DHT library. The code is below.



#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); }



(Source: Circuitbasics.com)

This blog and experiment is inspired from Circuitbasics.com  and written by Avviin Chandrasekaran, 8th Grade Student at Kennedy Middle School, Cupertino
California.

Avviin is interested in learning Science and computer concepts and programming.
He was doing Scratch programming from 7 year old and made multiple Youtube
Videos.

Comments