In this instructable I will show you how to hack a mouse so you can use it as a controller for LED's, motors, wireless applications and so forth.
This tutorial will cover mouses that have a wire. Most of these mouses use the PS/2 protocol.
The setup will work with all versions of Arduino.
It takes only a few steps to control the output of your mouse.
First you strip the wires of the mouse and connect them to your Arduino. Then you upload the sketch and see the result on your serial monitor.
I will show you in detail how this is done.
As an extra, I will show you how to make your mouse wireless for a distance up to 2500 feet (750 meters).
Step 1: Parts List
Step 2: Wiring and Setup
Download the sketches and copy/paste them in your arduino IDE.
Strip the wires of the mouse and connect to the Arduino as you can see on the image. The colors can vary with some mouses. In the sketch you will see MDATA and MCLK these are the ports on the Arduino and can be changed.
Scroll to the bottom of the sketch to “void loop()”. Here you can adjust the code to fit your needs.
Step 3: Run the Sketch and Open Serial Monitor to See Result
Open the serial monitor after you upload the sketch to the Arduino.
Move the mouse to see the result.
It is quite a bit of code but you should only be concerned about the code inside void loop(). Most of the code is to deal with the PS/2 protocol and should be left alone.
If you don't see any result, try to swap the MDATA wire with the MCLK wire and try again.
That's all there is to it. Now you can adjust the sketch to fit your needs.
In the rest of this instructable you will learn how to make the mouse wireless for a distance up to 2500 feet (750m).
Step 4: Long Range Wireless Setup
We will use 2 HC-12 modules and 2 Arduino's to make the wireless connection. You can see a full tutorial on HC-12 in another instructable I made.
Connect the mouse and modules as shown in the image to the 2 Arduino's.
Upload the sketches "Sender" and "Receiver" to both of the Arduino's.
Open the serial monitor on the receiver to see the result.
You can edit the code to fit your needs in void loop().
Step 5: Thanks for Reading - Next Project
In this video you have learned how to use a mouse as a controller and wireless controller.
Do you have a suggestion for the next project, let me know in the comments.
If this video was helpful for you, please click the favorite button and follow me for more videos.
See you next time.