Swimming Pool Auto Controller Project 1
June 6, 2013 § 5 Comments
Explanation of the codes :
The ON and Off is defined here because those used in codes for better understanding.
And the pin definitions are arduino pin definitions that you can understand more better which pin is used for what purposes.
#define ON 1 #define OFF 0 #define TEMPERATURE_LIMIT 31 ///PIN DEFINITIONS #define OVERFLOW_LEVEL 0 #define LOW_LEVEL 1 #define HIGH_LEVEL 2 #define PUMP 3 ............ ...........
Then including the header files, and declaring and initializing the variables required.
TimeRoutine is a integer two dimensional array that holds the value of predefined time routine(the time when the pool will be cleaned on different weekdays) in it. later we will use a function to retrieve the times and compare with current time and do the pool water cleaning event.
printWeekday is a easy function that will print to 16×2 character LCD the weekday of the integer parameter that will be provided when calling.
checkButtons is a function that is used to debounce the buttons and set the current time(weekday, hour, minute). And the function is somewhat crappy. I need to work on it in the future.
getTemperature is a function that is used to read the temperature value from the one-wire temperature sensor DS18B20 in hexadecimal value. then convert it to decimal degree celcious value and store in in the temp variable. I have not personally written the codes. The function and its corresponding library (onewire.h) is downloaded from the net.
WaterFillingMode is a function that have the statements of the behavior of the pool when water is filling in it.
WaterCleaningMode is a function that have the statements of the behavior of the pool when water cleaning/draining.
ReadyMode is a function that have the statements of the behavior of the pool when pool is ready for swimming.
Ok, enough, if u r a programmer, u can understand the further codes and if u r not, the flowcharts will come later for your better understanding of the codes.