Introduction: IR Remote Controle Your Laptop With Arduino UNO!!
Hello everybody.
In this tutorial, I’m going to teach you how you can turn your Arduino Uno into a remote control system for your laptop.
Step 1: What You Will Need
Beginner:
1. Arduino Uno
2. IR receiver
3. IR remote
4. Arduino software
Advanced:
5. Microsoft visual basic 2010 express.
6. Libraries
Step 2: Control an LED With the Remote
Now it is time to see how to set up the controlling process.
First of all we will see how to control an LED (pin 13) with the remote. Here is the code to visualize in the serial monitor of the Arduino software the code you sent with your remote. You must add in the if statement below, the "0x+code received" to say it’s hexadecimal
And before you can do all that, you must install the IR library, you can get it from (https://github.com/z3t0/Arduino-IRremote ).or you get it from here below.
For more information about this library go to: (https://www.pjrc.com/teensy/td_libs_IRremote.html ).
Special thanks for people how worked on that.
#include
int RECV_PIN = 3;
IRrecv irrecv(RECV_PIN);//irrecv is the receiver object, you can use whatever name you want
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
pinMode(13,OUTPUT);
}
void loop() {
if (irrecv.decode(&results)) {// irrecv.decode(&results) :Returns true if a code was received
Serial.println(results.value, HEX); //to view the code of the button you pushed in your IR remote.
if(results.value==0xFA08F7) // you must add the 0x to say its hexadecimal
{
digitalWrite(13,HIGH); //LED ON
else
digitalWrite(13,LOW); //LED OFF , if you pushed another button
delay(300);// this delay is here to avoid the 0xFFFFFFF
irrecv.resume (); // Receive the next value
}
}
Attachments
Step 3: Now for the Real Stuff :)
Now that you finished playing with your LEDs and relays, it’s time to play with your laptop.
In order to achieve the goal, we will use the special instruction in Visual basic “SendKeys.Send(“ “)” this with emulate pressing space in the laptop, then play your video on YouTube or in VLC. You see now:
Here is the important part of the code in VB
If data = "1" Then
SendKeys.Send(" ")
TextBox1.Text = "SPACE"
End If
The important part in the Arduino soft
if(results.value==0xFA10EF)
Serial.write('1');
Translation : for instance when you press a button that its code is” 0xFA10EF”,the Arduino will send ‘1’ to your laptop” serial port /communication).Then the software made by VB will receive 1 and will press space for you to play your favorite movie or to switch to another page in PowerPoint presentation ,great isn’t it.
Hey don’t worry; if you are lazy and you don’t want to learn Visual basic, I will give you the prepared soft to control your laptop ;)
Step 4: Arduitop
Now in the Arduino code you must configure your IR remote HEX code to fit in, it’s easy like we’ve seen in step 2 to control the led, all right. All the difference is instead of lighting an LED you will send a character to the laptop for the Arduitop.exe .
Send the code to your Arduino .When finished:
1. open arduitop.exe
2. select the COM your Arduino is connected to
3. click init button
Step 5: For Advanced (Visual Basic)
For advanced I don’t have to make a tutorial on this, but I will give you the full folder to see and adjust the code for your need.
Thank you.