Interfacing with a PS/2 mouse with Arduino to get x and y coordinates

Thread Starter

John A Bonilla

Joined Mar 11, 2017
92
Hello Everyone,

I am currently working on a project where I need to be able to use an Optical Mouse to determine the location of my robot. To do this I am using an Arduino Uno, and a PS/2 mouse from Logitech. I began this project based on the following Instructables post: Optical Mouse Odometer

However, after following the instructions I receive no feedback from the mouse. All that is presented in the Serial Prompt is "Setup..." and nothing is said afterwards. The mouse that I am using is: Logitech PS/2 Mouse

Based on this data sheet and video, I soldered the clock and data pins to wires and connected them to the respective pins on the Arduino along with connecting the power to a 5v (volt) source and ground to ground.

Data Sheet
Video

After doing everything above, I still have come no closer to finding a solution, if anyone has any suggestions or answers they would all be very appreciated. If anyone has any questions I would be more than happy to answer to the best of my ability.
 

Thread Starter

John A Bonilla

Joined Mar 11, 2017
92
I have followed through with all of the instructions however, the Arduino has not been able to read anything from the mouse itself. I have tested the mouse with an actual computer and I have found that the computer needs to restart after the mouse is plugged in so that it can register that the mouse is there. Maybe it needs to load itself into the bios upon startup which means it won't work right away? I'm not sure, if anyone has information it would be helpful.
 

AlbertHall

Joined Jun 4, 2014
12,347
The arduino PS2 system works - I have used it.
Possible problems:
It's not a PS2 mouse.
You do not have a good 5V feeding the mouse.
You have the clock and data lines swapped.
You have not correctly assigned the arduino pins that the mouse clock and data are actually connected to.
 

Thread Starter

John A Bonilla

Joined Mar 11, 2017
92
The arduino PS2 system works - I have used it.
Possible problems:
It's not a PS2 mouse.
You do not have a good 5V feeding the mouse.
You have the clock and data lines swapped.
You have not correctly assigned the arduino pins that the mouse clock and data are actually connected to.
Thank you, it turns out that I had a faulty Arduino, it now work perfectly!
 

Tyrell153

Joined Apr 8, 2021
2
Hello Everyone,

I am currently working on a project where I need to be able to use an Optical Mouse to determine the location of my robot. To do this I am using an Arduino Uno, and a PS/2 mouse from Logitech. I began this project based on the following Instructables post: Optical Mouse Odometer

However, after following the instructions I receive no feedback from the mouse. All that is presented in the Serial Prompt is "Setup..." and nothing is said afterwards. The mouse that I am using is: Logitech PS/2 Mouse

!!!!!! YOU need the inputs of the mouse to be on the Pulse Width Modulation (PWM) pins of the Arduino. Look up the pin layout of your board. Some boards its pin 13 and 6 (Micro).
 

Tyrell153

Joined Apr 8, 2021
2
[SOLVED] YOU need the inputs of the mouse to be on the Pulse Width Modulation (PWM) pins of the Arduino. Look up the pin layout of your board. Some boards its pin 13 and 6 (Micro).

Then run the sketch and open Tools > Serial monitor> It should display changes in X + Y
 
Top