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.
Airhumiditysensors/airhumidity.cpp@57:7ab93ed49b70, 2014-04-14 (annotated)
- Committer:
- umairaftab
- Date:
- Mon Apr 14 19:18:14 2014 +0000
- Revision:
- 57:7ab93ed49b70
- Parent:
- 12:b3137bb72ef7
Cosmetic Changes, Menus added
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
umairaftab | 4:8d1df60ef3c3 | 1 | #include "mbed.h" |
umairaftab | 4:8d1df60ef3c3 | 2 | #include "airhumidity.h" |
umairaftab | 4:8d1df60ef3c3 | 3 | #include "DHT.h" |
umairaftab | 4:8d1df60ef3c3 | 4 | |
umairaftab | 4:8d1df60ef3c3 | 5 | int error_outside; |
umairaftab | 4:8d1df60ef3c3 | 6 | int error_inside; |
umairaftab | 4:8d1df60ef3c3 | 7 | |
umairaftab | 5:bf31a58915a5 | 8 | DHT sensor_outside(PTD1,SEN11301P); |
umairaftab | 5:bf31a58915a5 | 9 | DHT sensor_inside(PTD3,SEN11301P); |
umairaftab | 4:8d1df60ef3c3 | 10 | |
umairaftab | 4:8d1df60ef3c3 | 11 | float get_air_temp_outside(int tempunit){ |
umairaftab | 4:8d1df60ef3c3 | 12 | wait(1); |
umairaftab | 4:8d1df60ef3c3 | 13 | error_outside = sensor_outside.readData(); |
umairaftab | 4:8d1df60ef3c3 | 14 | switch (tempunit){ |
umairaftab | 4:8d1df60ef3c3 | 15 | case 0: |
umairaftab | 4:8d1df60ef3c3 | 16 | return sensor_outside.ReadTemperature(CELCIUS); |
umairaftab | 12:b3137bb72ef7 | 17 | //break; |
umairaftab | 4:8d1df60ef3c3 | 18 | case 1: |
umairaftab | 4:8d1df60ef3c3 | 19 | return sensor_outside.ReadTemperature(FARENHEIT); |
umairaftab | 12:b3137bb72ef7 | 20 | //break; |
umairaftab | 4:8d1df60ef3c3 | 21 | case 2: |
umairaftab | 4:8d1df60ef3c3 | 22 | return sensor_outside.ReadTemperature(KELVIN); |
umairaftab | 12:b3137bb72ef7 | 23 | // break; |
umairaftab | 5:bf31a58915a5 | 24 | default: |
umairaftab | 5:bf31a58915a5 | 25 | return sensor_inside.ReadTemperature(CELCIUS); |
umairaftab | 12:b3137bb72ef7 | 26 | // break; |
umairaftab | 4:8d1df60ef3c3 | 27 | } |
umairaftab | 4:8d1df60ef3c3 | 28 | } |
umairaftab | 4:8d1df60ef3c3 | 29 | |
umairaftab | 4:8d1df60ef3c3 | 30 | float get_air_humid_outside(){ |
umairaftab | 4:8d1df60ef3c3 | 31 | wait(1); |
umairaftab | 4:8d1df60ef3c3 | 32 | error_outside = sensor_outside.readData(); |
umairaftab | 4:8d1df60ef3c3 | 33 | return sensor_outside.ReadHumidity(); |
umairaftab | 4:8d1df60ef3c3 | 34 | } |
umairaftab | 4:8d1df60ef3c3 | 35 | |
umairaftab | 4:8d1df60ef3c3 | 36 | float get_air_dewpoint_outside(){ |
umairaftab | 4:8d1df60ef3c3 | 37 | wait(1); |
umairaftab | 4:8d1df60ef3c3 | 38 | error_outside = sensor_outside.readData(); |
umairaftab | 4:8d1df60ef3c3 | 39 | return sensor_outside.CalcdewPointFast(sensor_outside.ReadTemperature(CELCIUS), sensor_outside.ReadHumidity()); |
umairaftab | 4:8d1df60ef3c3 | 40 | |
umairaftab | 4:8d1df60ef3c3 | 41 | } |
umairaftab | 4:8d1df60ef3c3 | 42 | |
umairaftab | 4:8d1df60ef3c3 | 43 | //INSIDE FUNCTIONS |
umairaftab | 4:8d1df60ef3c3 | 44 | float get_air_temp_inside(int tempunit){ |
umairaftab | 4:8d1df60ef3c3 | 45 | wait(1); |
umairaftab | 4:8d1df60ef3c3 | 46 | error_inside = sensor_inside.readData(); |
umairaftab | 4:8d1df60ef3c3 | 47 | switch (tempunit){ |
umairaftab | 4:8d1df60ef3c3 | 48 | case 0: |
umairaftab | 4:8d1df60ef3c3 | 49 | return sensor_inside.ReadTemperature(CELCIUS); |
umairaftab | 12:b3137bb72ef7 | 50 | // break; |
umairaftab | 4:8d1df60ef3c3 | 51 | case 1: |
umairaftab | 4:8d1df60ef3c3 | 52 | return sensor_inside.ReadTemperature(FARENHEIT); |
umairaftab | 12:b3137bb72ef7 | 53 | // break; |
umairaftab | 4:8d1df60ef3c3 | 54 | case 2: |
umairaftab | 4:8d1df60ef3c3 | 55 | return sensor_inside.ReadTemperature(KELVIN); |
umairaftab | 12:b3137bb72ef7 | 56 | // break; |
umairaftab | 5:bf31a58915a5 | 57 | default: |
umairaftab | 5:bf31a58915a5 | 58 | return sensor_inside.ReadTemperature(CELCIUS); |
umairaftab | 12:b3137bb72ef7 | 59 | // break; |
umairaftab | 4:8d1df60ef3c3 | 60 | } |
umairaftab | 4:8d1df60ef3c3 | 61 | } |
umairaftab | 4:8d1df60ef3c3 | 62 | |
umairaftab | 4:8d1df60ef3c3 | 63 | |
umairaftab | 4:8d1df60ef3c3 | 64 | float get_air_humid_inside(){ |
umairaftab | 4:8d1df60ef3c3 | 65 | wait(1); |
umairaftab | 4:8d1df60ef3c3 | 66 | error_inside = sensor_inside.readData(); |
umairaftab | 4:8d1df60ef3c3 | 67 | return sensor_inside.ReadHumidity(); |
umairaftab | 4:8d1df60ef3c3 | 68 | } |
umairaftab | 4:8d1df60ef3c3 | 69 | |
umairaftab | 4:8d1df60ef3c3 | 70 | float get_air_dewpoint_inside(){ |
umairaftab | 4:8d1df60ef3c3 | 71 | wait(1); |
umairaftab | 4:8d1df60ef3c3 | 72 | error_inside = sensor_inside.readData(); |
umairaftab | 4:8d1df60ef3c3 | 73 | return sensor_inside.CalcdewPointFast(sensor_inside.ReadTemperature(CELCIUS), sensor_inside.ReadHumidity()); |
umairaftab | 4:8d1df60ef3c3 | 74 | |
umairaftab | 4:8d1df60ef3c3 | 75 | } |
umairaftab | 4:8d1df60ef3c3 | 76 | //printf("Temperature is %4.0f C \r\n",sensor.ReadTemperature(CELCIUS)); |
umairaftab | 4:8d1df60ef3c3 | 77 | //printf("Temperature is %4.2f F \r\n",sensor.ReadTemperature(FARENHEIT)); |
umairaftab | 4:8d1df60ef3c3 | 78 | //printf("Temperature is %4.2f K \r\n",sensor.ReadTemperature(KELVIN)); |
umairaftab | 4:8d1df60ef3c3 | 79 | //printf("Humidity is %4.2f \r\n",sensor.ReadHumidity()); |
umairaftab | 4:8d1df60ef3c3 | 80 | //printf("Dew point is %4.2f \r\n",sensor.CalcdewPoint(sensor.ReadTemperature(CELCIUS), sensor.ReadHumidity())); |
umairaftab | 4:8d1df60ef3c3 | 81 | //printf("Dew point (fast) is %4.2f \r\n",sensor.CalcdewPointFast(sensor.ReadTemperature(CELCIUS), sensor.ReadHumidity())); |