Dryer timer with dew point control and 4-20mA analogue output signal
Dependencies: mbed HYT Watchdog TextLCD Millis
Revision 4:6c83f83dde87, committed 2021-01-23
- Comitter:
- koosvanderwat
- Date:
- Sat Jan 23 08:10:58 2021 +0000
- Parent:
- 3:bbd271c944a0
- Commit message:
- Update to analogue out
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Nov 29 10:06:55 2019 +0000
+++ b/main.cpp Sat Jan 23 08:10:58 2021 +0000
@@ -125,21 +125,48 @@
SENSOR.MRCommand();
wait_ms(100);
- SENSOR.DFCommand();
+ //SENSOR.DFCommand();
+
+ CheckSensor = SENSOR.DFCommand();
RHValue = (SENSOR.humidity);
TempValue = (SENSOR.temperature);
- if(RHValue < 1) {
- sensorbroken = 1;
- }
+ sensorbroken = 0;
+
+ if(CheckSensor != 0){
+ sensorbroken = 1;
+ }
+
+ //if(RHValue < 0.01) {
+ // sensorbroken = 1;
+ //}
if(TempValue < -20) {
sensorbroken = 1;
}
if(sensorbroken == 0) {
+ RHValue = (SENSOR.humidity);
+ TempValue = (SENSOR.temperature);
+
+ if (RHValue != 0){
+
A = log( RHValue * 0.01 * pow(10, 7.5*TempValue/(237.2+TempValue) ) );
DewPoint = (23720 * A/(17.269-A))/100;
+ }
+
+ if (RHValue == 0){
+ DewPoint = -50;
+ }
+
+ if(DewPoint > 20){
+ DewPoint = 20;
+ }
+
+ if(DewPoint < -50){
+ DewPoint = -50;
+ }
+
if (ClimateControl == 1) {
NewSetPoint = TempValue - DewPointSuppresion;
@@ -168,7 +195,9 @@
lcd.locate(11,1);
lcd.printf("%.1f%", TempValue);
- DP_Out = 0.0104*DewPoint + 0.702;
+ DP_Out = 0.0104*DewPoint + 0.702; // For dewpoint -50 to 20 with output signal 0.6V to 3V
+ //DP_Out = 0.0143*DewPoint + 0.714;
+
if ((DewPoint < NewSetPoint) && (secondscounter == LHCT)) {
secondscounter = secondscounter - 1;