question about SSR and sensors

I made a dryer project. i want to run heaters with a push button, then when a limit temperature is reached, the heater will turn off and exhaust will turn on.
if it is cooler than the limit the heater will turn on and the exhaust will turn off. if a certain humidity is reached the heater will turn off and done.
i have used dht22 together with 2 separate ssr for the heater and exhaust controlled by arduino uno.
the heater and the exhaust turns on when conditions are met but it won't turn off.
please help me. i don't know what am i doing wrong with my codes.
thank you in advance.
attached are my code and diagram. :cry:

BD.JPG

FC3.JPG

derekflores:
attached are my code and diagram. :cry:

Attach code thusly:

No need for a new post for that, you can edit posts with 'more' to the right below your post.

Hi,
Welcome to the forum.

Please read the post at the start of any forum , entitled "How to use this Forum".
OR
http://forum.arduino.cc/index.php/topic,148850.0.html.
Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
What model Arduino are you using?

Thanks.. Tom.. :slight_smile:

#include "DHT.h"
#include <LiquidCrystal.h>
#define DHT1PIN A0
#define DHT2PIN A1
#define DHT3PIN A2
#define DHT1TYPE DHT22
#define DHT2TYPE DHT22
#define DHT3TYPE DHT22
DHT dht1(A0, DHT22);
DHT dht2(A1, DHT22);
DHT dht3(A2, DHT22);
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
int buttonPin =   0;
const int heaterPin =   10;
const int exhaustPin =  9;
int btn = 0;
int buttonState = 0;
float temperature1, temperature2, temperature3, humidity1, humidity2, humidity3;
int optionOne_milliSeconds = 100;
int optionTwo_milliSeconds = 2000;
float pressLength_milliSeconds = 0;

void setup() {
  // put your setup code here, to run once:
  pinMode(buttonPin, INPUT_PULLUP);
  pinMode(heaterPin, OUTPUT);
  pinMode(exhaustPin, OUTPUT);
  Serial.begin (9600);
  lcd.begin(16, 2);
  dht1.begin();
  dht2.begin();
  dht3.begin();
  lcd.clear();
  lcd.setCursor(2, 0);
  lcd.print("+ WELCOME +");
  delay(5000);
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Please Load");
  lcd.setCursor(6, 1);
  lcd.print("The Fishes");
  delay(5000);
  lcd.setCursor(0, 0);
  lcd.clear();
  lcd.print("Press Green");
  lcd.setCursor(1, 1);
  lcd.print("Button To Start");
  delay(5000);
}

void loop() {
  // put your main code here, to run repeatedly:
  while (digitalRead(buttonPin) == LOW ) {

    delay(50);  //if you want more resolution, lower this number
    pressLength_milliSeconds = pressLength_milliSeconds + 100;

    //display how long button is has been held
    Serial.print("ms = ");
    Serial.println(pressLength_milliSeconds);

  }

  if (pressLength_milliSeconds >= optionTwo_milliSeconds) {
    digitalWrite(heaterPin, HIGH);
    digitalWrite(exhaustPin, HIGH);
    lcd.clear();
    humidity1 = dht1.readHumidity();
    temperature1 = dht1.readTemperature();
    humidity2 = dht2.readHumidity();
    temperature2 = dht2.readTemperature();
    humidity3 = dht3.readHumidity();
    temperature3 = dht3.readTemperature();
    delay(2000);
    float Avetemp = ((temperature1 + temperature2 + temperature3) / 3);
    float Avehum = ((humidity1 + humidity2 + humidity3) / 3);

    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("T:");
    lcd.print(Avetemp);
    lcd.print((char)223);
    lcd.print("C ");
    lcd.setCursor(0, 1);
    lcd.print("H: ");
    lcd.print(Avehum);
    lcd.print("%");
    delay(2000);

    if (Avetemp > 90 )
    {
      digitalWrite(heaterPin, LOW);
      digitalWrite(exhaustPin, HIGH);
    }
    else if (Avetemp < 90) {
      digitalWrite(heaterPin, HIGH);
      digitalWrite(exhaustPin, LOW);
    }

    if (Avehum == 22) {

      lcd.setCursor(1, 0);
      lcd.clear();
      lcd.print("PROCESS DONE");
      digitalWrite(heaterPin, LOW);
    }
    else if (pressLength_milliSeconds >= optionOne_milliSeconds) {

      digitalWrite(heaterPin, HIGH);
      lcd.clear();
      humidity1 = dht1.readHumidity();
      temperature1 = dht1.readTemperature();
      humidity2 = dht2.readHumidity();
      temperature2 = dht2.readTemperature();
      humidity3 = dht3.readHumidity();
      temperature3 = dht3.readTemperature();
      delay(2000);
      float Avetemp = ((temperature1 + temperature2 + temperature3) / 3);
      float Avehum = ((humidity1 + humidity2 + humidity3) / 3);

      lcd.clear();
      lcd.setCursor(0, 0);
      lcd.print("T:");
      lcd.print(Avetemp);
      lcd.print((char)223);
      lcd.print("C ");
      lcd.setCursor(0, 1);
      lcd.print("H: ");
      lcd.print(Avehum);
      lcd.print("%");
      delay(2000);

      if (Avetemp > 90 )
    {
      digitalWrite(heaterPin, LOW);
      digitalWrite(exhaustPin, HIGH);
    }
    else if (Avetemp < 90) {
      digitalWrite(heaterPin, HIGH);
      digitalWrite(exhaustPin, LOW);
    }

    if (Avehum == 22) {

      lcd.setCursor(1, 0);
      lcd.clear();
      lcd.print("PROCESS DONE");
      digitalWrite(heaterPin, LOW);
      }
    }
  }
}