CR555
Published

Too Hot! Too cold! Yes, that's better

A temperature control system that can be used for shower or to mix two different liquids without physical contact.

BeginnerFull instructions provided20 hours3,687
Too Hot! Too cold! Yes, that's better

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
Breadboard (generic)
Breadboard (generic)
×1
MOSFET Driver, Low Side
MOSFET Driver, Low Side
×2
Resistor 10k ohm
Resistor 10k ohm
×2
Resistor 100 ohm
Resistor 100 ohm
×2
Capacitor 100 nF
Capacitor 100 nF
×2
Proximity IR sensor
×2
Water pump
×2

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Circuit

Implementation example with a breadboard

Driver

How to drive an electric pump

Code

Code

Arduino
#define HOT 2         // HOT SENSOR PIN
#define COLD 3        // COLD SENSOR PIN
#define HOT_pin 6    //HOT WATER MOTOR PIN
#define COLD_pin 5   //COLD WATER MOTOR PIN
#define BUZZER_pin 9  // BUZZER PIN

int WATER = LOW;
int detectionHOT = HIGH;    // NO USER
int detectionCOLD = HIGH;    // NO USER
int TEMPERATURE = 0;    //TEMPERATURE BETWEEN HOT AND COLD

void off(){
    analogWrite(HOT_pin, 0);       //PWM HOT MOTOR
    analogWrite(COLD_pin,0);   //PWM COLD MOTOR
    delay(1500); 
}

void setup() {
  Serial.begin(9600);   
  pinMode(HOT, INPUT); 
  pinMode(COLD, INPUT);
  pinMode(HOT_pin, OUTPUT);
  pinMode(COLD_pin, OUTPUT);
  pinMode(BUZZER_pin, OUTPUT);
  }
  
void loop() {  
  digitalWrite(BUZZER_pin, LOW);
  detectionHOT = digitalRead(HOT);
  detectionCOLD = digitalRead(COLD);

  if(detectionHOT == LOW and detectionCOLD == LOW){
    off();   //no water 
  }
  else {
    if(detectionHOT == HIGH and detectionCOLD == HIGH){
      return; 
    }
  if(detectionHOT == LOW){
    Serial.print("HOT WATER!\n");
    if(TEMPERATURE < 255){
      if (TEMPERATURE + 32 > 255) {
        TEMPERATURE = 255;
      }
      else{
        TEMPERATURE = TEMPERATURE + 32;
      }
    }
  }
    if(detectionCOLD == LOW){
    Serial.print("COLD WATER!\n");  
    if(TEMPERATURE > 0){
      if (TEMPERATURE - 32 < 0){
        TEMPERATURE = 0;
      }
      else {
        TEMPERATURE = TEMPERATURE - 32;
      }
    }
  }
  if(TEMPERATURE == 0 or TEMPERATURE == 255){
    analogWrite(BUZZER_pin, 100);
    Serial.print("\nBUZZER");
  }
  Serial.print("\nTemperature = ");
  Serial.print(TEMPERATURE);
  analogWrite(HOT_pin,TEMPERATURE);       //PWM HOT MOTOR
  analogWrite(COLD_pin,255-TEMPERATURE);   //PWM COLD MOTOR
  delay(1000);    // in ms
  }
}

Credits

CR555

CR555

2 projects • 6 followers

Comments