Instruction manuals

Control Any Circuit With a TV Remote and an Arduin

Description
Control Any Circuit With a TV Remote and an Arduino
Published
of 14
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Related Documents
Share
Transcript
  http://www.instructables.com/id/Control-Any-Circuit-With-a-TV-Remote-and-an-Arduin/  Food   Living   Outside   Play   Technology   Workshop Control Any Circuit With a TV Remote (and an Arduino) by DIY Hacks and How Tos  on March 18, 2014 Table of Contents Control Any Circuit With a TV Remote (and an Arduino) .................................................................................1 Intro: Control Any Circuit With a TV Remote (and an Arduino) .........................................................................2 Step 1: Materials ...........................................................................................................2 Step 2: Download and Install the IR Remote Library .................................................................................3 Step 3: The Arduino Code ....................................................................................................3 Step 4: The Circuit .........................................................................................................5 Step 5: Test the Circuit on a Breadboard .........................................................................................5 Step 6: Solder the Circuit Together on a Printed Circuit Board .........................................................................6 Step 7: Mount the Circuit in an Insulated Housing ..................................................................................6 Step 8: Use Your Remote Controlled Switch to Activate Appliances and Other Electronics ....................................................7 Step 9: Manually Insert IR Values into the Arduino Code (optional) .....................................................................8 Related Instructables ........................................................................................................8 Advertisements ...............................................................................................................9 Comments ................................................................................................................9  http://www.instructables.com/id/Control-Any-Circuit-With-a-TV-Remote-and-an-Arduin/  Author: DIY Hacks and How Tos  DIY Hacks & How Tos on YouTubeJason Poel Smith: Inventor, Maker, Hacker, Tinker, and occasional Mad Genius Intro: Control Any Circuit With a TV Remote (and an Arduino) Most of the buttons on a remote control are never used. So why not use them to control appliances and other electronics around your house. In this project, I am going toshow you how to use an Arduino to decode the signal from your remote and use it to make an outlet switch that can turn your electronics on and off.When you are done, you will be able to control lights, fans and even your coffee maker with your TV remote. Step 1: Materials Here are the materials and tools that you will need for this project: Materials: Arduino MicrocontrollerAC Power Adapter For the Arduino38 kHz Infrared Receiver Module (Radio Shack part# 276-640)Red LEDGreen LEDMomentary Pushbutton SwitchTwo 100 ohm Resistors10 kohm ResistorDiode5V Relay or Relay ShieldPrinted Circuit BoardPlastic Project HousingExtension Cord Tools: Wire StrippersSoldering Iron and SolderDrill and Bit SetSharp KnifeHot Glue Gun  http://www.instructables.com/id/Control-Any-Circuit-With-a-TV-Remote-and-an-Arduin/  Step 2: Download and Install the IR Remote Library This project uses an IR remote library that was developed by Ken Shirriff. This library lets you decode the signal coming from your remote. You can check out his srcinalproject and setup here: http://www.righto.com/2009/08/multi-protocol-infrared-remote-library.htmlThe first thing that you need to do for this project is download the library zip file. You can find it here: https://github.com/shirriff/Arduino-IRremoteClick Download ZIP on the right side of the page and save the zip file. Then unzip it. Rename the folder IRRemote (unless that name is already being used).Then copy the folder into your libraries directory. The libraries directory should contain the folder IRremote. If for some reason you already have a folder with this name,then you may need to rename it. The IRremote folder should contain the files. A lot of problems experienced when uploaded in the code, are caused be the library notbeing loaded in the correct location. Step 3: The Arduino Code  // Upload this code to your Arduino#include <IRremote.h>int RECV_PIN = 11;IRrecv irrecv(RECV_PIN);decode_results results;unsigned long CurrentValue = 0;unsigned long StoredCode = 0;const int buttonPin = 6; // the number of the pushbutton pinconst int ledPin = 4; // the number of the LED pinconst int outputPin = 3; // the number of the output LED pinconst int relayPin = 2; // the number of the relay pinint buttonState = 0; // variable for reading the pushbutton statusint RecordState = 0; //is the reciever in record modeint outputState = 1; //is the output on or offvoid setup(){Serial.begin(9600);irrecv.enableIRIn(); // Start the receiver // initialize the LED pin as an output:pinMode(ledPin, OUTPUT); // initialize the pushbutton pin as an input:  http://www.instructables.com/id/Control-Any-Circuit-With-a-TV-Remote-and-an-Arduin/  pinMode(outputPin, OUTPUT); // initialize the pushbutton pin as an input: pinMode(buttonPin, INPUT);pinMode(relayPin, OUTPUT); // initialize the pushbutton pin as an input: pinMode(buttonPin, INPUT);}void loop() { // read the state of the pushbutton value:buttonState = digitalRead(buttonPin); // if a signal is detected, store the valueif (irrecv.decode(&results)) {CurrentValue = (results.value); // if the recieved value equals the programed value, then toggle the output stateif(CurrentValue == StoredCode) {outputState = !outputState;} // if the record mode is activated store the current value as the programed valueif (RecordState == 1) {StoredCode = CurrentValue;RecordState = 0;digitalWrite(ledPin, LOW);Serial.println(StoredCode); //displays stored code for reference} // Receive the next valueirrecv.resume();}else //if no signal is detected, then the current value is 0{CurrentValue = 0;} // check if the record button is pressed. // if it is, the buttonState is HIGH:if (buttonState == HIGH) { //wait for the button to be releasedwhile (buttonState == HIGH) {buttonState = digitalRead(buttonPin);} //turn on the LED to indicate that record mode is ondigitalWrite(ledPin, HIGH);RecordState = 1;} //set the appropriate output stateif(outputState == 1) {digitalWrite(outputPin, HIGH);digitalWrite(relayPin, HIGH);}else {digitalWrite(outputPin, LOW);digitalWrite(relayPin, LOW);}}
Search
Similar documents
View more...
Tags
Related Search
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks