//setup the humidity/temperature sensor #include dht DHT; #define DHT11_PIN 7 //Setup Pins for output int ledPin = 8; // Audino pin 8 to relay position 1 int ledPin2 = 10; // Audino pin 10 to relay position 3 #include // Library for I2C communication #include // Library for LCD LiquidCrystal_I2C lcd = LiquidCrystal_I2C(0x27, 20, 4); // Change to (0x27,16,2) for 16x2 LCD. void setup() { // put your setup code here, to run once: // initialize serial communication at 9600 bits per second: Serial.begin(9600); // initialize LCD lcd.init(); lcd.backlight(); // initialize pins for valve control output pinMode(ledPin, OUTPUT); pinMode(ledPin2, OUTPUT); // Warm-up Message lcd.setCursor(2,0); // indent,row lcd.print("INITIAL WARM UP"); lcd.setCursor(3,1); // indent,row lcd.print("for 2 minutes"); lcd.setCursor(4,2); // indent,row lcd.print("Please Wait"); // initially open vavle to exhaust for 2 minute purge // Code to send flow to EXHAUST. digitalWrite(ledPin2, LOW); // Activates Relay Position 3 digitalWrite(ledPin, HIGH); // Deactivsates Relay Position 1 delay(120000); // wait 120 seconds } void loop() { // put your main code here, to run repeatedly: // loop for humidity & temperature sensor int chk = DHT.read11(DHT11_PIN); Serial.print("Temperature (C) = "); Serial.println(DHT.temperature); Serial.print("Humidity (%) = "); Serial.println(DHT.humidity); // read the input on analog pin 3: int sensorValue = analogRead(A3); Serial.print("Sensor (mA) = "); Serial.println(sensorValue); //print to serial port // Convert the analog reading (which goes from 155 to 827) to a Percent O2 (0-25%): float PercentO2 = (sensorValue * 0.0372) - 5.77; // print out the value you read: Serial.print("Sensor O2 (%) = "); Serial.println(PercentO2); // LCD printing setup lcd.clear(); // Percent O2 cannot be a negative value if (PercentO2 < 0.0) { lcd.setCursor(4,0); //indent,row lcd.print("0.00% Oxygen"); } else { lcd.setCursor(3,0); // indent,row lcd.print(PercentO2); lcd.setCursor(8,0); // indent,row lcd.print("% Oxygen"); } lcd.setCursor(6,1); // indent,row lcd.print(DHT.temperature); lcd.setCursor(12,1); // indent,row lcd.print((char)223); lcd.setCursor(13,1); // indent,row lcd.print("C"); // Humidity sensor (DHT-11) valid between 20-100%, values <20% are LOW. if (DHT.humidity < 20.0) { lcd.setCursor(4,2); // indent,row lcd.print("LOW Humidity"); } else { lcd.setCursor(2,2); // indent,row lcd.print(DHT.humidity); lcd.setCursor(7,2); // indent,row lcd.print("% Humidity"); } lcd.setCursor(7,3); // indent,row lcd.print(sensorValue); lcd.setCursor(11,3); // indent,row lcd.print("mA"); // valve control - less than 5% go to collection if (PercentO2 < 5.0) { // Code to send flow to COLLECTION. digitalWrite(ledPin, LOW); // Activates Relay Position 1 digitalWrite(ledPin2, HIGH); // Deactivsates Relay Position 3 delay(20000); // wait 20 seconds } else { // Code to send flow to EXHAUST. digitalWrite(ledPin2, LOW); // Activates Relay Position 3 digitalWrite(ledPin, HIGH); // Deactivsates Relay Position 1 delay(20000); // wait 20 seconds } }