Pages: [1]   Go Down
Author Topic: Thermostat logic help, simple  (Read 841 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 46
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

I'm using my arduino to control a fan when the humidity drops below a certain point.

Currently my logic is this with humidity measured every 30 seconds:

Code:
if (humidity < 65)
  {
    digitalWrite(transistorPin, HIGH);
  }
  else
  {
    digitalWrite(transistorPin, LOW);
  }

This is nice because it maints a rock solid 65%, but the fans run almost every 30 seconds which i want to avoid.

I'd like the fans to run more efficently like a furnace in a home where it mantains a range, say turn on when temp < 65* and off when >=68*.  This seems very simple but I am not sure how to approach it in C.

Any advice is appreciated!

Thanks,
Jacob
Logged

CT, USA
Offline Offline
Sr. Member
****
Karma: 2
Posts: 446
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Wouldn't it be just
Code:
if (humidity < 65)
  {
    digitalWrite(transistorPin, HIGH);
  }
  else if (humidity >= 68)
  {
    digitalWrite(transistorPin, LOW);
  }

Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 46
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks!

Given your code, the pin would not go LOW at say, 66?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That's right.
IT will turn on when humidity drops below 65 and then stay on until humidity exceeds 68, and then turn off.
« Last Edit: May 22, 2010, 02:21:30 pm by Zwaf » Logged

Pages: [1]   Go Up
Jump to: