Humidity control with arduino



  • I have created a program with arduino uno for controlling humidity in my mushroom grow room.
    There are two rooms and i am trying to control humidity of each room with one pressure pump , two solenoid valves and relays. I am trying to keep the humidity range in each room in between 75 - 88.
    As per my planning if the humidity in one room is below 75 the relays connected to pressure pump and solenoid valve for that particular room to be turned on and would be turned off on exceeding 88,and the same procedure for the other room.I have created code for this and as i am beginner i think it is better to present the code to the experienced guys before testing ,pls check my codes and help to rectify any problems.

    Insert Code Here#include <dht.h>
    
    dht DHT;
    
    #define DHT1_PIN 2
    #define DHT2_PIN 4
    #define DHT1TYPE DHT11
    #define DHT2TYPE DHT11
    int pumppin =7;
    int solenoidpin =8;
    int valvepin =12;
    
    void setup(){
      pinMode(pumppin, OUTPUT);
      pinMode(solenoidpin, OUTPUT);
      pinMode(valvepin, OUTPUT);
    }
    void loop()
    {
      int chk =DHT.read11(DHT1_PIN);
      if (DHT.humidity <75) {
        if (digitalRead(pumppin == HIGH)){
          digitalWrite(solenoidpin, HIGH);
        }else{
          digitalWrite(pumppin, HIGH);
          digitalWrite(solenoidpin, HIGH);
        }
      }
      if (DHT.humidity >88) {
      digitalWrite(pumppin, LOW);
          digitalWrite(solenoidpin, LOW);
        }
        delay(5000);
        
        int chk2 =DHT.read11(DHT2_PIN);
      if (DHT.humidity <75) {
        if (digitalRead(pumppin == HIGH)){
          digitalWrite(valvepin, HIGH);
        }else{
          digitalWrite(pumppin, HIGH);
          digitalWrite(valvepin, HIGH);
        }
      }
      if (DHT.humidity >88) {
      digitalWrite(pumppin, LOW);
          digitalWrite(valvepin, LOW);
        }
        delay(5000);
    }
    

  • Mod

    Locking this topic to aviod unnecessary double work and confusion since the same post was made at https://forum.mysensors.org/post/71293

    Pleas don't post the same question multiple times.


Log in to reply
 

Looks like your connection to MySensors Forum was lost, please wait while we try to reconnect.