Hello everyone. In this simple project we will use Arduino Leonardo to control a computer's mouse. Using a bluetooth module, that is attached to the Arduino, we are able to wirelessly connect it to an Android mobile so that we can use the phone as a mouse.
The following items are needed to finish this project:
- Arduino Leonardo
- JY-MCU Bluetooth module
- Jumper wires
- USB cable
- Computer and an Android phone
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Arduino and JY-MCU
We decided to use Leonardo rather than UNO or other Arduino models, because it is detected as HID device that can be used in mouse and keyboard projects.
JY-MCU bluetooth module is relatively cheap PCB that enables you to add bluetooth capabilities to your projects. We assume the reader is able to configure this module. However, if you find yourself unfamiliar with it, minimum googling skills become handy here.
In general, the module has 4 pins:
Step 2: Connecting the Components
According to the provided picture, the connections go as follows:
- Power goes to 5v (Although it is written as 3.3v, I have managed to connect it to 5v without frying it, check your version first, mine is 1.06).
- GND goes to GND on Arduino.
- Tx goes to pin 9.
- Rx goes to pin 8.
Step 3: The Sketch and Appliction
The code is simple, first I have set up a serial communication on pins 8 and 9, then I made a function that takes a letter and performs an action according to this letter.
The apk file of the application is provided as well, you can install it on your mobile and start using it or alternatively, you can download the source code and adopt it for your own purpose.
And that's it, happy making and see you in another Instructable,