Jose Luis Bejarano Vasquez
Published © GPL3+

TV,DVD & Audio Control from Android and Arduino

Learn how to control some of your home appliances from your smartphone with android and arduino.

IntermediateFull instructions provided7,224
TV,DVD & Audio Control from Android and Arduino

Things used in this project

Hardware components

Arduino UNO & Genuino UNO
Arduino UNO & Genuino UNO
×1
HC-05 Bluetooth Module
HC-05 Bluetooth Module
×1
TSOP 1738
×1
Infrared led
×2
Resistor 221 ohm
Resistor 221 ohm
×2

Software apps and online services

Domoardu

Story

Read more

Schematics

Diagram of the proyect

Diagram of the proyect

Mounting in the protoboard

Diagram for receiving the infrared codes.

Code

Arduino code

Arduino
#include "<\IrRemote.h\>";

IRsend ir;

int estado=0;

char dato;

//These codes are for controlling the Audio System

unsigned int powerEquipo[32]={300,750,300,1800,300,700,350,700,350,1750,350,700,300,1800,250,1800,350,700,300,1800,350,700,300,700,350,700,350,1750,300,750,300}; //unsigned int chEmisoraUp[32]= {300,750,300,750,300,1750,250,800,300,750,300,750,250,800,300,750,250,1800,250,1850,300,750,250,800,200,800,300,1800,300,750,300}; unsigned int chEmisoraUp[32] ={300,750,300,750,300,1800,200,850,300,750,250,750,300,750,300,750,300,1800,300,1750,300,750,300,750,300,750,300,1800,250,750,300}; unsigned int chEmisoraDown[32] = {350,700,400,650,300,1750,350,700,350,700,350,700,300,750,300,700,350,700,300,750,350,1750,400,650,300,700,350,1750,300,750,300};

unsigned int playCd[32] = {400,650,400,650,350,1750,350,700,350,650,350,1750,350,1750,300,1750,400,1700,350,1750,350,700,350,650,400,650,350,1750,450,600,350};

//These codes are for controlling the Tv

unsigned int pwrTv[68]={4600,4350,700,1550,650,1550,650,1600,650,450,650,450,650,450,650,450,700,400,700,1550,650,1550,650,1600,650,450,650,450,650,450,700,450,650,450,650,450,650,1550,700,450,650,450,650,450,650,450,650,450,700,400,650,1600,650,450,650,1550,650,1600,650,1550,650,1550,700,1550,650,1550,650}; // volume up unsigned int volUpTv[68]={4600,4350,650,1550,700,1500,700,1550,700,400,700,400,700,450,650,450,700,400,700,1500,700,1550,650,1550,700,400,700,400,700,450,650,450,700,400,700,1500,700,1550,650,1550,700,400,700,450,700,400,700,400,700,400,700,450,650,450,650,450,650,1550,700,1500,700,1550,700,1500,700,1550,650}; // volume down unsigned int volDownTv[68]={4600,4350,700,1550,650,1550,700,1500,700,450,650,450,700,400,700,400,700,400,700,1550,700,1500,700,1550,700,400,700,400,700,400,700,450,650,450,650,1550,700,1500,700,450,650,1550,700,400,700,400,700,450,700,400,700,400,700,400,700,1550,700,400,700,1500,700,1500,700,1550,700,1500,700}; // channel up unsigned int chUpTv[68]={4600,4350,700,1500,700,1500,700,1550,700,450,650,400,700,450,650,450,700,400,700,1500,700,1550,650,1550,700,450,650,450,700,400,700,400,700,400,700,400,700,1550,700,400,700,400,700,1550,650,450,700,400,700,400,700,1550,650,450,650,1600,650,1550,650,450,700,1500,700,1500,700,1550,650}; // channel down unsigned int chDownTv[68]={4650,4300,700,1550,700,1500,700,1550,700,400,700,400,700,400,700,450,650,450,650,1550,700,1500,700,1550,700,400,700,400,700,400,700,450,700,400,700,400,700,400,700,450,650,450,650,1550,700,400,700,450,650,400,700,1550,700,1500,700,1550,700,1500,700,400,700,1550,650,1550,700,1500,700};

// Tv/Video unsigned int videoTv[68]={4500,4300,650,1600,650,1550,650,1600,650,500,600,500,650,500,650,500,650,500,600,1650,600,1600,650,1550,650,500,650,500,650,500,600,500,650,500,650,1600,600,500,650,500,650,500,650,500,600,550,600,500,650,500,650,500,650,1550,650,1600,650,1550,650,1600,650,1550,650,1600,650,1550,650};

void setup()

{

Serial.begin(9600);

}

void loop()

{

if(Serial.available()>0)

{ dato=Serial.read();

switch (dato)

{ case 'R':

ir.sendRaw(powerEquipo,32,38);

delay(500);

break;

case 'T':

ir.sendRaw(chEmisoraUp,32,38);

delay(100);

break;

case 'U':

ir.sendRaw(chEmisoraDown,32,38);

delay(100);

break;

case 'V':

ir.sendRaw(playCd,32,38);

delay(100);

break;

case 'K':

//Power the TV

ir.sendRaw(pwrTv,68,38);

delay(100);

break;

case 'L':

//Volume +

ir.sendRaw(volUpTv,68,38);

delay(100);

break;

case 'M':

//Volume -

ir.sendRaw(volDownTv,68,38);

delay(100);

break;

case 'N':

//Channel +

ir.sendRaw(chUpTv,68,38);

delay(100);

break;

case 'O':

//Channel -

ir.sendRaw(chDownTv,68,38);

delay(100);

break;

case 'P':

// Tv/Video

ir.sendRaw(videoTv,68,38);

delay(100);

break;

case 'A':

for (int i = 0; i < 3; i++)

{

ir.sendNEC(0xFF30CF, 32); // Power the DVD

delay(40);

}

break;

case 'B':

for (int i = 0; i < 3; i++)

{

ir.sendNEC(0xFF00FF, 32); // Open /Close

delay(40);

}

break;

case 'C':

for (int i = 0; i < 3; i++)

{

ir.sendNEC(0xFF52AD, 32); // Play

delay(40);

}

break;

case 'D':

for (int i = 0; i < 3; i++)

{

ir.sendNEC(0xFF728D, 32); // Stop

delay(40);

} break;

} // fin del switch

} //fin del if

}//fin del loop

Credits

Jose Luis Bejarano Vasquez

Jose Luis Bejarano Vasquez

5 projects • 17 followers
Electronic technologist, software developer and robotic lover.

Comments