Optical Navigation Sensor MX8733 (USB Optical Mouse) Interface with Arduino

Hi,

First of all I gotta say I am very new to microcontroller arduino programming, I am only familiar with CAD modeling and various simulation. Please teach me and correct me if I am wrong.

Currently, I am using ps2 library for my optical mouse (with MX8733) to retrive x- and y-coordinates. The sample programming is shown below:

#include <ps2.h>

PS2 mouse(6, 5);

void mouse_init()
{
mouse.write(0xff); // reset
mouse.read(); // ack byte
mouse.read(); // blank */
mouse.read(); // blank */
mouse.write(0xf0); // remote mode
mouse.read(); // ack
delayMicroseconds(100);
}

void setup()
{
Serial.begin(9600);
mouse_init();
}

void loop()
{
char mstat;
char mx;
char my;

mouse.write(0xeb); // give me data!
mouse.read(); // ignore ack
mstat = mouse.read();
mx = mouse.read();
my = mouse.read();

/* send the data back up /
Serial.print(mstat, BIN);
Serial.print("\tX=");
Serial.print(mx, DEC);
Serial.print("\tY=");
Serial.print(my, DEC);
Serial.println();
// delay(20); /
twiddle */
}

HOWEVER, it stucks at 'mouse.write(0xff); //reset' and nothing is shown at the serial monitor, or some time (rarely) it shows status=1000 x=0 y=0. I feel like MX8733 is using different protocol, no? Anyway, I can't find any detailed datasheet regarding this sensor, only found this http://www.lizhiic.com/admin/Product20/MX8733_SPEC_V1_0.pdf. Ive also found that ADNS
-2620 is a more common mouse sensor after some time of googling.

So my question is, is ps2 library applicable to all types of optical navigation sensor including this MX8733? If not, any idea to still use this sensor? *because I have bought 2 of them and I don't want to waste my money by leaving them aside doing nothing.

Sincerely, all experts and professionals out there, please help :frowning:

Jay

I apologize for re-posting to an old topic, but I believe this is relevant. At least it may help others who might come searching this way.

@JayJoe

Your device may be configured as a USB device - it can be either that or, (less likely), a PS2 device. Since this posting is originally from 2016, it is likely that your mouse has been "set" as a USB mouse.

I can't speak for your chip, but the datasheet I found says there is an internal "switch" that can be "set" to select either the PS2 or USB interface output specification. Some of the cheap knock-offs (like the chip I have) may not bother to implement the PS2 functionality at all. YMMV.

It's a cheap "mouse-on-a-chip" requiring relatively few components to create a working optical mouse.

It appears to have been manufactured by any number of companies in China - my chip appears to be a knock-off - but the datasheet comes from LIZEE Electronics.

Here is a link to the datasheet for LIZEE's implementation of this device:

Unfortunately, I do not know how to programmatically interface to a USB device.

Jim "JR"

I hope this helps others. If you remove the pcb and the lens from the mouse, you was making the same mistake than me, the optical sensor does not get data because is out of focus, may be if you try read data from it you must reinsert lens and pcb into the case. I did it and now is working fine.