Go Down

Topic: Thermostat with relay output (Read 228 times) previous topic - next topic

303Escape

Sep 18, 2018, 06:25 am Last Edit: Sep 18, 2018, 06:43 am by 303Escape
I have a project that I can't seem to get anywhere on. I am willing to pay.

I am using a nano and either a KY-028 or KY-015 (whichever would be best for this project) temperature sensor. I would like it to read the ambient temperature in the room and when the temperature reaches 10 degrees higher I want it to trigger an output. It doesn't need to display on an LCD but I would like to monitor it in the serial monitor.

wvmarle

10 degrees higher than what?

How long to keep the relay on?

For temperature I'd use a DS18B20 sensor. Very easy to use and pretty accurate.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

303Escape

10 degrees higher than whatever the room temperature is. I'm looking for a drastic sudden change. The relay can stay on for 5 seconds after the sudden change. 

wvmarle

You measure the ambient temperature in the room, then want to do something when that room's temperature is 10 degrees higher than the ambient temperature in that room.

Doesn't make sense at all.

Also, do define "drastic sudden change" in numbers.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

303Escape

How does it not make sense? You measure the rooms temperature which will normally be between 75-78 degrees F. If the temp suddenly gets to 85-88 F trigger the output for 5 seconds.

wvmarle

Well, it doesn't make sense to compare the temperature of a room with the temperature of the same room. That's what you were saying.

But what you meant is a change in temperature over time, which is an entirely different thing.

Now define in absolute numbers what event should trigger the relay. Temperature above 85°? Above 88°? For how long above that temperature?

Or would that be a "sudden" increase by 10° from a previous temperature? How long takes "sudden"? How about if the temperature rises slower than your "sudden" limit, making it not "sudden" and as such does not trigger your relay?

What to do with the relay if after that 5 seconds the temperature is still too high?

Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

303Escape

Maybe it would help if I explain my application. This for an escape room. Players will use a blow dryer to raise the temperature on the thermostat. Therefore, I would like the thermostat to constantly be reading the temperature in the room. It is looking for a jump of whatever the room temp is to 10 degrees higher. This will most likely happen in a matter of a few seconds. Once it reaches the target temp it triggers an output for 5 seconds. It will slowly start to drop back to room temp once the blow dryer is no longer being used on it. It is again looking at room temp and looking for a 10 degree jump (for the next guests in the room). Hopefully that helps.

patduino

Hi 303 - I've done that before .  I'll PM you with details.

Pat.
There are 10 types of people in the world, those who understand binary, and those that don't.

wvmarle

Much easier: just have it trigger when the probe goes well above body temperature, in F that would be 110-120 or so. A hair dryer should have no problem producing that kind of heat.

Then I just looked up your sensors as I don't know the types: they're based around an NTC. You can also simply wire up a voltage divider of a 10k NTC with 10k fixed resistor, connect the mid point to an analog port, and do a quick calibration on at which value to trigger your relay. Easy, cheap and very reliable.

Code for this is dead easy:

Code: [Select]

void loop() {
  if (analogRead(A0) > thresholdValue) { // can be greater or less than a value - depends on wiring and NTC and required temperatures)
    digitalWrite(relayPin, HIGH); // relay on.
    delay(5000); // Wait for 5 seconds.
    digitalWrite(relayPin, LOW); // relay off.
    delay(600000); // 10 minutes wait to let it cool down again.
  }
}
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

patduino

... or just use a thermostat that enables a time-delay relay. Just no serial output.
There are 10 types of people in the world, those who understand binary, and those that don't.

Go Up