Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. General Discussion
  3. Help needed for verifying code

Help needed for verifying code

Scheduled Pinned Locked Moved General Discussion
2 Posts 2 Posters 741 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    abhisuma
    wrote on last edited by
    #1

    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);
    }
    
    1 Reply Last reply
    0
    • gohanG Offline
      gohanG Offline
      gohan
      Mod
      wrote on last edited by
      #2

      I think you need to check the examples on hot to use dht sensors because I'm not sure if you can instantiate only one dht object if you have 2 sensors.
      In addition I'd use more reliable sensors than DHT like sht31 or si7021.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      14

      Online

      11.7k

      Users

      11.2k

      Topics

      113.1k

      Posts


      Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • MySensors
      • OpenHardware.io
      • Categories
      • Recent
      • Tags
      • Popular