loading

The purpose of this project is turn on an output when the "UP" key is pressed on a remote control transmitter and turn off the same output when the "DOWN" key is pressed. Such an experiment has various applications associated with home automation.

Step 1: RC5 Protocol

For this, the RC5 protocol was used, in which the link below for all operating details of it.


www.sbprojects.com/knowledge/ir/rc5.php

Step 2: TSOP4838 Sensor

The TSOP4838 sensor allows you to receive infrared frequency of 38 kHz. It is prepared for detecting the bits "1" and "0" coming from the remote control of a TV, for example. More information about it can be found in the next link.

www.vishay.com/docs/82459/tsop48.pdf

Connect the sensor supply and the OUT pin of it to a digital input any Intel Edison (the Grove kit was used). In this example, the entry "AN0" was used.

Step 3: Arduino Code

The following code receives the frame on RC5. If the board received the system code 5 and 16 command the relay will be triggered and if received the system code 5 and 56 command code the relay is switched off. Note that such a code can vary according to the remote control used is recommended print the system via serial code and to verify the received command code, and so adjust the code.

//Intel Iot Roadshow Nov/2015 - Brazil

//Autores: Vitor Amadeu e Renata Leal

/* * * * * * * * * * * * * * Declaração de I/Os * * * * * * * * * * * * * */

#define RC_5 A0

#define RELE1 3

#define TEMPO 890 char le_bit(void);

/* * * * * * * * * * * * * * Função de inicialização * * * * * * * * * * * * * */

void setup(void) {

pinMode(RC_5,INPUT_PULLUP);

pinMode(RELE1,OUTPUT);

Serial.begin(9600);}

/* * * * * * * * * * * * * * Função de loop * * * * * * * * * * * * * */

void loop(void) { i

if (digitalRead(RC_5)==0) {

char comando=0,sistema=0;

delayMicroseconds(4000);

sistema=sistema|le_bit()<<4;

sistema=sistema|le_bit()<<3;

sistema=sistema|le_bit()<<2;

sistema=sistema|le_bit()<<1;

sistema=sistema|le_bit()<<0;

comando=comando|le_bit()<<5;

comando=comando|le_bit()<<4;

comando=comando|le_bit()<<3;

comando=comando|le_bit()<<2;

comando=comando|le_bit()<<1;

comando=comando|le_bit()<<0;

if(sistema==5 && comando==16)

digitalWrite(RELE1,1);

if(sistema==5 && comando==56)

digitalWrite(RELE1,0);}

}

/* * * * * * * * * * * * * * Função para ler bit * * * * * * * * * * * * * */

char le_bit(void) {

char last_rx=1;

delayMicroseconds(890);

if (digitalRead(RC_5))

last_rx=0;

delayMicroseconds(890);

return(last_rx);

}

Step 4: Testing the Example

Connect a LED or relay to the digital piano defined in the code and see if it turns on when the "UP" button is pressed and off when the "DOWN" is activated. After testing with an LED, connect a relay to drive loads like lamps, and such application is used to automate a residence (home automation).

About This Instructable

740views

12favorites

License:

More by cerne-tecnologia:Automação residencial (Domótica) com Intel Edison Home automation with Intel Edison LCD Display on Arduino 
Add instructable to: