A while ago I wrote a small program for my wife and it has been working fine for that last couple of years.
It's purpose is to control the grey water coming from her washing machine. The water leaves the sink and goes to a tank that holds about 300L. This tank has a water pump connected to the mains power to move the water to some fruit trees in the backyard. To control that pump I wrote a picaxe program that is activated by 3 float switches that determine the level of the water, and turn on the pump as needed and off again when the tank is near emptied. It also has an alarm in case of something not working correctly and the tank over-fills due to a faulty pump, a clogged line or a faulty float switch.
While all of this is working perfectly I would like to use it as a learning exercise by adding on a DRPlayer to give some voice to the program.
I have changed the program slightly by changing the C.1 to be C.5 although I realise that is not ideal as C.5 is a serial pin and input only and really need to be disconnected when this program is in use. I did this because I need a pin to use to send to the DRPlayer.
I have ordered a few drplayers to play with but after ordering them and doing some research I found that I simply don't understand how to program for it.
The MP3 files I can make no problem and I understand the naming rules needed, but how to activate the code has me lost.
The code I am using at present is as follows;
It's purpose is to control the grey water coming from her washing machine. The water leaves the sink and goes to a tank that holds about 300L. This tank has a water pump connected to the mains power to move the water to some fruit trees in the backyard. To control that pump I wrote a picaxe program that is activated by 3 float switches that determine the level of the water, and turn on the pump as needed and off again when the tank is near emptied. It also has an alarm in case of something not working correctly and the tank over-fills due to a faulty pump, a clogged line or a faulty float switch.
While all of this is working perfectly I would like to use it as a learning exercise by adding on a DRPlayer to give some voice to the program.
I have changed the program slightly by changing the C.1 to be C.5 although I realise that is not ideal as C.5 is a serial pin and input only and really need to be disconnected when this program is in use. I did this because I need a pin to use to send to the DRPlayer.
I have ordered a few drplayers to play with but after ordering them and doing some research I found that I simply don't understand how to program for it.
The MP3 files I can make no problem and I understand the naming rules needed, but how to activate the code has me lost.
The code I am using at present is as follows;
Code:
#picaxe 08m2 ; Optional for verification
#no_data ; Optional to speed downloading program modifications
setfreq m8 ; increase frequency
#terminal 9600
pause 2000 ; Recommended to give the terminal time to start up
; C.1 reserved for DRPlayer control
; C.4 Flashing RED LED
; C.0 Pump and BLUE LED, switches on a SSR to power the mains pump
; C.2 top float switch alarm activated if over full
; C.5 bottom float switch, maybe needs disconnecting
; C.3 middle float switch starts the pumping proccess
; GREEN LED connected across power pins with resistor shows power on
start:
Sertxd("Startup",13,10)
low C.0
low C.4
input 2 ;make pin 2 input
if pinC.2 = 1 then alarm ;top float switch
main:
Sertxd("Ready for filling, green LED on",13,10)
DO WHILE pinC.3 = 0
if pinC.2 = 1 then alarm ;top float switch
LOOP
pump:
Sertxd("pumping, blue LED on, middle float on",13,10)
low C.4 ; turn of flashing red LED
DO WHILE pinC.3 = 1 ; middle float switch
high C.0 ; turn pump on, blue LED on
if pinC.2 = 1 then alarm ; top float switch, flashing red LED on
LOOP
DO WHILE pinC.5 = 1 ; bottom float switch, green LED on
LOOP
pump_off:
Sertxd("waiting for level to lower, bottom float on",13,10)
HIGH C.0
for b1 = 1 to 5 ; make a delay to empty tank more before turning off ?pump?
pause 1000
next b1
LOW C.0 ;switch pump off
Sertxd("pump_off, blue LED off, middle float off",13,10)
Sertxd("waiting for level to rise again",13,10)
goto main
alarm:
Sertxd("alarm, flashing red LED on, top float on",13,10)
HIGH C.0 ;switch pump on
HIGH C.4 ;turn on red LED indicator
for b1 = 1 to 2
pause 5000 ; wait a while
next b1
goto pump ; check if still alarm state