Introduction: Control Your Arduino With a Remote
Wondering about how to control anything in your house with a simple remote control? It's pretty simple and cheap.
Step 1: Collect Stuff
Here is what you will need:
- Arduino (I use UNO)
- Solderless breadboard
- An infrared receiver
- Solderless wires
- Any kind of remote control
- Arduino (I use UNO)
- Solderless breadboard
- An infrared receiver
- Solderless wires
- Any kind of remote control
Step 2: Assemble the Receiver
Plug in the ir receiver to the beradboard and connect it to your Arduino.
Connect the right pin to the 5V of the Arduino, the center pin to GND, and the left pin to digital pin 11.
Connect the right pin to the 5V of the Arduino, the center pin to GND, and the left pin to digital pin 11.
Step 3: The Code
I used the IRremote library for arduino.
You can download it here: IRremote
Close the Arduino IDE and unzip it into the arduino/libraries folder.
Start Arduino IDE and open the IRrecvDemo example sketch. Rewrite "HEX" to "DEC" as the image shows.
Upload the sketch to your board.
You can download it here: IRremote
Close the Arduino IDE and unzip it into the arduino/libraries folder.
Start Arduino IDE and open the IRrecvDemo example sketch. Rewrite "HEX" to "DEC" as the image shows.
Upload the sketch to your board.
Step 4: Identify Remote Buttons
After uploading the program open the serial monitor and start pushing the buttons on your remote. If you have done everything well, you have to see the codes appearing.
Remember which button was pressed and take notes of the codes appearing.
For example:
Code 50088119 appeared and you pressed the On/Off button.
Code 50073839, Open/Close button etc...
Remember which button was pressed and take notes of the codes appearing.
For example:
Code 50088119 appeared and you pressed the On/Off button.
Code 50073839, Open/Close button etc...
Step 5: Control Stuff
Now you know which code the buttons give. To control something you have to write them into the program.
Here is the code you have to use. It's not the best solution I think but it's simple.
switch(results.value){
case 50088119:
// do something
break;
case 50073839:
// do something else...
break;
}
Have fun ;)
Here is the code you have to use. It's not the best solution I think but it's simple.
switch(results.value){
case 50088119:
// do something
break;
case 50073839:
// do something else...
break;
}
Have fun ;)