ELÉTRICA SIMULAÇÕES
Published © GPL3+

Automatic Home Oficce

Fan and Humidifier Control for Palms using arduino uno and relay shield.

IntermediateShowcase (no instructions)516
Automatic Home Oficce

Things used in this project

Story

Read more

Custom parts and enclosures

Layout

Project Layout in CAD

Schematics

Layout project

The lamps represent fan e humidifier

Layout

Code

Automatic Home office

C/C++
#define sensor 2
#define ventilador 5
#define umidificador 6

int palmas = 0;
boolean temPalmas = true;
boolean contaPalma = true;
unsigned long tempoentrepalmas = 0;

void setup() {
  pinMode(sensor, INPUT);
  pinMode(ventilador, OUTPUT);
  pinMode(umidificador, OUTPUT);
  
  digitalWrite(ventilador, HIGH);
  digitalWrite(umidificador,HIGH);
}

void loop() {
 temPalmas = digitalRead(sensor);
 
 if(!temPalmas){
  if(contaPalma){
    palmas++;
    tempoentrepalmas = millis();
    contaPalma = false;
  }
  else{
    if(millis() - tempoentrepalmas > 200){
      contaPalma = true;
    }
  }
 }

 if(millis() - tempoentrepalmas > 500){
  switch(palmas){
    case 2:
    digitalWrite(ventilador, !digitalRead(ventilador));
    break;

    case 3:
    digitalWrite(umidificador,!digitalRead(umidificador));
    break;
  }
  palmas = 0;
 }
}

Credits

ELÉTRICA SIMULAÇÕES

ELÉTRICA SIMULAÇÕES

4 projects • 2 followers
Electrical engineering studend, iot, c++, arduino, automation etc.

Comments