AIR Mouse is also called gesture-controlled mouse and it works based on hand gesture. In this project an accelerometer is used for measuring the tilt of hand in X and Y direction and moves the cursor according the tilt.
In the project two types of circuit are used, one is the transmitter circuit and other is the receiver circuit. Transmitter circuit makes use of MPU6050 series of accelerometer, which is connected to Arduino through I2C communication. The data is transferred to receiver Circuit using RF module, ASK433. Two switches are also used in transmitter circuit to work as Left Click and Right Click.
In the receiver side an Arduino Leonardo is used. The purpose of using Arduino Leonardo is that it supports HID (Human Interface Device). HID allows us to control the mouse and Keyboard of our PC or Laptop.
In the project two circuits are used, one is the transmitter circuit and other is the receiver Circuit.
The transmitter circuit is placed in our hand. In this circuit, Arduino Nano is used which receives the data from accelerometer through I2C communication. MPU6050 is used in the transmitter circuit, which is accelerometer and supports I2C communication. SCL and SDA pins or accelerometer (MPU 6050) are connected to SCL and SDA pin of Arduino Nano, where SCL is A5 and SDA is A4 pins of Arduino. MPU 6050 have an INT pin, which is connected to interrupt (INT0) pin of Arduino that is D2.
Now data of accelerometer is transferred to receiver circuit using RF communication. For RF communication RF transmitter is used in transmitter side. Data pin of RF transmitter is connected to D4 pin of Arduino. An antenna is connected to ANT pin of RF transmitter. Antenna is nothing but only a 15 cm long single core wire.
Two switches are connected to D11 and D13 of Arduino that are Left Click and Right Click. This whole circuit is powered by 9-volt battery which is connected to Vin pin of Arduino through a switch.
If you are good in PCB Etching please use circuit provided below to build the project.
If you wish to build the circuit on universal PCB (ZERO PCB) or breadboard, use the design provided below.
In the receiver side, two major components used are the Arduino Leonardo and RF Receiver. Two switches are used for Enable/Disable the mouse and on/off the RF communication.
In the receiver circuit data pin of RF Receiver is connected to Interrupt pin (INT1) of Arduino, that is D2 pin.
A switch is used in the power line of RF Receiver, which is used for ON/OFF of the RF Receiver. Another switch is also connected to D4 pin of Arduino that is used to Enable/Disable the mouse. Arduino Leonardo is connected to PC through standard USB cable.
Circuit and PCB schematic are shown below.
You can order these PCB’s through PCBWay (we have designed them according to rules of PCBway).
In the transmitter side an Arduino Nano is used as the controlling unit. The accelerometer is connected to Arduino through I2C communication that measures the gravitational acceleration in X, Y and Z direction, but we need only values in two axis so we are using values of X and Y. Two switches are also connected to Arduino; they are used for Left and Right click. Arduino measures all the values, now we have four values
- Acceleration in X direction
- Acceleration in Y direction
- Status of Right click
- Status of left click
All the values are merged into an integer of four digits, where each digit shows each value.
In the receiver side, Arduino receives the data (integer) from transmitter and breaks into four values. Arduino Leonardo supports HID (Human Interface Device) so it moves the cursor according to values of X and Y.
In this project two Arduino are used one is in transmitter side and other is in receiver side.
In the transmitter side three header files are used and you can download the libraries from the link
- h : Already Attached
- h : For MPU6050 Accelerometer : https://github.com/jarzebski/Arduino-MPU6050
- h : For RF transmitter and receiver module : https://github.com/sui77/rc-switch
â€œRCSwitchâ€ is declared in line 5 and MPU6050 is declared in line 7. Two integers are declared for Left Click and Right click.
In the â€œvoid setup()â€ â€œserial.begin(115200)â€ is used for serial monitor. From line 16 to 20 â€œmpu6050â€ is checked, it helps for checking the wiring. After it a â€œcheckSettings()â€ function is used for checking the setting of â€œMPU6050â€. After that â€œmySwitch.enableTransmit(4)â€ is used for Enable the transmitter (RF transmitter module) which is connected to pin D4 of Arduino. At the end â€œpinModeâ€ function is used for declaring Left Click and Right as input.
A â€œvoid cleckSetting()â€ is declared, it is used for checking the setting of â€œMPU6050â€. This function is very long and complicated so we does not discuss this portion.
In the â€œvoid loop()â€ gravitational acceleration (normalized acceleration) is read from accelerometer. In line 72 and 73 values of X and Y is saved in integers that are processed values.
In the line 75 and line 76 status of left and Right Click is read and saved in integers. Now all the integers are merged in line 78 and saved in an integer and data is transmitted in line 80 over RF module.
At the staring of code two header files are used, first is used for the RF module and other (Mouse.h) is used for computer mouse.
In the line 4 â€œRCSwitchâ€ is named as â€œmySwitchâ€. Some integers are declared in line 6 where â€œrvalueâ€ is used for received data and â€œaâ€, â€œbâ€, â€œcâ€ and â€œdâ€ are the four values after breaking the â€œrvalueâ€. Two floats are also declared by name â€œxReadingâ€ and â€œyReadingâ€.
In the â€œvoid setup()â€ â€œmySwitch.enableReceivedâ€ is used for enable the receiver. After it â€œmouse.beginâ€ is used for starting the mouse. â€œpinModeâ€œ is used for declaring the pin D5 as input.
In the â€œvoid loop()â€ Â an “if” condition is used, process come in loop when data is available over RF communication. Now received data is assigned in an integer â€œrvalueâ€. In line 23 to 26 received data (rvalue) is divided into four integers â€œaâ€, â€œbâ€, â€œcâ€ and â€œdâ€. Where â€œcâ€ and â€œdâ€ are the value of acceleration in x and y direction, â€œaâ€ and â€œbâ€ are the status of left and right click.
From line 28 to line 44 values of â€œxReadingâ€ and â€œyReadingâ€ are declared according to values of â€œcâ€ and â€œdâ€. In the line 46 RF communication is reset.
From line 49 to line 51 cursor is moved according to values of â€œxReadingâ€ and â€œyReadingâ€, it will works when switch (connected to pin D4) is LOW. At the end left and right click is pressed according to values of â€œaâ€ and â€œbâ€.