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)