Project Autus - Automated Plant Chamber
Fork of keypad_test by
Autus
This is the codebase accompanying the project Autus.
Autus is an automated growth chamber for plants.
Features
Control Humidity inside chamber wrt to external humidity. Control Temperature inside chamber. ( Peltier Heaters/Coolers ) Water and shower plants. Control soil humidity. Monitor water tanks level (Load Cell)
Code Base Features
Fixed timing and CRC for DHT-11 Sensor. Fixed OneWire bug for ds18b20
Cyclic Executive Scheduler with Priority. Async IPC framework for PC App over bluetooth
Fake RTC systick, I was having some trouble with the on board rtc.
Revision 57:7ab93ed49b70, committed 2014-04-14
- Comitter:
- umairaftab
- Date:
- Mon Apr 14 19:18:14 2014 +0000
- Parent:
- 56:d1e81ca74f22
- Commit message:
- Cosmetic Changes, Menus added
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon Apr 14 16:10:19 2014 +0000 +++ b/main.cpp Mon Apr 14 19:18:14 2014 +0000 @@ -113,7 +113,7 @@ void printer_print_values(){ - printf("\r****Autus Sensor Values****\r"); + //printf("\r****Autus Sensor Values****\r"); wait(1); printer.printf("Chamber Temp: %4.2f\r",inside_temp); wait(1); @@ -538,6 +538,7 @@ lcd.cls(); lcd.locate(0,0); lcd.printf("Watering Plants"); + wait(1); waterplants(); @@ -688,6 +689,26 @@ if(keypad_value == 78){ printer_print_values(); } + if(keypad_value ==86){ + pumps(true,false,false,false); + wait(2); + pumps(false,false,false,false); + } + if(keypad_value ==80){ + pumps(false,true,true,false); + wait(2); + pumps(false,false,false,false); + } + if(keypad_value ==83){ + pumps(false,false,false,true); + wait(2); + pumps(false,false,false,false); + } + if(keypad_value ==77){ + cycle_air_on(); + wait(2); + cycle_air_off(); + } //printf("%d\n\r",keypad_value); // -> Key pressed @@ -765,9 +786,20 @@ float pelt_inside_temp =0; bool exit_pelt = false; + float dsen_temp_out_prev=0; pelt_inside_temp = get_air_temp_inside(0); bool read_temp1_valid=false; bool read_temp2_valid=false; + + while(!read_temp2_valid){ + readTemp(0); + wait(0.1); + if(temp>0){ + read_temp2_valid = true; + } + } + //readTemp(0); + dsen_temp_out_prev=temp; while (exit_pelt == false){ pelt_inside_temp = get_air_temp_inside(0); @@ -799,6 +831,7 @@ printf("Outside Temp:%2.1f\n\r",dsen_temp_out); } if (dsen_temp_in>=desire_temp) { + read_temp1_valid=false; read_temp2_valid=false; peltier(true,true,false,true,0); @@ -829,7 +862,7 @@ lcd.locate(0,0); lcd.printf("Pelt TEMP LIMIT"); lcd.locate(0,1); - lcd.printf("Pi %2.1 Po%2.1f",dsen_temp_in,dsen_temp_out); + lcd.printf("Pin:%2.1 Pout:%2.1f",dsen_temp_in,dsen_temp_out); exit_pelt = true; pelt_overheat = true; } @@ -838,7 +871,13 @@ lcd.locate(0,0); lcd.printf("Air Temp %4.2f",pelt_inside_temp); lcd.locate(0,1); - lcd.printf("Pi%2.1f Po%2.1f",dsen_temp_in,dsen_temp_out); + if(!(dsen_temp_out>0)){ + dsen_temp_out = dsen_temp_out_prev ; + } + else{ + dsen_temp_out_prev = dsen_temp_out ; + } + lcd.printf("Pin:%2.1f Pout:%2.1f",dsen_temp_in,dsen_temp_out); printf("Pi%2.1f Po%2.1f\n\r",dsen_temp_in,dsen_temp_out); wait(15); if ( (pelt_inside_temp-5<=desire_temp_air) && (pelt_inside_temp+5>=desire_temp_air) ){