UnoR3 Timeout Timer

Hello:
I'm trying to control a Hot Water Recirculating Pump. What I need is to add a 3 minute Timeout timer to prevent over run. If I have to I'll run a 555 on the side.

Attached is the sketch. I'll appreciate any suggestions.

/*

  • Push Button & Temp Sensor *

  • This circuit is designed to control a Hot Water Recirculating Pump.

  • Push button2 calls for service and the led & rly turn on and stay ON
    until the water temp reaches 100 degF.

The circuit:

  • LED attached frm pin 13 to Gnd [w/ current limiting resistor]

  • RLY attached frm pin 12 to Gnd [w/ interposing transistor]

  • pushbutton2 attached frm pin 2 [internal pullup] to Gnd

  • pushbutton4 attached frm pin 4 [internal pullup] to Gnd

  • Temp Sensor attached frm pin A0 to Gnd [LM34 swings from 0 to 5000 mV,
    the target is 1000 mV]

  • PB2 starts the HW pump. When the temp reaches 100 degF then the pump
    turns off. PB4 is for emergency shut down.

  • A time-out timer needs to be designed into this circuit, to prevent
    over run if the HW Heater flames out.

  • Note: on most Arduinos there is already an LED on the board
    attached to pin 13.

created 2005
by DojoDave http://www.0j0.org
modified 30 Aug 2011
by Tom Igoe

  • Modified by Pat Chu, 10.04.13 *

Part of this example code is in the public domain.

*/

// constants won't change. They're used here to
// set pin numbers:
const int button2Pin = 2; // the number of the pushbutton pin
const int button4Pin = 4;
const int ledPin = 13; // the number of the LED pin
const int rlyPin = 12; // Relay Pin
const int analogPin = A0; // Analog Pin

// variables will change:
int button2State = 1; // variable for reading the pushbutton status
int button4State = 1;
int analogState = 0;

void setup() {
// initialize the LED pin as an output:
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, LOW);
pinMode(rlyPin, OUTPUT);
digitalWrite(rlyPin, LOW);
// initialize the PB pins as an inputs:
pinMode(button2Pin, INPUT_PULLUP);
pinMode(button4Pin, INPUT_PULLUP);
}

void loop(){
// read the state of the pushbutton value:
button2State = digitalRead(button2Pin);
// read the state of the pushbutton value:
button4State = digitalRead(button4Pin);
// read analog pin0
analogState = analogRead(analogPin);

// check if the pushbutton is pressed.
// if it is, the buttonState is LOW:
if (button2State == LOW) {
// turn LED on:
digitalWrite(ledPin, HIGH);
digitalWrite(rlyPin, HIGH);
}

else {

// check if the pushbutton is pressed.
// if it is, the buttonState is LOW:
if (button4State == LOW){
// turn LED off:
digitalWrite(ledPin, LOW);
digitalWrite(rlyPin, LOW);
}

else

// check if analog input is >= 205, [trial & error].
if (analogState >= 205){

// turn LED off:
digitalWrite(ledPin, LOW);
digitalWrite(rlyPin, LOW);
}

}
}

Thank you.
Pat

PB5_100813.ino (2.71 KB)

Look at the 'blink without delay' example.

Hi, just a suggestion, your emergency stop button should be separate to the arduino.
Make the emergency switch break the power supply to the pump motor.
That way if the arduino locks up or some hardware problem, you are removing the supply and the motor has to stop.

Also a circuit diagram of your project will help us help you.

How are you driving the motor from the arduino.

Tom.... :slight_smile:

Henry_Best:
Look at the 'blink without delay' example.

Henry, Thanks for the suggestion. I was able to use millis to make the time out timer work.
Aloha,
Pat

TomGeorge:
Hi, just a suggestion, your emergency stop button should be separate to the arduino.
Make the emergency switch break the power supply to the pump motor.
That way if the arduino locks up or some hardware problem, you are removing the supply and the motor has to stop.

Also a circuit diagram of your project will help us help you.

How are you driving the motor from the arduino.

Tom.... :slight_smile:

Tom, thanks for the suggestion. I will add an external switch.
Aloha,
Pat

I suggest you also use the watchdog timer, to reset the Arduino if it locks up (in case the pump it turned on at the time).

dc42:
I suggest you also use the watchdog timer, to reset the Arduino if it locks up (in case the pump it turned on at the time).

dc42: Thanks for the idea. I don't know how to access the watchdog timer but I could use the Time Out timer to Digital Out and jumper over to the reset pin. I have to do more reading.
Aloha,
Pat

Hello:

I thank all of you for your help and suggestions.

Attached is the latest design. It passed all the tests.

Aloha,
Pat

HW_Pump_Control_102613.ino (3.67 KB)