APC Expert_ Arduino IR Remote Control - Controlar 4 Relays Con Un Control Remoto Infrerojo

4
27/2/2015 APC Expert: Arduino IR Remote Control Controlar 4 relays con un control remoto Infrerojo data:text/html;charset=utf8,%3Ch3%20class%3D%22posttitle%20entrytitle%22%20itemprop%3D%22name%22%20style%3D%22margin%3A%200px%3B… 1/4 Arduino IR Remote Control Controlar 4 relays con un control remoto Infrerojo Recomendar esto en Google Hoy les traigo un proyecto de como controlar un panel de 4 relays utilizando in control remoto infrarojo ( IR remote control ). se requiere tener la libreria del sensor infrerojo. Nota importante en esta libreria requiere una pequeña modificacion, solo cuando utilizas las verciones nuevas del programa de Arduino 1.0 y 1.0.1 en las anteriores no tendras problemas. La modificacion consiste en remplazar #include <WProgram.h> por #include <Arduino.h> en el archivo IRRemoteInt.h . Si tienen algun problema me abisan, con gusto los ayudare. Enlace: IR Reomote library Conecciones electricas: Pin 13 – canal 1 pin 12 – canal 2 pin 11 – canal 3 pin 10 – canal 4 pin 7 – señal del sensor infrarojo Estoy utilizando el Control remoto modelo YK001, lo pueden conseguir en ebay.com, en la imagen podrán ver los códigos de cada tecla, los necesitaran para su proyecto.

description

Arduino

Transcript of APC Expert_ Arduino IR Remote Control - Controlar 4 Relays Con Un Control Remoto Infrerojo

Page 1: APC Expert_ Arduino IR Remote Control - Controlar 4 Relays Con Un Control Remoto Infrerojo

27/2/2015 APC Expert: Arduino IR Remote Control ­ Controlar 4 relays con un control remoto Infrerojo

data:text/html;charset=utf­8,%3Ch3%20class%3D%22post­title%20entry­title%22%20itemprop%3D%22name%22%20style%3D%22margin%3A%200px%3B… 1/4

Arduino IR Remote Control ­ Controlar 4 relays con un controlremoto Infrerojo

Recomendar esto en Google

Hoy les traigo un proyecto de como controlar un panel de 4 relays utilizando in control remotoinfrarojo ( IR remote control ). se requiere tener la libreria del sensor infrerojo. Nota importante enesta libreria requiere una pequeña modificacion, solo cuando utilizas las verciones nuevas delprograma de Arduino 1.0 y 1.0.1 en las anteriores no tendras problemas.

La modificacion consiste en remplazar #include <WProgram.h>por #include <Arduino.h> en el archivo IRRemoteInt.h.

Si tienen algun problema me abisan, con gusto los ayudare.

Enlace: IR Reomote library

Conecciones electricas:Pin 13 – canal 1pin 12 – canal 2pin 11 – canal 3pin 10 – canal 4

pin 7 – señal del sensor infrarojo

Estoy utilizando el Control remoto modelo YK­001, lo pueden conseguir en ebay.com, en laimagen podrán ver los códigos de cada tecla, los necesitaran para su proyecto.

Page 2: APC Expert_ Arduino IR Remote Control - Controlar 4 Relays Con Un Control Remoto Infrerojo

27/2/2015 APC Expert: Arduino IR Remote Control ­ Controlar 4 relays con un control remoto Infrerojo

data:text/html;charset=utf­8,%3Ch3%20class%3D%22post­title%20entry­title%22%20itemprop%3D%22name%22%20style%3D%22margin%3A%200px%3B… 2/4

Con el siguiente sketch de Arduino podrán localizar los códigos de otros controles, los códigoslos podrán ver en el serial monitor, por si desean utilizar otro diferente:

//apcexpert.blogspot.com// IR Remote Control Code Finder#include <IRremote.h>int RECV_PIN = 7; //define input pin on ArduinoIRrecv irrecv(RECV_PIN);decode_results results;void setup()Serial.begin(9600);irrecv.enableIRIn(); // Start the receivervoid loop() if (irrecv.decode(&results)) Serial.println(results.value ); irrecv.resume(); // Receive the next value

Page 3: APC Expert_ Arduino IR Remote Control - Controlar 4 Relays Con Un Control Remoto Infrerojo

27/2/2015 APC Expert: Arduino IR Remote Control ­ Controlar 4 relays con un control remoto Infrerojo

data:text/html;charset=utf­8,%3Ch3%20class%3D%22post­title%20entry­title%22%20itemprop%3D%22name%22%20style%3D%22margin%3A%200px%3B… 3/4

Para finalizar, el Sketch de Arduino con el cual podremos controlar los cuatro relay como se veen la imagen superior;

// apcexpert.blogspot.com

#include <IRremote.h>

int RECV_PIN = 7;

int Relay1_PIN = 13;int Relay2_PIN = 12;int Relay3_PIN = 11;int Relay4_PIN = 10;

IRrecv irrecv(RECV_PIN);decode_results results;

void setup() pinMode(Relay1_PIN, OUTPUT); pinMode(Relay2_PIN, OUTPUT); pinMode(Relay3_PIN, OUTPUT); pinMode(Relay4_PIN, OUTPUT); pinMode(6, OUTPUT); irrecv.enableIRIn(); // Start the receiver

int on = 1;

Page 4: APC Expert_ Arduino IR Remote Control - Controlar 4 Relays Con Un Control Remoto Infrerojo

27/2/2015 APC Expert: Arduino IR Remote Control ­ Controlar 4 relays con un control remoto Infrerojo

data:text/html;charset=utf­8,%3Ch3%20class%3D%22post­title%20entry­title%22%20itemprop%3D%22name%22%20style%3D%22margin%3A%200px%3B… 4/4

void loop() if (irrecv.decode(&results)) if (results.value == 16724175) // YK­001 button 1 on = !on; digitalWrite(Relay1_PIN, on ? HIGH : LOW); if (results.value == 16718055) // YK­001 button 2 on = !on; digitalWrite(Relay2_PIN, on ? HIGH : LOW); if (results.value == 16743045) // YK­001 button 3 on = !on; digitalWrite(Relay3_PIN, on ? HIGH : LOW); if (results.value == 16716015) // YK­001 button on = !on; digitalWrite(Relay4_PIN, on ? HIGH : LOW); irrecv.resume(); // Receive the next value