8
433 MHz RF module with Arduino Tutorial 4: ADVERTENCIA: Por favor, compruebe si puede utilizar legalmente transmisores de RF y receptores en su localidad antes de intentar este proyecto (o la compra de los componentes). Este proyecto está dirigido a aquellos que están buscando para automatizar su hogar. Continuando desde mi anterior "transmisor y receptor de 433 MHz" tutoriales ( 1 , 2 y 3 ): He tirado la necesidad de procesar la señal con un ordenador. Esto significa que ahora podemos obtener el Arduino para grabar la señal de un control remoto RF (muy cerca), y reproducirlo en ningún momento a todos. El Arduino olvidará la señal cuando apaga o cuando se restablece el tablero. El Arduino no tiene una extensa memoria - hay un límite al número de señales se pueden almacenar en el tablero en un momento dado. Algunas personas han optado por crear un "código" en sus proyectos para ayudar a maximizar el número de señales almacenadas en el tablero. En el nombre de la simplicidad, no voy a codificar la señal como lo hice en mis tutoriales anteriores. Voy a tener el Arduino para grabar la señal y reproducirla - con la ayuda de un botón. El botón le ayudará a gestionar el proceso global, y controlar el flujo de código. Aparte de la posibilidad de subir el boceto para el Arduino, este proyecto no requerirá el uso de una computadora. Tampoco se necesita una tarjeta de sonido, o cualquier bibliotecas especializadas. Aquí están las piezas necesarias: Piezas necesarias: UNO Arduino o junta compatibles Breadboard Botón El rojo y el LED verde 330 ohmios (s) Alambres Módulo de RF (433 Mhz) - Transmisor y receptor par o la versión de 315 Mhz Ventilador de techo Mercator / luz con control remoto WARNING: Please check whether you can legally use RF transmitters and receivers at your location before attempting this project (or buying the components). This project is aimed at those who are looking to automate their home. Carrying on from my previous "433MHz transmitter and receiver" tutorials (1 ,2 & 3 ): I have thrown away the need to process the signal with a computer. This means that we can now get the Arduino to record the signal from an RF remote (in close proximity), and play it back in no time at all.

433 MHz RF Module With Arduino Tutorial 4

Embed Size (px)

DESCRIPTION

Grabar señal RF de control remoto con arduino

Citation preview

433 MHz RF module with Arduino Tutorial 4:

ADVERTENCIA: Por favor, compruebe si puede utilizar legalmente transmisores de RF y receptores en su localidad antes de intentar este proyecto (o la compra de los componentes).Este proyecto est dirigido a aquellos que estn buscando para automatizar su hogar.Continuando desde mi anterior "transmisor y receptor de 433 MHz" tutoriales (1,2y3): He tirado la necesidad de procesar la seal con un ordenador.Esto significa que ahora podemos obtener el Arduino para grabar la seal de un control remoto RF (muy cerca), y reproducirlo en ningn momento a todos.El Arduino olvidar la seal cuando apaga o cuando se restablece el tablero.El Arduino no tiene una extensa memoria - hay un lmite al nmero de seales se pueden almacenar en el tablero en un momento dado.Algunas personas han optado por crear un "cdigo" en sus proyectos para ayudar a maximizar el nmero de seales almacenadas en el tablero.En el nombre de la simplicidad, no voy a codificar la seal como lo hice en mis tutoriales anteriores.Voy a tener el Arduino para grabar la seal y reproducirla - con la ayuda de un botn.El botn le ayudar a gestionar el proceso global, y controlar el flujo de cdigo.Aparte de la posibilidad de subir el boceto para el Arduino, este proyecto no requerir el uso de una computadora.Tampoco se necesita una tarjeta de sonido, o cualquier bibliotecas especializadas.Aqu estn las piezas necesarias:

Piezas necesarias: UNO Arduino o junta compatibles Breadboard Botn El rojo y el LED verde 330 ohmios (s) Alambres Mdulo de RF (433 Mhz) - Transmisor y receptor paro laversin de 315 Mhz Ventilador de techo Mercator / luz con control remoto

WARNING: Please check whether you can legally use RF transmitters and receivers at your location before attempting this project (or buying the components). This project is aimed at those who are looking to automate their home.Carrying on from my previous "433MHz transmitter and receiver" tutorials (1,2&3): I have thrown away the need to process the signal with a computer. This means that we can now get the Arduino to record the signal from an RF remote (in close proximity), and play it back in no time at all.The Arduino will forget the signal when powered down or when the board is reset. The Arduino does not have an extensive memory - there is a limit to how many signals can be stored on the board at any one time. Some people have opted to create a "code" in their projects to help maximise the number of signals stored on the board. In the name of simplicity, I will not encode the signal like I did in my previous tutorials.I will get the Arduino to record the signal and play it back - with the help of a button. The button will help manage the overall process, and control the flow of code.Apart from uploading the sketch to the Arduino, this project will not require the use of a computer. Nor will it need a sound card, or any special libraries. Here are the parts required:

Parts Required: Arduino UNO or compatible board Breadboard Button Red and Green LED 330 ohm resistor(s) Wires RF Module (433 Mhz) - Transmitter and Receiver pairor the315 Mhz version Mercator Ceiling Fan/Light with Remote

Fritzing Sketch

Arduino Sketch

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99100101102103104105106107108109110111112113114115116117118119120121122123124125126127 /*433MHzRFREMOTEREPLAYsketchWrittenbyScottC24Jul2014ArduinoIDEversion1.0.5Website:http://arduinobasics.blogspot.comReceiver:XY-MK-5VTransmitter:FS1000A/XY-FSTDescription:UseArduinotoreceiveandtransmitRFRemotesignal-------------------------------------------------------------*/#definerfReceivePinA0//RF Receiver data pin = Analog pin 0#definerfTransmitPin4//RF Transmitter pin = digital pin 4#definebutton6//The button attached to digital pin 6#defineledPin13//Onboard LED = digital pin 13const int dataSize = 500; //Arduino memory is limited (max=1700)byte storedData[dataSize]; //Create an array to store the dataconst unsigned int threshold = 100; //signal threshold valueint maxSignalLength = 255; //Set the maximum length of the signalint dataCounter = 0; //Variable to measure the length of the signalint buttonState = 1; //Variable to control the flow of code using button pressesint buttonVal = 0; //Variable to hold the state of the buttonint timeDelay = 105; //Used to slow down the signal transmission (can be from 75 - 135)

void setup(){Serial.begin(9600); //Initialise Serial communication - only required if you plan to print to the Serial monitorpinMode(rfTransmitPin, OUTPUT); pinMode(ledPin, OUTPUT); pinMode(button, INPUT);}void loop(){buttonVal=digitalRead(button);if(buttonState>0 && buttonVal==HIGH){//Serial.println("Listening for Signal");initVariables();listenForSignal();}buttonVal=digitalRead(button);if(buttonState