Using Arduino Leonardo As Mouse and Keyboard, Controll by Bluetooth.

Introduction: Using Arduino Leonardo As Mouse and Keyboard, Controll by Bluetooth.

About: motaz bany-amer!! jordan 2/7/1994 Yarmouk university - jordan work at Genotronex lab, IEEE YU Robotics Team, YES yarmouk engineering students, hijjawy art engineers. =-=-=-=-=-=-=-=-=-=-=-=-=-=-= facebookhtt…

One awsome feature in Arduino Leonardo, which make it special board, is that it can act as mouse and keyboard on computer. this could be usefull to controll the computer by different way, such as joy stick and here BLUETOOTH!

things used here are :

*Arduino Leonardo board

*USB cable

*HC-05 bluetooth adabter ( that i got from genotronex store - jordan)

In this project we gonna controll the computer mouse pointer and keyboard input from the arduino leonardo board.

this instructable is availble in arabic in genotronex blog.

Step 1: Connect the Bluetooth

the bluetooth adabter HC 05 use the serial comunication to connect to the arduino, so we gonna use #Software Serial library to connect to it.

the software Serial is much like the Arduino hardware Serial(that it done by UART) but here it done by software method.

as I defined the Software Serial Tx and Rx pins to 8 and 9

the bluetooth sould be connected :

bluetooth Tx to arduino Rx pin (pin9)

bluetooth Rx to arduino Tx pin(pin8)

as shown in the image.

to learn about the arduino Software Serial library you should refere to the Arduino Reference

Step 2: Leonardo As a Mouse

making leonardo appear as a mouse to the computer is much easy.

there is a Build-in library in the arduino, this library used with leonardo, DUE, and micro boards, and it so easy to work with.

to learn about it you should refer to Arduino Reference.

to work with bluetooth you need to other teminal, I used my android device to controll the arduino.

there is a good app in the store called Arduino Bluetooth Controller. this app connect to the HC 05 and send 'char' data to the arduino, and you can modify the char sent by each button on the app with "Set command".

Step 3: Leonardo As Keyboard

The same things done to make arduino appear as a mouse is done here, but you set it to act as a keyboard.

and here you should use a different app, one that send 'strings' not only some 'char'. I used an app called Bluetooth Terminal.

here I sent words from my android to arduino to be printed on the text editor.

this is all I have here.

ENJOY !

Be the First to Share

    Recommendations

    • Tinkercad to Fusion 360 Challenge

      Tinkercad to Fusion 360 Challenge
    • Science Fair Challenge

      Science Fair Challenge
    • Trash to Treasure Contest

      Trash to Treasure Contest

    6 Comments

    0
    naveensanju
    naveensanju

    10 months ago on Step 3

    Thanks!! Your tutorial was really easy to understand even for a complete beginner with no Programming background person like me. I have few questions.
    Recently I started making a Keyboard Encoder to use as a game controller for Arcade Mame and PC games using Arduino Leonardo. I used all the 20 digital keys for my 4 directional + 16 button controller. I tested it with my Android tv using USB port as well and it works really well.
    I want to turn my controller to be used both as USB or bluetooth. I saw your tutorial and it looks like what I need.
    I am currently using both my Tx and Rx as digital key for 2 buttons.
    Is there a way that I can use Rx and Tx pin for buttons as well as for bluetooth just you mentioned above? And if I turn my controller to bluetooth, will I be able to use it as USB controller when I want?
    If I connect the bluetooth controller to PC, will it be auto detect and can communicate with PC just like we connect Android phone to windows?
    My TV is an android smart TV but he has no Bluetooth. So I will be using a USB dongle on Tv to make it Bluetooth capable? With your tutorial, will it connect to android Tv(Tv will be using Usb bluetooth dongle)?

    Guide me in this regard as I am a complete beginner with no electronics background :)

    0
    banjing
    banjing

    4 years ago

    Hi, nice tutorial. But i wanna ask, do you have tutorial controlling mouse using push button? it should b wireless. Thanks