blueeSandroMesquitaBianorPixelsEscola
Published © GPL3+

Cell-Controlled Room

We made a room, where the lights are controlled either by cell phone via Bluetooth or the manual switch.

IntermediateProtip856
Cell-Controlled Room

Things used in this project

Hardware components

Arduino UNO & Genuino UNO
Arduino UNO & Genuino UNO
×1
Jumper wires (generic)
Jumper wires (generic)
×1
HC-05 Bluetooth Module
HC-05 Bluetooth Module
×1
RGB Diffused Common Cathode
RGB Diffused Common Cathode
×1
4-CHANNEL RELAY CONTROLLER FOR I2C
ControlEverything.com 4-CHANNEL RELAY CONTROLLER FOR I2C
×1
Resistor 1k ohm
Resistor 1k ohm
×3

Software apps and online services

Arduino IDE
Arduino IDE
MIT App Inventor 2
MIT App Inventor 2
robotic room

Hand tools and fabrication machines

Hot glue gun (generic)
Hot glue gun (generic)
Soldering iron (generic)
Soldering iron (generic)
Tip Tinner/Cleaner, Lead-Free
Tip Tinner/Cleaner, Lead-Free

Story

Read more

Schematics

electric circuit

Bluetooth hc-05
4 channel relay
Arduino one
12v power supply
Led rgb
1 680ohms resistor
1 resistor 1 k
1 resistor 2k
jumper

Code

robotic room automation

Arduino
int comando;
unsigned long mil = 0;
bool estado;
void setup(){
  Serial.begin(9600);
  pinMode(8,OUTPUT); // Tomada tv           A 
  pinMode(9,OUTPUT); // Luz 1               B
  pinMode(10,OUTPUT);// Luz 2               C
  pinMode(11,OUTPUT);// Tomada ventilador   D
                     // Geral               Z
  pinMode(7,OUTPUT); // 5V bluetooth 
  pinMode(6,OUTPUT); 
  pinMode(5,OUTPUT);
  pinMode(4,OUTPUT);
  pinMode(3,OUTPUT);                                 
  for(int i=7;i<=11;i++)digitalWrite(i,1);//DESLIGAR TODOS OS RELES
                    
}

void loop() {
  
 if(Serial.available()>0){
   mil = millis();
   comando = Serial.read();
   Serial.println(Serial.read());
   if(comando =='w')
   {
    estado = 1;
   }
 }
  if(estado == 1){
   digitalWrite(3,HIGH);
   digitalWrite(4,LOW);
  }
  else {
  digitalWrite(3,LOW);
  digitalWrite(4,HIGH);
  }
if(millis()-mil > 1000){
  estado = 0;
}
  
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////        
//porta 
      if(comando=='a'){
        digitalWrite(11,HIGH); //DESLIGAR
        analogWrite(5,50); //LIGAR
        digitalWrite(6,LOW); //DESLIGAR
        }
      if(comando=='A'){
        digitalWrite(11,LOW); //LIGAR
        digitalWrite(5,LOW); //DESLIGAR
        analogWrite(6,50); //LIGAR
        }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////     
//LAMPADA 1
      if(comando=='b'){
        digitalWrite(10,HIGH); //DESLIGAR
        }
      if(comando=='B'){
        digitalWrite(10,LOW); //LIGAR
        }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////        
//TOMADA 2
      if(comando=='c'){
        digitalWrite(9,HIGH); //DESLIGAR
        }
      if(comando=='C'){
        digitalWrite(9,LOW); //LIGAR
        }
////////////////////////////////////////////////////////////////////////////////////////////////////////////        
//TOMADA VENTILADOR
      if(comando=='d'){
        digitalWrite(8,HIGH); //DESLIGAR        
        }
      if(comando=='D'){
        digitalWrite(8,LOW); //LIGAR
        }
        
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  //DESLIGAR TUDO GERAL
  if(comando=='z'){
        digitalWrite(11,HIGH); //DESLIGAR
        digitalWrite(10,HIGH); //DESLIGAR
        digitalWrite(9,HIGH); //DESLIGAR
        digitalWrite(8,HIGH); //DESLIGAR        

        }
        if(comando=='Z'){
        digitalWrite(11,LOW); //LIGAR
        digitalWrite(10,LOW); //LIGAR
        digitalWrite(9,LOW); //LIGAR
        digitalWrite(8,LOW); //LIGAR
        }

}

Credits

bluee

bluee

0 projects • 18 followers
SandroMesquita

SandroMesquita

14 projects • 86 followers
Professor de robótica com Arduino e Raspberry, estudando e aplicando conhecimentos de I.A. usando a Linguagem Python como base.
Bianor

Bianor

10 projects • 49 followers
PixelsEscola

PixelsEscola

14 projects • 55 followers

Comments