Mturk Jobs

Mturk Jobs
Mturk Jobs

Tank

Friday, December 8, 2017

PS2 Keyboard Bluetooth interface to Android Smartphone

Do you like using the keyboard to record your thoughts and to code?

Have you ever thought of using the normal sized keyboard to type in your Android smartphone?

Can you make an Arduino project that connects your favorite keyboard with your smartphone via Bluetooth connection?

Today I came to the idea and loved it very much.

It's very simple to implement.

Using Arduino mini and HC-06 Bluetooth module and connect them to the PS2 keyboard.

You can then read text from keyboard and send it wirelessly to the smartphone.


Here is the PS2 Connection to Arduino and code for this project.

This project can be found on Arduino platform

https://playground.arduino.cc/Main/PS2Keyboard


And here is the connection for it.







Note:

Make sure you connect the Clock PIN to the digital PIN 3 on the Arduino. Otherwise the interrupt, and therefore the whole library, won't work.

In this project, we used the The PS2Keyboard library.

Usage:

This is sample code;

#include

#define DATA_PIN 4
PS2Keyboard keyboard;

void setup() {
  keyboard.begin(DATA_PIN);

  Serial.begin(9600);
  Serial.println("hi");
  delay(1000);
}

void loop() {
  if(keyboard.available()) {
    byte dat = keyboard.read();
    byte val = dat - '0';

    if(val >= 0 && val <= 9) {
      Serial.print(val, DEC);
    } else if(dat == PS2_KC_ENTER) {
      Serial.println();
    } else if(dat == PS2_KC_ESC) {
      Serial.println("[ESC]");
    } 
  }

}


HC-06 Bluetooth Module to Arduino Mini Connection




HC-06ARDUINO
VCC->+3.3V
GND->GND
TX->2
RX->3




 HC-06 ----- Arduino


VCC   ---   3.3v 


 GND --- GND 


TXD   ---   RXD 


RXD   ---   TXD



Now we can add the stuff together to make our complete project.

PS2 Keyboard

Adruino Mini Pro

HC-06 Bluetooth Module

3.7V Li-Poly Battery

Android Smartphone

Android App : Arduino Bluetooth Control
Arduino Bluetooth Control App


Cover art




No comments:

Tank