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

Committer:
umairaftab
Date:
Sun Apr 13 09:06:37 2014 +0000
Revision:
36:ce0ca02a8253
Parent:
30:417e8ba439ff
Cycle Air Functions,Definitions,Callbacks added.; Keypad Map Adjusted.; Bluetooth Serial Interrupt Callback Method added.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
umairaftab 3:087ce66714c0 1 #include "mbed.h"
umairaftab 7:1d691f81d455 2 //#include "keypad.h"
umairaftab 4:8d1df60ef3c3 3 //#include "globalvalues.h"
umairaftab 3:087ce66714c0 4 #include "ui.h"
umairaftab 4:8d1df60ef3c3 5 #include "airhumidity.h" //for error variables
umairaftab 3:087ce66714c0 6
umairaftab 3:087ce66714c0 7 char lcd_keypad_value ;
umairaftab 4:8d1df60ef3c3 8 int temp_unit = 0; //0 for celcius 1 for faren 2 for kelvin
umairaftab 4:8d1df60ef3c3 9 char temp_unit_char = 'C';
umairaftab 4:8d1df60ef3c3 10
umairaftab 4:8d1df60ef3c3 11 float outside_humidity;
umairaftab 4:8d1df60ef3c3 12 float outside_temp;
umairaftab 4:8d1df60ef3c3 13 float outside_dewpoint;
umairaftab 4:8d1df60ef3c3 14
umairaftab 4:8d1df60ef3c3 15 float inside_humidity;
umairaftab 4:8d1df60ef3c3 16 float inside_temp;
umairaftab 4:8d1df60ef3c3 17 float inside_dewpoint;
umairaftab 4:8d1df60ef3c3 18
umairaftab 4:8d1df60ef3c3 19 float soil1_humidity;
umairaftab 4:8d1df60ef3c3 20 float soil2_humidity;
umairaftab 4:8d1df60ef3c3 21
umairaftab 14:72176f1e4907 22 float weight_sensor;
umairaftab 14:72176f1e4907 23
umairaftab 12:b3137bb72ef7 24 unsigned int peltierout;
umairaftab 12:b3137bb72ef7 25 unsigned int peltierin;
umairaftab 12:b3137bb72ef7 26 float peltierin_temp;
umairaftab 12:b3137bb72ef7 27 float peltierout_temp;
umairaftab 12:b3137bb72ef7 28
umairaftab 12:b3137bb72ef7 29 unsigned int red_light_value;
umairaftab 12:b3137bb72ef7 30 unsigned int blue_light_value;
umairaftab 12:b3137bb72ef7 31 unsigned int green_light_value;
umairaftab 4:8d1df60ef3c3 32 //Set Temperature Unit
umairaftab 4:8d1df60ef3c3 33 void set_temp_unit(){
umairaftab 4:8d1df60ef3c3 34 if(temp_unit == 1){
umairaftab 4:8d1df60ef3c3 35 temp_unit_char = 'F';
umairaftab 4:8d1df60ef3c3 36 }
umairaftab 4:8d1df60ef3c3 37 else if(temp_unit == 2){
umairaftab 4:8d1df60ef3c3 38 temp_unit_char = 'K';
umairaftab 4:8d1df60ef3c3 39 }
umairaftab 4:8d1df60ef3c3 40 else{
umairaftab 4:8d1df60ef3c3 41 temp_unit_char = 'C';
umairaftab 4:8d1df60ef3c3 42 }
umairaftab 4:8d1df60ef3c3 43 }
umairaftab 3:087ce66714c0 44
umairaftab 3:087ce66714c0 45 void ui_startup(){
umairaftab 5:bf31a58915a5 46
umairaftab 4:8d1df60ef3c3 47 lcd.cls();
umairaftab 3:087ce66714c0 48 lcd.setCursor(TextLCD::CurOff_BlkOn);
umairaftab 3:087ce66714c0 49 lcd.locate(0,0);
umairaftab 3:087ce66714c0 50 lcd.printf("Project Autus");
umairaftab 3:087ce66714c0 51 lcd.locate(0,1);
umairaftab 3:087ce66714c0 52 lcd.printf("Initializing Machine");
umairaftab 3:087ce66714c0 53 }
umairaftab 3:087ce66714c0 54
umairaftab 4:8d1df60ef3c3 55 void ui_screen1() {
umairaftab 5:bf31a58915a5 56
umairaftab 5:bf31a58915a5 57 set_temp_unit();
umairaftab 25:a6d1eaf2041c 58 //lcd.cls();
umairaftab 4:8d1df60ef3c3 59 lcd.setCursor(TextLCD::CurOff_BlkOn);
umairaftab 4:8d1df60ef3c3 60 lcd.locate(0,0);
umairaftab 4:8d1df60ef3c3 61 lcd.printf("T: %3.1f%c",inside_temp,temp_unit_char);
umairaftab 4:8d1df60ef3c3 62 lcd.printf(" H: %3.1f",inside_humidity);
umairaftab 4:8d1df60ef3c3 63 lcd.locate(0,1);
umairaftab 11:f9ffd5ab7e94 64 lcd.printf("S1: %4.2f",soil1_humidity);
umairaftab 11:f9ffd5ab7e94 65 lcd.printf(" S2: %4.2f",soil2_humidity);
umairaftab 4:8d1df60ef3c3 66 }
umairaftab 4:8d1df60ef3c3 67
umairaftab 5:bf31a58915a5 68 void ui_screen2() {
umairaftab 5:bf31a58915a5 69
umairaftab 5:bf31a58915a5 70 set_temp_unit();
umairaftab 5:bf31a58915a5 71 lcd.cls();
umairaftab 5:bf31a58915a5 72 lcd.setCursor(TextLCD::CurOff_BlkOn);
umairaftab 5:bf31a58915a5 73 lcd.locate(0,0);
umairaftab 5:bf31a58915a5 74 lcd.printf("iT: %3.1f%c",inside_temp,temp_unit_char);
umairaftab 5:bf31a58915a5 75 lcd.printf(" iH: %3.1f",inside_humidity);
umairaftab 5:bf31a58915a5 76 lcd.locate(0,1);
umairaftab 5:bf31a58915a5 77 lcd.printf("oT: %3.1f%c",outside_temp,temp_unit_char);
umairaftab 5:bf31a58915a5 78 lcd.printf(" oH: %3.1f",outside_humidity);
umairaftab 5:bf31a58915a5 79 }
umairaftab 5:bf31a58915a5 80
umairaftab 5:bf31a58915a5 81 void ui_screen3() {
umairaftab 5:bf31a58915a5 82
umairaftab 5:bf31a58915a5 83 //set_temp_unit();
umairaftab 5:bf31a58915a5 84 lcd.cls();
umairaftab 5:bf31a58915a5 85 lcd.setCursor(TextLCD::CurOff_BlkOn);
umairaftab 5:bf31a58915a5 86 lcd.locate(0,0);
umairaftab 12:b3137bb72ef7 87 lcd.printf("PlateOut %u T%3.1f",peltierout,peltierout_temp);
umairaftab 12:b3137bb72ef7 88 //lcd.printf(" iH: %3.1f",inside_humidity);
umairaftab 5:bf31a58915a5 89 lcd.locate(0,1);
umairaftab 12:b3137bb72ef7 90 lcd.printf("PlateIn %u T%3.1f",peltierin,peltierin_temp);
umairaftab 11:f9ffd5ab7e94 91 }
umairaftab 11:f9ffd5ab7e94 92 void ui_screen4() {
umairaftab 11:f9ffd5ab7e94 93
umairaftab 11:f9ffd5ab7e94 94 //set_temp_unit();
umairaftab 11:f9ffd5ab7e94 95 lcd.cls();
umairaftab 11:f9ffd5ab7e94 96 lcd.setCursor(TextLCD::CurOff_BlkOn);
umairaftab 11:f9ffd5ab7e94 97 lcd.locate(0,0);
umairaftab 12:b3137bb72ef7 98 lcd.printf("Red:%u",red_light_value);
umairaftab 12:b3137bb72ef7 99 lcd.printf(" Blue:%u",blue_light_value);
umairaftab 11:f9ffd5ab7e94 100 lcd.locate(0,1);
umairaftab 14:72176f1e4907 101 lcd.printf("G::%u",green_light_value);
umairaftab 36:ce0ca02a8253 102 lcd.printf("H20: %3.1f",weight_sensor);
umairaftab 12:b3137bb72ef7 103 //lcd.printf(" oH: %3.1f",outside_humidity);
umairaftab 12:b3137bb72ef7 104 }
umairaftab 30:417e8ba439ff 105
umairaftab 30:417e8ba439ff 106 void lcd_backlight_on(){
umairaftab 30:417e8ba439ff 107
umairaftab 30:417e8ba439ff 108 lcd_backlight = 1;
umairaftab 30:417e8ba439ff 109 }
umairaftab 30:417e8ba439ff 110 void lcd_backlight_off(){
umairaftab 30:417e8ba439ff 111
umairaftab 30:417e8ba439ff 112 lcd_backlight = 0;
umairaftab 30:417e8ba439ff 113 }