Go Down

Topic: Thermostat logic help, simple (Read 1 time) previous topic - next topic

.jacob

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: [Select]
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

AlphaZeta

Wouldn't it be just
Code: [Select]

if (humidity < 65)
 {
   digitalWrite(transistorPin, HIGH);
 }
 else if (humidity >= 68)
 {
   digitalWrite(transistorPin, LOW);
 }


.jacob

Thanks!

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

Zwaf

#3
May 22, 2010, 09:21 pm Last Edit: May 22, 2010, 09:21 pm by Zwaf Reason: 1
That's right.
IT will turn on when humidity drops below 65 and then stay on until humidity exceeds 68, and then turn off.

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