Controls both heat and pump pressure based on a temperature probe and a scale- ie, it does temperature and flow profiling. Should work with any vibratory pump machine.
Dependencies: Adafruit_RTCLib FastPWM TSI mbed
Revision 6:56b205b46b42, committed 2014-07-05
- Comitter:
- jzeeff
- Date:
- Sat Jul 05 20:52:06 2014 +0000
- Parent:
- 5:0393adfdd439
- Commit message:
- Stable version
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 0393adfdd439 -r 56b205b46b42 main.cpp --- a/main.cpp Mon Apr 14 20:35:30 2014 +0000 +++ b/main.cpp Sat Jul 05 20:52:06 2014 +0000 @@ -72,7 +72,7 @@ // these probably don't need to be changed if you are using a Gaggia Classic #define AD_PER_DEGREE 43 // how many A/D counts equal a 1 degree C change -#define AD_PER_GRAM 76.70 // how many A/D count equal 1 gram of weight +#define AD_PER_GRAM 56.0 // how many A/D count equal 1 gram of weight #define CLOSE 60 // how close in A/D value before switching to learned value control #define GAIN .01 // how fast to adjust heat(eg 1% percent per 2.7s control period) #define INITIAL_POWER .03 // initial guess for steady state heater power needed (try .03 = 3%) @@ -81,8 +81,8 @@ #define STEAM_TEMP 28000 // boiler temp while steaming #define ROOM_TEMP 21707 // A/D value at standard ambient room temp 23C #define MAX_ROOM_TEMP (ROOM_TEMP + (10 * AD_PER_DEGREE)) // above this means ambient isn't valid -#define SLEEP_PERIOD (4*3600) // turn off heat after this many seconds -#define WAKEUP_TIME 12 // time in 0-23 hours, GMT to wake up. 99 to disable. Example: 12 for noon GMT +#define SLEEP_PERIOD (6*3600) // turn off heat after this many seconds +#define WAKEUP_TIME 11 // time in 0-23 hours, GMT to wake up. 99 to disable. Example: 12 for noon GMT #define TARGET_TEMP ((TARGET_OHMS*65536)/(TARGET_OHMS+2200)) // how hot the boiler should be in A/D #define debug if (1) printf // use if (1) or if (0) @@ -144,14 +144,16 @@ led_color(OFF); - wait(1); // let settle + wait(1); // let settle ambient_temp = read_temp(BOILER); // save temp on startup -#if 0 - DateTime compiled(__DATE__, __TIME__); // to set RT clock initially - rtclock.adjust(compiled); -#endif - DateTime dt = rtclock.now(); // check clock value + DateTime dt = rtclock.now(); // check clock value + if (dt.year() > 2090 || dt.year() < 2014) { + DateTime compiled(__DATE__, __TIME__); // to set RT clock initially + rtclock.adjust(compiled); + DateTime dt = rtclock.now(); // check again + } + debug("RTC = %u/%u/%02u %2u:%02u:%02u\r\n" ,dt.month(),dt.day(),dt.year() ,dt.hour(),dt.minute(),dt.second()); @@ -159,10 +161,10 @@ debug("starting A/D value/temp = %u %u\r\n",ambient_temp,read_temp(GROUP)); - pump = 0; // duty cycle. + pump = 0; // initial duty cycle (pump off) pump.period_us(410); // period of PWM signal in us - if (ambient_temp < MAX_ROOM_TEMP) + if (ambient_temp < MAX_ROOM_TEMP) // check for cold boiler steam(7 * 60); // do accelerated warmup by overheating for awhile // loop forever, controlling boiler temperature