Go Down

Topic: How to activate relay with DHT 11 (Read 671 times) previous topic - next topic

GG_Beta

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  :)


robtillaart


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

You must built in some hysteresis in your sketch
Code: (concept only) [Select]

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
}
Rob Tillaart

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

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy