Make A Wireless Keyboard By Hacking Your Tv Remote

About the project

This Project Utilizes IR, or infrared wireless communication technology to Build a Wireless Keyboard.

Connectivity  Contest WinnerConnectivity contest winner

Project info

Difficulty: Easy

Platforms: Arduino

Estimated time: 1 hour

License: GNU General Public License, version 3 or later (GPL3+)

Items used in this project

Hardware components

Arduino Micro & Genuino Micro Arduino Micro & Genuino Micro You can use Any Boards based on ATmega32U4 like Arduino Leonardo. x 1
IP RECEIVER TSOP2238 38 KHZ PHOTODIODE IP RECEIVER TSOP2238 38 KHZ PHOTODIODE TSOP1738 IR Receiver x 1
IR Remote IR Remote Any IR Remot can be used. x 1
Jumper Wires Jumper Wires As per your Requirements x 1

Software apps and online services

Arduino IDE Arduino IDE

Story

IR, or infrared, communication is a common, inexpensive, and easy to use wireless communication technology. IR light is very similar to visible light, except that it has a slightly longer wavelength. This means IR is undetectable to the human eye - perfect for wireless communication.

The Basic Idea of this project is when you hit a button on your TV remote, by using a IR receiver and a Arduino we can decode it and the decoded values can be utilized to perform different Key Board Operations. I Used Arduino Pro Micro Because it is based on the ATmega32U4 microcontroller featuring a built-in USB which makes the Micro recognizable as a mouse or keyboard. You can use Arduino Leonardo also.

This Project is very simple and any one can modify as per requirements.

Components Used:

  • Arduino Pro Micro

The Micro is a microcontroller board based on the ATmega32U4 , It has 20 digital input/output pins (of which 7 can be used as PWM outputs and 12 as analog inputs), a 16 MHz crystal oscillator, a micro USB connection, The Micro board is similar to the Arduino Leonardo in that the ATmega32U4 has built-in USB communication, eliminating the need for a secondary processor. This allows the Micro to appear to a connected computer as a mouse and keyboard.

  • IR Receiver (TSOP1738)

It is a miniaturized receiver for infrared remote control systems. The demodulated output signal can be directly decoded by a microprocessor. The TSOP1738 is compatible with all common IR remote control data formats.

 Circuit Diagram :

If you are using Leonardo there will be small change in the DATA pin .You need to connect data Pin into the MOSI pin of Leonardo.

Installing IR Remote Library :

  Download IR Remote Library From  here and install it.

If you don't know how to install additional arduino libraries follow below link

https://www.arduino.cc/en/Guide/Libraries

Decoding IR remote signals:

To decode signals from IR remote we can use "IRrecvDemo "arduino sketch as given with the IR Remote Library.

Note:

On example sketch (IRrecvDemo) you need to make small change in int RECV_PIN value . By Default it will be 11 but on Arduino Micro the MOSI pin is 16th pin. So make following modification.

  1. int

    RECV_PIN

    =

    16

    ;

If You are using Leonardo you need to change it to MOSI pin number.

  • Select Board( Arduino/Genuino Micro)

  • Select Port

  • Upload Your code

  • Open Serial Monitor and obtain the IR Remote Signal values

Note Down the values for each button .

What's Next-The Code!

After obtaining signal values next step is to add the signal values into the program and make condition that if signal value from remote matches with the values in the program then, perform different keyboard operations.

Adding Keyboard Library to the program enables it to perform different keyboard Operations.

  1. //this is sample code that shows some example keyboard operaions

  2. #include

  3. #include

  4. int

    RECV_PIN

    =

    16

    ;

  5. IRrecv

    irrecv

    (

    RECV_PIN

    );

  6. decode_results results

    ;

  7. void

    setup

    ()

  8. {

  9. Serial

    .

    begin

    (

    9600

    );

  10. irrecv

    .

    enableIRIn

    ();

    // Start the receiver

  11. Keyboard

    .

    begin

    ();

  12. }

  13. void

    loop

    ()

    {

  14. if

    (

    irrecv

    .

    decode

    (&

    results

    ))

  15. {

  16. switch

    (

    results

    .

    value

    )

  17. {

  18. //The power button is used to unlock your PC

  19. case

    0x1FE48B7

    :

    Keyboard

    .

    print

    (

    "P@@sW0rD"

    );

    // add your PC's Password here

  20. Keyboard

    .

    press

    (

    KEY_RETURN

    );

    //Enter Key

  21. delay

    (

    100

    );

  22. Keyboard

    .

    releaseAll

    ();

  23. break

    ;

  24. //Backward key is used for left key operation

  25. case

    0x1FE40BF

    :

    Keyboard

    .

    press

    (

    KEY_LEFT_ARROW

    );

    //left key

  26. delay

    (

    100

    );

  27. Keyboard

    .

    releaseAll

    ();

  28. break

    ;

  29. //Forward Key is used for right key operation

  30. case

    0x1FEC03F

    :

    Keyboard

    .

    press

    (

    KEY_RIGHT_ARROW

    );

    //right key

  31. delay

    (

    100

    );

  32. Keyboard

    .

    releaseAll

    ();

  33. break

    ;

  34. //Space bar operaion , It can be used for pause/play -0th key

  35. case

    0x1FEE01F

    :

    Keyboard

    .

    write

    (

    32

    );

    //space bar operation

  36. delay

    (

    100

    );

  37. Keyboard

    .

    releaseAll

    ();

  38. break

    ;

  39. //Select all operation(Ctrl+a)-1st key

  40. case

    0x1FE50AF

    :

    Keyboard

    .

    press

    (

    KEY_LEFT_CTRL

    );

    //Ctrl key

  41. Keyboard

    .

    write

    (

    97

    );

    // ascii value of 'a' is 97

  42. delay

    (

    100

    );

  43. Keyboard

    .

    releaseAll

    ();

  44. break

    ;

  45. //Copy Operation(Ctrl+c) -4th key

  46. case

    0x1FE30CF

    :

    Keyboard

    .

    press

    (

    KEY_LEFT_CTRL

    );

    //Ctrl key

  47. Keyboard

    .

    write

    (

    99

    );

    //ascii value of 'c' is 99

  48. delay

    (

    100

    );

  49. Keyboard

    .

    releaseAll

    ();

  50. break

    ;

  51. //Paste Operation(Ctrl+v)-7th key

  52. case

    0x1FE00FF

    :

    Keyboard

    .

    press

    (

    KEY_LEFT_CTRL

    );

    //Ctrl key

  53. Keyboard

    .

    write

    (

    118

    );

    //ascii value of 'v' is 118

  54. delay

    (

    100

    );

  55. Keyboard

    .

    releaseAll

    ();

  56. break

    ;

  57. //closes opened tab

  58. case

    0x1FE9867

    :

    Keyboard

    .

    press

    (

    KEY_LEFT_ALT

    );

    //Alt Key

  59. Keyboard

    .

    press

    (

    KEY_F4

    );

    //F4 Key

  60. delay

    (

    100

    );

  61. Keyboard

    .

    releaseAll

    ();

  62. break

    ;

  63. }

  64. irrecv

    .

    resume

    ();

    // Receive the next value

  65. }

  66. }

  • Upload above code

Done!

You can modify the above sketch as per your requirements .

Refer below links to add more keyboard functions

The below video shows some cool application of this project.

Otherwise you can visit my GitHub Page 

here

Thank you so much for reading if you need any more information feel free to ask in comments,and I'll do my best answer you.

Schematics, diagrams and documents

Schematics Diagram

CAD, enclosures and custom parts

Fritzing File

Go to download

Code

Arduino Code

Credits

Photo of AmalMathew

AmalMathew

Maker,Believes in Open Source Concept

   

Leave your feedback...