20 March 2012

Arduino Remote Controlled Mouse and Keyboard

Today I'll be sharing a small hack I did about a year back. I'll be showing how you can control your PC's keyboard and mouse using an IR Remote and Arduino. Here's the youtube video of it in action: 

Parts list:
  1. IR based Remote(This could be a remote of a TV, DVD Player, AC, etc) 
  2. TSOP sensor
  3. One 100 ohms resistor
  4. Breadboard
  5. Connecting wires
  6. Arduino
  1. Visual Basic 2010 Express(get it for free here) or Visual Studio
  2. Arduino IDE
The connections are dead simple, all you need to do is connect three wires: 
Vcc is to be connected to Arduino 5V, GND to Arduino GND
TSOP Sensor

Download the complete source code from google code here.

Now, comes the major editing part. We'll be using the IR Remote library for Arduino by Ken Sheriff. This library helps in easy decoding of IR remote signals. You need to install this library(download link and setup instruction on the library page) and I recommend you to go through the examples and get a brief idea about how IR signals are getting decoded before proceeding further.

Since my remote used a non-standard protocol, I obtained the hash code for each button of my remote. Each key when pressed fires a series of precisely timed IR pulses and this pulse train is converted to a unique hash code by this library.

In Remote_Mouse.pde, you'll find that samsung_hash[] contains the hash code values of buttons of the samsung remote I had used. These hex values for buttons are different for every remote. So you'll need to use processKeys() inside loop() initially to obtain the hex values of buttons for your remote. After you obtain them, and update the code with your remote's hash code values, processMouse() can be used.

After you're done, to run the PC application, open MouseSimulator1.sln. I've used the MouseKeyBoard library by codeSummoner to emulate keyboard and mouse from the vb application. The program is well commented and is pretty basic.

Press F5 to run the program. Select your Arduino's com port and click on Start Remote Mouse.

Hope someone finds this useful.

Cheers! :)


  1. What is the basic difference between a Tsop sensor and if I use an IR sensor

    1. A IR sensor gives a high output whenever it detect IR light falling on it. But a TSOP IR sensor gives a high output only when an IR pulse of a particular frequency falls on it. Standard TSOP IR sensors work with 36-38 KHz IR pulse. All IR remotes emit IR pulses at this frequency.

  2. Sir ,I want to buy an ARM based kit, please suggest me a good one on which I'll be able to perform all embedded system experiments.

  3. Sorry, I don't have any idea about ARM based boards. Never used one myself.

  4. This comment has been removed by the author.

  5. Hi,

    I am interested in building this project but I cannot get this to work. I have one question. Does it matter what type of TSOP sensor you use?

    1. I believe it matters. I do not know what other types of TSOP sensors are available. I had used a TSOP 1738 sensor which I think is the most commonly used one.

  6. hola que tal... me pareciĆ³ bueno tu proyecto .. pero en realidad lo intente hacer pero no me hace nada..ya tengo el codigo y la aplicacion en .NET cual seria mi error..o no tiene que ver con los codigos hexadecimales de cada boton del control remoto que utilizo..!!! me urge mas informacion

  7. Hey, friend ! how are you ? i'm using a TSOP2838 and a Arduino UNO . But, all keys that i decode and put in the skecth, moves the cursor to down, only to down. Can you help-me ? Thanx in advance ! Greetings !