Pages: [1]   Go Down
Author Topic: How to activate relay with DHT 11  (Read 442 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi friends!
Im buliding a small green house and I would like to use a DHT11 to monitor the temperature and if it raises from 30 C activate a relay to turn off the heat source.
I know how to do this with the lm34dz  but I just cant seem to figure out how to do it with the DHT 11 and cant find info around the web, I hope you could please help me do
I would be extremly helpful, the temperature where I live is dropping and i eould like to keep my plants alive.
Please help me friends.
Thanks in advance  smiley
Logged

Helsingborg, Sweden
Offline Offline
Sr. Member
****
Karma: 24
Posts: 499
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Tutorial here:
http://learn.adafruit.com/dht
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 217
Posts: 13705
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


- http://playground.arduino.cc/Main/DHTLib -

You must built in some hysteresis in your sketch
Code: (concept only)
int relayState = LOW;
void loop()
{
  temperatue = .... ; // see lib above.
  if ((temperature > 30) && (relayState == LOW)) relayState = HIGH;
  if ((temperature < 25) && (relayState == HIGH)) relayState = LOW;
  digitalWrite(RelayPin,  relayState );
 
  .. other code here
}
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Pages: [1]   Go Up
Jump to: