Wireless Keyboard With Arduino





Introduction: Wireless Keyboard With Arduino

Hi everyone, in this tutorial i am going to show how to build a wireless keyboard with arduino and bluetooth that allows to write remotely to our Pc with Os windows.

See video

The program only allows to send the following letters, due to limitations of the library used.:

  • Alphanumeric characters in lower and uppercase

  • Enter, Tab, delete and backspace.
  • up, down, left and right arrows.
  1. PARTS
  • Arduino One
  • Keyboard Ps2.
  • Bluetooth module HC-05.
  • Jumpers.

Step 1: Connect Ps2 Keyboard to Arduino

Following is the pin-out of the Connector. There are 4 wires coming
from the keyboard and their connections to arduino Digital pins are as follows.

PS2 connector - Arduino One

  • 5V (pin 4) - 5V
  • Ground (pin 3) - GND
  • Clock (pin 5) - Pin 2
  • Data (pin 1) - Pin 3

Downlad the Ps2Keyboard and import to the new sketch.

#include <PS2Keyboard.h>

Next step we are going to connect the bluetooth module...

Step 2: Become Wireless...

Lets use the pins 4 and 5 of the arduin for the serial communication, so there is to import the library SoftwareSerial:


#include <SoftwareSerial.h>


Create an object called blue and set the data rate in 9600.

SoftwareSerial blue(4,5); //Rx,Tx



The full code is:


#include <PS2Keyboard.h>
#include <SoftwareSerial.h>

char rec;

SoftwareSerial blue(4,5); //Rx,Tx

const int PinData = 3;

const int PinClock = 2;

PS2Keyboard teclado;

void setup()



teclado.begin(PinData, PinClock);



void loop()

{ // If the keyboard is available

if (teclado.available())

{ // Reads the pressed key

char c = teclado.read(); // Checks some special keys

if (c == PS2_ENTER)




else if (c == PS2_TAB)




else if (c == PS2_ESC)




else if (c == PS2_BACKSPACE)




else if (c == PS2_PAGEDOWN)




else if (c == PS2_PAGEUP)




else if (c == PS2_LEFTARROW)




else if (c == PS2_RIGHTARROW)




else if (c == PS2_UPARROW)




else if (c == PS2_DOWNARROW)




else if (c == PS2_DELETE)





{ // Print the normal characters






Download here the code for arduino.

Next step receive the keys send...

Step 3: Writing in Our Pc

For receiving the characters send by the keyboard we need a program that capture the data and send the keys to the desired program in our Pc. Download this program and follow the next steps for a correct communication between our Pc and the bluetooth module:

  1. Turn on the bluetooth in the Pc.
  2. Connect and pair the bluetooth module HC-05 with our PC.
  3. Open the configuration window of the bluetooth in the Pc, select the tab (ports com) and looks for the output port number. (This port number will be assigned to the serial port of the program in visual basic)
  4. Execute the program, select the port number of the last setp and press the connect (conectar )button.
  5. If you got no errors, open notepad for example, start to write in the keyboard and the pressed keys must be shown in the notepad.

Download here the program in visual basic 2010.

I hope you liked this project and vote for it in the sensor contest.

If you have any suggestions, comments please let me know it.



    • Epilog Challenge 9

      Epilog Challenge 9
    • Paper Contest 2018

      Paper Contest 2018
    • Pocket-Sized Contest

      Pocket-Sized Contest

    We have a be nice policy.
    Please be positive and constructive.




    can i use pro mini?

    If I want to use barcode scanner using usb, and I want long distance communication if you can help for tool and codeny