2
$\begingroup$

So I have this optical mouse with me, which has a PAN3504DL-TJ optical sensor. It has a USB interface and when I looked up the internet, all I could find was tutorials using A2501 or sensors in those lines and it has pins like SCLK and SDI but I don't have them instead I have D+ and D-. I understand that these are the data pins so what I did was take two wires and plug them into my Analog Pins of my dsPIC30F4011 and read data from it. After setting up UART communication and transmitting data, all I get are numbers running continuously.

Screenshot of Termite receiving information from the Analog Pins which are connected to the D+ and D- of the Optical Sensor

What I want to do is to read coordinates over the analog pins as the mouse aka the sensor moves on a surface. I would use this for position control for my robot. So my question is how do I read coordinates from the Optical Sensor over the D+ and D- lines through my Analog Pins ?

$\endgroup$
  • 1
    $\begingroup$ Sounds like you need to plug it in to a USB port. Does your microcontroller support USB? If it's designed for USB you're not going to get anywhere connecting it to anything but USB. Do you have a datasheet? $\endgroup$ – Guy Sirton Mar 9 '14 at 2:42
  • $\begingroup$ Yeah I power my Microcontroller via USB cable and also read other sensory information through the same USB interface otherwise called UART. By datasheet you mean the microcontroller's or the optical sensor's ? $\endgroup$ – Tvaṣṭā Mar 9 '14 at 12:48
1
$\begingroup$

The mouse is sending data using the USB protocol. You will have to read and decode that protocol to get the mouse data.

| improve this answer | |
$\endgroup$
  • $\begingroup$ I have found that trying to decipher the HID (human interface device) protocol is a huge headache. (at least on linux). However, you might be able to hack your mouse and access the communications to/from the chip that actually does the optical differencing which you want. i.e. cut out the USB interface. $\endgroup$ – Ben Mar 9 '14 at 14:05
1
$\begingroup$

Use different PAN, PAN3101 in praticular. How to do that? See this (chapter "5.3.6 PAN3101") https://robotics.stackexchange.com/a/2733/2663

| improve this answer | |
$\endgroup$
1
$\begingroup$

As others pointed out, you'll need to implement the protocol for communication (most likely HID). I recommend you buy an optical mouse with PS/2 protocol because it will be much much easier to implement, there are even numerous solutions for it online (as in codes and libraries).

Regards

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.