PIC Timer for Rainwater Pumps

Thread Starter

bobbutton

Joined May 24, 2011
1
Rainwater Harvesting Pump Delay Unit



I am fairly new to programming PICs, but what to use one for the following project.

If there is anybody that can assist me in writing the program to achieve the following I would very much appreciate it.

I need to build a delay unit for the pumps in my rainwater harvesting system
This is due to the slow reaction of an electrically operated valve and the rippling of the water in the tanks turning the float switches on and off

There are two 12v pumps in the system
The first is a submersible pump fitted in the underground rainwater storage tank. Its job is to prime the main pump which is above ground. I will call this pump :- sump_pump
The second is the main pump which lifts the water to the tanks in the loft. I will call this pump :- main_pump

The Micro Controller I want to use is the PIC 12F629 and
programmed in C

Inputs and Outputs are as follows

Single Input From existing control system

GPIO 2 Pin 5 Quiescent state High

Output Sump_pump Turn on sump pump via a relay
GPIO 4 Pin 3 Quiescent state Low

Output Main_pump Turn on main pump via a relay
GPIO 5 Pin 2 Quiescent state Low

Output LED 1

GPIO 0 Pin 7 Quiescent state Flashing
This LED has two jobs
First Job :- Heartbeat flashing all the time, short on about 2 sec off, shows pic is OK
Second Job :- Show first timer is working, flash at about 1 Hz

Output Pump_Run_Timer Turn on a timer to record pumps run time
GPIO 1 Pin 6 Quiescent state High

Reset Reset PIC

MCLR Pin 4 Quiescent state High

*******************************************************************

Program Sequence

Change of State

1 Quiescent State Input GPIO 2 High
Sump Pump Off Output GPIO 4 Low
Main Pump Off Output GPIO 5 Low
LED Short Flash Output LED GPIO 0 Short Flash
Pump Run Time Off Output GPIO 1 High

2 Start Input Goes Low Input GPIO 2 Goes Low
Output GPIO 4 Low
Output GPIO 5 Low
Flash LED 1 Hz Output LED GPIO 0 Flash 1 Hz
Output GPIO 1 High



3 If at any time Input GPIO 2 Goes High goto 1

4 Wait between 15 and 45 sec "to be set under test"

5 Input GPIO 2 Low
Turn Sump Pump On Output GPIO 4 High
Output GPIO 5 Low
LED Short Flash Output LED GPIO 0 Short Flash
Pump Run Time On Output GPIO 1 Low



6 Wait between 2 and 10 sec "to be set under test"


7 Input GPIO 2 Low
Output GPIO 4 High
Turn Main Pump On Output GPIO 5 High
Output LED GPIO 0 Short Flash
Output GPIO 1 Low

8 Wait between 5 and 45 sec "to be set under test"

9 Input GPIO 2 Low
Turn Sump Pump Off Output GPIO 4 Low
Output GPIO 5 High
Output LED GPIO 0 Short Flash
Output GPIO 1 Low

10 From now on
All the time Input GPIO 2 Stays Low
Output GPIO 4 Low
Output GPIO 5 High
Output LED GPIO 0 Short Flash
Output GPIO 1 Low

11 At this or any other time if Input GPIO 2 Goes High goto 1
 

Lourens

Joined Jul 16, 2012
15
Hi Bob
I have a visual programming system which is ideal for this kind of application. It is based on function blocks, contains a simulator and can monitor/debug the pic application in real time. It is distributed free BUT it is only for PIC18F.
 
Top