Project Autus - Automated Plant Chamber

Dependencies:   TextLCD mbed

Fork of keypad_test by Plamen Totev

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) /media/uploads/umairaftab/frdm_-_new_page1.png

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.

/media/uploads/umairaftab/download.png

Revision:
14:72176f1e4907
Parent:
13:6bf09cd68013
Child:
17:0ff7385db570
--- a/main.cpp	Sat Apr 12 11:15:20 2014 +0000
+++ b/main.cpp	Sat Apr 12 20:29:37 2014 +0000
@@ -26,6 +26,9 @@
 
 #include "rtcimp.h"
 
+#include "weight.h"
+#include "weight_pindefs.h"
+
 #include <string>
 using namespace std;
 
@@ -89,7 +92,11 @@
     calc_soil_humid_values(); //values in soil1_humid and soil2_humid perecentages
     soil1_humidity = soil1_humid ;
     soil2_humidity = soil2_humid ;
-    printf("%4.2f \n\r",soil1_humidity);
+    //printf("%4.2f \n\r",soil1_humidity);
+    //READ LOAD SENSOR
+    read_weight();
+    calc_weight();
+    weight_sensor = weight1; 
 }
 
 //****************************Functions that perform tasks**************************************
@@ -98,11 +105,15 @@
     
     
     if(startup_flag == true){
-        //call for pump function 
+        //call for pump function
+        
         watered_plant1 = true;
         watered_plant1_time = hour ; 
         watered_plant2 = true;
         watered_plant2_time = hour ; 
+        pumps(true,true,true,false); 
+        wait(5.0);
+        pumps(false,false,false,false);
     }
     else{
         
@@ -110,11 +121,17 @@
             //enable pump1
             watered_plant1 = true;
             watered_plant1_time = hour ;
+            pumps(true,true,true,false); 
+            wait(5.0);
+            pumps(false,false,false,false);
         }
         if( (soil2_humid < setpoint_soil_humid2) || (watered_plant2 == false) ){ 
             //enable pump2
             watered_plant2 = true;
             watered_plant2_time = hour ;
+            pumps(true,true,true,false); 
+            wait(5.0);
+            pumps(false,false,false,false);
         }
     }
     //Make sure it is watered at least every x hours in case soil humid doesnt work
@@ -137,8 +154,10 @@
     if( !( (setpoint_air_humidity+window_f > inside_humidity) && (setpoint_air_humidity-window_f < inside_humidity) ) ){
     
         //Turn on Air humidity fan 
+        pumps(false,false,false,true);
         wait(5);
         //Turn off Air humisity fan
+        pumps(false,false,false,false);
     }   
 }
 
@@ -150,7 +169,7 @@
     //turn of fan 
     
 }
-//LCD TIMEOUT FUNCTION
+//**********************************LCD TIMEOUT FUNCTION*********************************
 void lcd_timeout_check(){
     
     if(lcd_timeout.read()>LCD_TIMEOUT_VALUE){
@@ -158,7 +177,7 @@
         }
     
 }
-//SETTINGS UI 
+//***************************************SETTINGS UI************************************* 
 void ui_settings(){
     
     lcd.cls();
@@ -170,6 +189,7 @@
     bool exit_settings=false;
     
     //disable peltier
+    peltier(false,false,false,false,0);
     
     wait(2);
     string menu[4];
@@ -340,6 +360,12 @@
                 ui_settings();
                 wait(5);
         }
+        
+        if(keypad_value_in ==100){
+            ui_screen1();
+            wait(5); 
+            
+        }
 }
 
 
@@ -349,7 +375,8 @@
 void disable_everything(){
     
     //Disable peltier,vac,fans,pumps,lights.
-    
+    pumps(false,false,false,false);
+    peltier(false,false,false,false,0);
 }
 
 
@@ -438,13 +465,15 @@
     lcd_timeout.reset();
     wait(5);
     
-    startup_flag = false ;  
+    startup_flag = false ;
+    timer1ms.attach(&timer1, 0.001); //interrupt attached function(timer) with interval (1 ms)  
     while(1) {
        
-        wait(1.5);
+        
         //FOR BUZZER
-        timer1ms.attach(&timer1, 0.001); //interrupt attached function(timer) with interval (1 ms)
+        
         keypad_value = Keypad();
+        wait(0.5);
         //timer1ms.detach();
         //something
         lcd_timeout_check();