Introduction: Universal Remote Control Using Arduino, 1Sheeld and Android Mobile
This project illustrates how to control your TV, Satellite receiver and Stereo using your Android mobile instead of using there remote control.
Basically, you can apply this technique for any other devices work with remote control. I was wondering to use my mobile to control all the device in the home in stead of using the remote of each device.
Now you can control as much as you want of your home remote devices by only 1 application on your mobile!
Step 1: Components
1- Arduino Uno (or any other arduino board) (25$)
2- 1Sheeld (55$) (here is the website of 1Sheeld for the getting starting tutorials and documentation)
3- IR Receiver (1.95$)
4- IR Led (0.95$)
5- Android Mobile phone
Step 2: Android Application
Basically, All we have to do in this step is to download the android application from google play store.
Step 3: Decoding Your Remote
The transmitter in the remote control handset sends out a stream of pulses of infrared light when the user presses a button on the handset. A transmitter is often a light emitting diode (LED) which is built into the pointing end of the remote control handset. The infrared light pulses form a pattern unique to that button. The receiver in the device recognizes the pattern and causes the device to respond accordingly (Wikipedia).
So we have to know that unique pattern of each button.
Simply, you have to download the IR libraryfor Arduino.
In the examples of that library, you can find IRrecvDump example (as illustrated in the third image). This code used to encode data from remote control.
You have to wire the IR receiver. As shown in it's figure:
1- Ground
2- 5V
3- Pin 11
After uploading this code to the Arduino open the serial monitor and press any button on your TV remote, you will find something as in the fifth image image.
As shown in the fourth image, you can find the hex code that refer to each button of the remote control. Write down these hex numbers corresponding to its function (e.g. 20DFC03F ,32 refers to power button).
Note, If you get "unknown encoding", press the button again.
Step 4: Android Sketch
Now, We have to upload the code that is used to transmit the commands to our devices. You can find the code but you will make a small change depends on your remote.
All you have to do here is to replace by hex values as (0x20DF10EF) by the values you have got from the power button, volume up/down buttons and any other button you want.
Since 1Sheeld mobile application doesn't have a remote control interface, I used the KeyPad shield as the remote controller, you can choose the Keyboard shield as well for much more devices.
#include <OneSheeld.h> #include <IRremote.h> IRsend irsend; void setup() { OneSheeld.begin(); } void loop(){ if(Keypad.isRowPressed(0) && Keypad.isColumnPressed(0)) { irsend.sendNEC(0x20DF10EF, 32); } else if(Keypad.isRowPressed(0) && Keypad.isColumnPressed(1)) { irsend.sendNEC(0x20DFC03F, 32); } else if(Keypad.isRowPressed(0) && Keypad.isColumnPressed(2)) { irsend.sendNEC(0x20DF40BF, 32); } else if(Keypad.isRowPressed(1) && Keypad.isColumnPressed(1)) { irsend.sendNEC(0x41048B7, 32); } else if(Keypad.isRowPressed(1) && Keypad.isColumnPressed(0)) { irsend.sendNEC(0x410C837, 32); } else if(Keypad.isRowPressed(2) && Keypad.isColumnPressed(0)) { for (int i = 0; i < 3; i++) { irsend.sendSony(0xa81, 12); // Sony TV power code delay(40); } } }
Step 5: Testing
Finally, you use the IR LED at pin 3 in Arduino and Place it next to the in front of the devices as shown.
Now Open 1Sheeld mobile application and connect it with the shield and then choose the keypad shield, all of these shown in the video.
Now, by pressing the buttons on your mobile phone it will make the corresponding task whether to power on, volume up, volume down, ....etc.
11 Discussions
4 years ago
hello, can this project turning on the desktop PC?
5 years ago on Introduction
I am getting an error of OneSheeld not declared in the scope and keypad not declare, although I have added the req libraries.
5 years ago on Introduction
I would just build a keypad for cheaper
6 years ago on Introduction
can you please help ??? :S i canot varify the code :S
#include <OneSheeld.h>
#include <IRremote.h>
IRsend irsend;
void setup()
{
OneSheeld.begin();
{
void loop(){
if(Keypad.isRowPressed(1) && Keypad.isColumnPressed(1))
{
irsend.sendNEC( 8C837, 32);
}
else if(Keypad.isRowPressed(0) && Keypad.isColumnPressed(1))
{
irsend.sendNEC( 88877 , 32);
}
else if(Keypad.isRowPressed(1) && Keypad.isColumnPressed(2))
{
irsend.sendNEC( 828D7 , 32);
}
else if(Keypad.isRowPressed(1) && Keypad.isColumnPressed(0))
{
irsend.sendNEC( 848B7 , 32);
}
else if(Keypad.isRowPressed(2) && Keypad.isColumnPressed(1))
{
irsend.sendNEC( 8A857 , 32);
}
else if(Keypad.isRowPressed(1) && Keypad.isColumnPressed(3))
{
irsend.sendNEC( 20DF10EF , 32);
}
else if(Keypad.isRowPressed(3) && Keypad.isColumnPressed(1))
{
irsend.sendNEC( 20DFD02F , 32);
}
else if(Keypad.isRowPressed(0) && Keypad.isColumnPressed(0))
{
irsend.sendNEC( 8F807 , 32);
}
else if(Keypad.isRowPressed(2) && Keypad.isColumnPressed(0))
{
irsend.sendNEC( 802FD , 32);
}
else if(Keypad.isRowPressed(0) && Keypad.isColumnPressed(2))
{
irsend.sendNEC( 20DF40BF , 32);
}
else if(Keypad.isRowPressed(2) && Keypad.isColumnPressed(2))
{
irsend.sendNEC( 20DFC03F , 32);
}
else if(Keypad.isRowPressed(0) && Keypad.isColumnPressed(3))
{
irsend.sendNEC( 800FF , 32);
}
}
Reply 6 years ago on Introduction
Actually, there is 2 problems:
1- you have to change the bracket after "OneSheeld.begin();" form "{" to "}" to close the function
2- you have also before each code to put "0x" ,, for example instead of
irsend.sendNEC( 8C837, 32); change to
irsend.sendNEC( 0x8C837, 32);
Try these and of there is any problems please tell me
Reply 6 years ago on Introduction
I LOVE YOU :D :D :D but why should i do that 0x ???
Reply 6 years ago on Introduction
Thanks a lot :) ,,, Because these values are in hexadecimal ,,, so you have to put 0x to make Arduino recognize that point
http://arduino.cc/en/Reference/IntegerConstants
6 years ago on Introduction
That's interesting. Thanks for sharing this!
Reply 6 years ago on Introduction
thanks a lot and I hope you can try it :)
6 years ago
just to clarify, the phone can't interface directly with the device.. IE. tv
Reply 6 years ago on Introduction
actually, no the phone interface with 1Sheeld and arduino using Bluetooth and then the arduino transimt the code to the TV