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

UI/ui.cpp

Committer:
umairaftab
Date:
2014-04-12
Revision:
14:72176f1e4907
Parent:
12:b3137bb72ef7
Child:
25:a6d1eaf2041c

File content as of revision 14:72176f1e4907:

#include "mbed.h"
//#include "keypad.h"
//#include "globalvalues.h"
#include "ui.h"
#include "airhumidity.h" //for error variables

char lcd_keypad_value ; 
int temp_unit = 0; //0 for celcius 1 for faren 2 for kelvin 
char temp_unit_char = 'C'; 

float outside_humidity;
float outside_temp;
float outside_dewpoint;

float inside_humidity;
float inside_temp;
float inside_dewpoint;

float soil1_humidity;
float soil2_humidity;

float weight_sensor;

unsigned int peltierout;
unsigned int peltierin;
float peltierin_temp;
float peltierout_temp;

unsigned int red_light_value;
unsigned int blue_light_value;
unsigned int green_light_value;
//Set Temperature Unit
void set_temp_unit(){
    if(temp_unit == 1){
        temp_unit_char = 'F';
    }
    else if(temp_unit == 2){
        temp_unit_char = 'K';
    }
    else{
        temp_unit_char = 'C';
    }
}

void ui_startup(){

    lcd.cls();
    lcd.setCursor(TextLCD::CurOff_BlkOn);
    lcd.locate(0,0);
    lcd.printf("Project Autus");
    lcd.locate(0,1);
    lcd.printf("Initializing Machine");
}

void ui_screen1() {
    
    set_temp_unit();
    lcd.cls();
    lcd.setCursor(TextLCD::CurOff_BlkOn);
    lcd.locate(0,0);
    lcd.printf("T: %3.1f%c",inside_temp,temp_unit_char);
    lcd.printf(" H: %3.1f",inside_humidity);   
    lcd.locate(0,1);
    lcd.printf("S1: %4.2f",soil1_humidity);
    lcd.printf(" S2: %4.2f",soil2_humidity);
}

void ui_screen2() {
    
    set_temp_unit();
    lcd.cls();
    lcd.setCursor(TextLCD::CurOff_BlkOn);
    lcd.locate(0,0);
    lcd.printf("iT: %3.1f%c",inside_temp,temp_unit_char);
    lcd.printf(" iH: %3.1f",inside_humidity);   
    lcd.locate(0,1);
    lcd.printf("oT: %3.1f%c",outside_temp,temp_unit_char);
    lcd.printf(" oH: %3.1f",outside_humidity);
}

void ui_screen3() {
    
    //set_temp_unit();
    lcd.cls();
    lcd.setCursor(TextLCD::CurOff_BlkOn);
    lcd.locate(0,0);
    lcd.printf("PlateOut %u T%3.1f",peltierout,peltierout_temp);
    //lcd.printf(" iH: %3.1f",inside_humidity);   
    lcd.locate(0,1);
    lcd.printf("PlateIn %u T%3.1f",peltierin,peltierin_temp);
}
void ui_screen4() {
    
    //set_temp_unit();
    lcd.cls();
    lcd.setCursor(TextLCD::CurOff_BlkOn);
    lcd.locate(0,0);
    lcd.printf("Red:%u",red_light_value);
    lcd.printf(" Blue:%u",blue_light_value);   
    lcd.locate(0,1);
    lcd.printf("G::%u",green_light_value);
    lcd.printf("W: %3.1f",weight_sensor);
    //lcd.printf(" oH: %3.1f",outside_humidity);
}