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/SEN11301P/DHT.h@57:7ab93ed49b70, 2014-04-14 (annotated)
- Committer:
- umairaftab
- Date:
- Mon Apr 14 19:18:14 2014 +0000
- Revision:
- 57:7ab93ed49b70
- Parent:
- 7:1d691f81d455
Cosmetic Changes, Menus added
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
umairaftab | 4:8d1df60ef3c3 | 1 | |
umairaftab | 4:8d1df60ef3c3 | 2 | #ifndef MBED_DHT_H |
umairaftab | 4:8d1df60ef3c3 | 3 | #define MBED_DHT_H |
umairaftab | 4:8d1df60ef3c3 | 4 | |
umairaftab | 4:8d1df60ef3c3 | 5 | #include "mbed.h" |
umairaftab | 4:8d1df60ef3c3 | 6 | |
umairaftab | 4:8d1df60ef3c3 | 7 | enum eType{ |
umairaftab | 4:8d1df60ef3c3 | 8 | DHT11 = 11, |
umairaftab | 4:8d1df60ef3c3 | 9 | SEN11301P = 11, |
umairaftab | 4:8d1df60ef3c3 | 10 | RHT01 = 11, |
umairaftab | 4:8d1df60ef3c3 | 11 | DHT22 = 22, |
umairaftab | 4:8d1df60ef3c3 | 12 | AM2302 = 22, |
umairaftab | 4:8d1df60ef3c3 | 13 | SEN51035P = 22, |
umairaftab | 4:8d1df60ef3c3 | 14 | RHT02 = 22, |
umairaftab | 4:8d1df60ef3c3 | 15 | RHT03 = 22 |
umairaftab | 4:8d1df60ef3c3 | 16 | } ; |
umairaftab | 4:8d1df60ef3c3 | 17 | |
umairaftab | 4:8d1df60ef3c3 | 18 | enum eError { |
umairaftab | 4:8d1df60ef3c3 | 19 | ERROR_NONE = 0, |
umairaftab | 4:8d1df60ef3c3 | 20 | BUS_BUSY =1, |
umairaftab | 4:8d1df60ef3c3 | 21 | ERROR_NOT_PRESENT =2 , |
umairaftab | 4:8d1df60ef3c3 | 22 | ERROR_ACK_TOO_LONG =3 , |
umairaftab | 4:8d1df60ef3c3 | 23 | ERROR_SYNC_TIMEOUT = 4, |
umairaftab | 4:8d1df60ef3c3 | 24 | ERROR_DATA_TIMEOUT =5 , |
umairaftab | 4:8d1df60ef3c3 | 25 | ERROR_CHECKSUM = 6, |
umairaftab | 4:8d1df60ef3c3 | 26 | ERROR_NO_PATIENCE =7 |
umairaftab | 4:8d1df60ef3c3 | 27 | } ; |
umairaftab | 4:8d1df60ef3c3 | 28 | |
umairaftab | 4:8d1df60ef3c3 | 29 | typedef enum { |
umairaftab | 4:8d1df60ef3c3 | 30 | CELCIUS =0 , |
umairaftab | 4:8d1df60ef3c3 | 31 | FARENHEIT =1, |
umairaftab | 4:8d1df60ef3c3 | 32 | KELVIN=2 |
umairaftab | 4:8d1df60ef3c3 | 33 | } eScale; |
umairaftab | 4:8d1df60ef3c3 | 34 | |
umairaftab | 4:8d1df60ef3c3 | 35 | |
umairaftab | 4:8d1df60ef3c3 | 36 | class DHT { |
umairaftab | 4:8d1df60ef3c3 | 37 | |
umairaftab | 4:8d1df60ef3c3 | 38 | public: |
umairaftab | 4:8d1df60ef3c3 | 39 | |
umairaftab | 4:8d1df60ef3c3 | 40 | DHT(PinName pin,int DHTtype); |
umairaftab | 4:8d1df60ef3c3 | 41 | ~DHT(); |
umairaftab | 4:8d1df60ef3c3 | 42 | int readData(void); |
umairaftab | 4:8d1df60ef3c3 | 43 | float ReadHumidity(void); |
umairaftab | 4:8d1df60ef3c3 | 44 | float ReadTemperature(eScale Scale); |
umairaftab | 4:8d1df60ef3c3 | 45 | float CalcdewPoint(float celsius, float humidity); |
umairaftab | 4:8d1df60ef3c3 | 46 | float CalcdewPointFast(float celsius, float humidity); |
umairaftab | 4:8d1df60ef3c3 | 47 | |
umairaftab | 4:8d1df60ef3c3 | 48 | private: |
umairaftab | 4:8d1df60ef3c3 | 49 | time_t _lastReadTime; |
umairaftab | 4:8d1df60ef3c3 | 50 | float _lastTemperature; |
umairaftab | 4:8d1df60ef3c3 | 51 | float _lastHumidity; |
umairaftab | 4:8d1df60ef3c3 | 52 | PinName _pin; |
umairaftab | 4:8d1df60ef3c3 | 53 | bool _firsttime; |
umairaftab | 4:8d1df60ef3c3 | 54 | int _DHTtype; |
umairaftab | 4:8d1df60ef3c3 | 55 | int DHT_data[6]; |
umairaftab | 4:8d1df60ef3c3 | 56 | float CalcTemperature(); |
umairaftab | 4:8d1df60ef3c3 | 57 | float CalcHumidity(); |
umairaftab | 4:8d1df60ef3c3 | 58 | float ConvertCelciustoFarenheit(float); |
umairaftab | 4:8d1df60ef3c3 | 59 | float ConvertCelciustoKelvin(float); |
umairaftab | 4:8d1df60ef3c3 | 60 | |
umairaftab | 4:8d1df60ef3c3 | 61 | }; |
umairaftab | 4:8d1df60ef3c3 | 62 | |
umairaftab | 4:8d1df60ef3c3 | 63 | #endif |