Temperature Sensor Fan relay trigger

Hi there!

I have simple sketch that uses an SSD1306 OLED display to readout temperature from a MLX9016 Infrared thermometer. I want to trigger a 12v relay to turn on a set of fans at 110F, however I want to make sure the fans stay on for an entire minute after they’ve been triggered. Because if the temperature fluctuates right at 110F, i dont want sporadic turning-on-turning-off of the fans.

I was thinking of having the fan turn on at 110F, but can only turn off once it reaches 100F, and will continue to stay off until <110F is reached again. But believe theres a simpler way of doing this with interrupts or millis() timer?

Thanks, Mike :slight_smile:

dio300:
I was thinking of having the fan turn on at 110F, but can only turn off once it reaches 100F, and will continue to stay off until <110F is reached again.

that’s about as simple as you can get.

if (temp<=100){//turn fan off}
else if (temp>=110) {//turn fan on}

Or try using millis(); to time how long you want the fan on. See the Blink Without Delay sketch in the IDE.

Alrighty ill give it a try. Thanks again!