Showing posts with label KY-015. Show all posts
Showing posts with label KY-015. Show all posts

Friday, September 9, 2016

Arduino_KY-015_Temperature_and_humidity_sensor_module

KY-015 37-1 Temperature and humidity sensor module (DHT11)

Hardware

Connections between the Arduino for this temperature and humidity sensor from the 37in1 sensor kit with the KY-015 DHT11 module
  • Arduino pin 8 --> Pin S module
  • Arduino GND --> Pin - module
  • Arduino +5    --> Pin Middle

Program

The temperature and humidity values are displayed on the Serial monitor (To use the Codebender Serial monitor you need to connect it !)

Serial monitor


More info





// ** Arduino KY-015 Temperature and humidity sensor module ** /* ** HARDWARE Arduino pin 8 --> Pin S module Arduino GND --> Pin - module Arduino +5 --> Pin Middle DHT11 Temperature and humidity sensor */ int DHpin = 8; byte dat [5]; byte read_data () { byte data; for (int i = 0; i < 8; i ++) { if (digitalRead (DHpin) == LOW) { while (digitalRead (DHpin) == LOW); // wait for 50us delayMicroseconds (30); // determine the duration of the high level to determine the data is '0 'or '1' if (digitalRead (DHpin) == HIGH) data |= (1 << (7 - i)); // high front and low in the post while (digitalRead (DHpin) == HIGH); // data '1 ', wait for the next one receiver } } return data; } void start_test () { digitalWrite (DHpin, LOW); // bus down, send start signal delay (30); // delay greater than 18ms, so DHT11 start signal can be detected digitalWrite (DHpin, HIGH); delayMicroseconds (40); // Wait for DHT11 response pinMode (DHpin, INPUT); while (digitalRead (DHpin) == HIGH); delayMicroseconds (80); // DHT11 response, pulled the bus 80us if (digitalRead (DHpin) == LOW); delayMicroseconds (80); // DHT11 80us after the bus pulled to start sending data for (int i = 0; i < 4; i ++) // receive temperature and humidity data, the parity bit is not considered dat[i] = read_data (); pinMode (DHpin, OUTPUT); digitalWrite (DHpin, HIGH); // send data once after releasing the bus, wait for the host to open the next Start signal } // *** SETUP *** void setup () { Serial.begin (9600); pinMode (DHpin, OUTPUT); } // *** LOOP *** void loop () { start_test (); Serial.print ("Current humdity ="); Serial.print (dat [0], DEC); // display the humidity-bit integer; Serial.print ('.'); Serial.print (dat [1], DEC); // display the humidity decimal places; Serial.println ('%'); Serial.print ("Current temperature ="); Serial.print (dat [2], DEC); // display the temperature of integer bits; Serial.print ('.'); Serial.print (dat [3], DEC); // display the temperature of decimal places; Serial.println ('C'); delay (700); }

Monday, August 22, 2016

ESP8266_KY015


I already had tested an DHT11 module with the ESP8266. Now i also tested the DHT11 temperature / humidity sensor on the 37in1 module KY015 with ESP8266Basic

Hardware connections

-         GND
middle VCC 3V3
S        Signal line - ESP8266 Pin 5

Program

' TestKY015.bas
PinDHT11 = 5

DHT.SETUP( 11 , PinDHT11 )
cls

print "<br>Pin : " & PinDHT11 & "<br>Time : " & time() & "<br>Temperature : " & DHT.TEMP() & "<br>Humidity :" & DHT.HUM()

end

Monday, July 11, 2016

ESP8266 Basic DHT11 Temperature and humidity


I tested a DHT11 Temperature and Humidity sensor
with my ESP8266 board flashed with ESP8266Basic.

For this test i did NOT use the KY-015 Temperature and humidity sensor module (From the Arduino 37in1SensorKit ) with a DHT11. However that module should also work fine.
There are also some ESP8266 development modules that contain a DHT11 module.
I wanted to use a  "bare" DHT11 on my testmodule to later use this in a hardware project.
ESP8266Basic has some commands for the  DHT11 Temperature and Humidity sensor
On this module i found the labels for the pins GPIO3 and GPIO5 are swapped.  (  also when using the  DHT11 ).
With the program below the Temperature and humidity are printed one time

PinDHT11 = 4
'  GPIO5 = 4    GPIO4 = 5 with my test board !

DHT.SETUP( 11 , PinDHT11 )
cls

print "<br>Pin : " & PinDHT11 & "<br>Time : " & time() & "<br>Temperature : " & DHT.TEMP() & "<br>Humidity :" & DHT.HUM()

end