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:
Sat Apr 12 11:14:12 2014 +0000
Revision:
12:b3137bb72ef7
Parent:
11:f9ffd5ab7e94
Child:
14:72176f1e4907
Process User input routine 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 12:b3137bb72ef7 22 unsigned int peltierout;
umairaftab 12:b3137bb72ef7 23 unsigned int peltierin;
umairaftab 12:b3137bb72ef7 24 float peltierin_temp;
umairaftab 12:b3137bb72ef7 25 float peltierout_temp;
umairaftab 12:b3137bb72ef7 26
umairaftab 12:b3137bb72ef7 27 unsigned int red_light_value;
umairaftab 12:b3137bb72ef7 28 unsigned int blue_light_value;
umairaftab 12:b3137bb72ef7 29 unsigned int green_light_value;
umairaftab 4:8d1df60ef3c3 30 //Set Temperature Unit
umairaftab 4:8d1df60ef3c3 31 void set_temp_unit(){
umairaftab 4:8d1df60ef3c3 32 if(temp_unit == 1){
umairaftab 4:8d1df60ef3c3 33 temp_unit_char = 'F';
umairaftab 4:8d1df60ef3c3 34 }
umairaftab 4:8d1df60ef3c3 35 else if(temp_unit == 2){
umairaftab 4:8d1df60ef3c3 36 temp_unit_char = 'K';
umairaftab 4:8d1df60ef3c3 37 }
umairaftab 4:8d1df60ef3c3 38 else{
umairaftab 4:8d1df60ef3c3 39 temp_unit_char = 'C';
umairaftab 4:8d1df60ef3c3 40 }
umairaftab 4:8d1df60ef3c3 41 }
umairaftab 3:087ce66714c0 42
umairaftab 3:087ce66714c0 43 void ui_startup(){
umairaftab 5:bf31a58915a5 44
umairaftab 4:8d1df60ef3c3 45 lcd.cls();
umairaftab 3:087ce66714c0 46 lcd.setCursor(TextLCD::CurOff_BlkOn);
umairaftab 3:087ce66714c0 47 lcd.locate(0,0);
umairaftab 3:087ce66714c0 48 lcd.printf("Project Autus");
umairaftab 3:087ce66714c0 49 lcd.locate(0,1);
umairaftab 3:087ce66714c0 50 lcd.printf("Initializing Machine");
umairaftab 3:087ce66714c0 51 }
umairaftab 3:087ce66714c0 52
umairaftab 4:8d1df60ef3c3 53 void ui_screen1() {
umairaftab 5:bf31a58915a5 54
umairaftab 5:bf31a58915a5 55 set_temp_unit();
umairaftab 4:8d1df60ef3c3 56 lcd.cls();
umairaftab 4:8d1df60ef3c3 57 lcd.setCursor(TextLCD::CurOff_BlkOn);
umairaftab 4:8d1df60ef3c3 58 lcd.locate(0,0);
umairaftab 4:8d1df60ef3c3 59 lcd.printf("T: %3.1f%c",inside_temp,temp_unit_char);
umairaftab 4:8d1df60ef3c3 60 lcd.printf(" H: %3.1f",inside_humidity);
umairaftab 4:8d1df60ef3c3 61 lcd.locate(0,1);
umairaftab 11:f9ffd5ab7e94 62 lcd.printf("S1: %4.2f",soil1_humidity);
umairaftab 11:f9ffd5ab7e94 63 lcd.printf(" S2: %4.2f",soil2_humidity);
umairaftab 4:8d1df60ef3c3 64 }
umairaftab 4:8d1df60ef3c3 65
umairaftab 5:bf31a58915a5 66 void ui_screen2() {
umairaftab 5:bf31a58915a5 67
umairaftab 5:bf31a58915a5 68 set_temp_unit();
umairaftab 5:bf31a58915a5 69 lcd.cls();
umairaftab 5:bf31a58915a5 70 lcd.setCursor(TextLCD::CurOff_BlkOn);
umairaftab 5:bf31a58915a5 71 lcd.locate(0,0);
umairaftab 5:bf31a58915a5 72 lcd.printf("iT: %3.1f%c",inside_temp,temp_unit_char);
umairaftab 5:bf31a58915a5 73 lcd.printf(" iH: %3.1f",inside_humidity);
umairaftab 5:bf31a58915a5 74 lcd.locate(0,1);
umairaftab 5:bf31a58915a5 75 lcd.printf("oT: %3.1f%c",outside_temp,temp_unit_char);
umairaftab 5:bf31a58915a5 76 lcd.printf(" oH: %3.1f",outside_humidity);
umairaftab 5:bf31a58915a5 77 }
umairaftab 5:bf31a58915a5 78
umairaftab 5:bf31a58915a5 79 void ui_screen3() {
umairaftab 5:bf31a58915a5 80
umairaftab 5:bf31a58915a5 81 //set_temp_unit();
umairaftab 5:bf31a58915a5 82 lcd.cls();
umairaftab 5:bf31a58915a5 83 lcd.setCursor(TextLCD::CurOff_BlkOn);
umairaftab 5:bf31a58915a5 84 lcd.locate(0,0);
umairaftab 12:b3137bb72ef7 85 lcd.printf("PlateOut %u T%3.1f",peltierout,peltierout_temp);
umairaftab 12:b3137bb72ef7 86 //lcd.printf(" iH: %3.1f",inside_humidity);
umairaftab 5:bf31a58915a5 87 lcd.locate(0,1);
umairaftab 12:b3137bb72ef7 88 lcd.printf("PlateIn %u T%3.1f",peltierin,peltierin_temp);
umairaftab 11:f9ffd5ab7e94 89 }
umairaftab 11:f9ffd5ab7e94 90 void ui_screen4() {
umairaftab 11:f9ffd5ab7e94 91
umairaftab 11:f9ffd5ab7e94 92 //set_temp_unit();
umairaftab 11:f9ffd5ab7e94 93 lcd.cls();
umairaftab 11:f9ffd5ab7e94 94 lcd.setCursor(TextLCD::CurOff_BlkOn);
umairaftab 11:f9ffd5ab7e94 95 lcd.locate(0,0);
umairaftab 12:b3137bb72ef7 96 lcd.printf("Red:%u",red_light_value);
umairaftab 12:b3137bb72ef7 97 lcd.printf(" Blue:%u",blue_light_value);
umairaftab 11:f9ffd5ab7e94 98 lcd.locate(0,1);
umairaftab 12:b3137bb72ef7 99 lcd.printf("Green:%u",green_light_value);
umairaftab 12:b3137bb72ef7 100 //lcd.printf(" oH: %3.1f",outside_humidity);
umairaftab 12:b3137bb72ef7 101 }