OK.....This one was not easy. I required a cheap robot odometer to connect to my Arduino for small scale tracking and getting the movement coordinates
. Obvious choice is an encoder but its too expensive so I realize I need to do just what an optical mouse does. Next logical step: to Google. So I google the title of this blog post and I happily open the next couple of links I see. After 72 hours and 4 burnt mice later I realized it is not exactly simple. The problem is that there are various different types of technologies available in a mouse. The register system, the serial data transfer system, the one which needs an external oscillator, the one which has an inbuilt controller etc. All of these can be converted into an odometer only the complexity and efficiency of your system may differ. The easiest one which I will demonstrate is to use a mouse with a sensor which uses registers. I will later also tell how to do this for others. The mouse I used is an Acer PS/2 mouse. Your mouse should be a PS/2 or USB. Wireless would work but its just too much of a hassle. So lets get down to business:
PART 1:Hardware
STEP 1:Open Up
Take a screwdriver and neatly tear apart your mouse's front panel and get a look at the circuit inside. Do not touch the bottom part yet as it is very delicately calibrated such that the optical sensor detects the LED through the lens. While analyzing first look if there is an external oscillator such as this or maybe its oval:
If there isn't one you are in luck but don't celebrate yet.
STEP 2:The Optical Sensor
Now look up the number on the optical sensor and google for the datasheet. Mine is an MCS-12086 with an inbuilt oscillator. On analyzing the datasheet you will figure out how your sensor works. If it lists a bunch of registers and their use you are in luck yet again. If it tells you a bunch of commands that you should send the sensor to receive data then bad luck your job is going to be too hard try getting another mouse.
STEP 3:The Fun Soldering Part
Now comes the connections section if your sensor doesn't have an external oscillator your job is pretty easy. Look up the datasheet for the pin diagram and locate the pins for SDIO, SCLK, VCC and GND. Without harming or ripping out any components solder a wire to each of these pins. If you directly want to use the PS/2 wires you can do that but your arduino would be over-burdened as it will suck too much power so you will need an external power source. Better option is to just directly solder on the sensor pins.
STEP 4:Connecting to your Micro-controller
Connect the SDIO and SCLK wires to digital pins on your arduino and the VCC and GND to the arduino's 5V and GND respectively. If you haven't soldered and directly used the mouse's wires connect VCC and GND to an external battery.
PART 2:The Coding (Pretty Straightforward)
STEP 1:Download this library for arduino from here and put it in the the libraries folder where you installed your arduino GUI.
STEP 2:Now the tricky part. If your IC works on registers look up what register is for what and modify the register number from the cpp library file. I have written the code for pan-101 so if you have pan-101 you don't need to modify anything.
STEP 3:Now open a new arduino code in which you include the above library, then start a serial connection and the in the loop() function call the functions pan101_dx() and pan101_dy() and then print the values.
There you have it a working tracker unbelievably accurate. It gives values of dx and dy ranging from -127 to +127 depending on the direction of the movement. Have Fun do comment and post your queries. This is a difficult hack, so if I helped you make it work do tell me.
PART 1:Hardware
STEP 1:Open Up
Take a screwdriver and neatly tear apart your mouse's front panel and get a look at the circuit inside. Do not touch the bottom part yet as it is very delicately calibrated such that the optical sensor detects the LED through the lens. While analyzing first look if there is an external oscillator such as this or maybe its oval:
If there isn't one you are in luck but don't celebrate yet.
STEP 2:The Optical Sensor
Now look up the number on the optical sensor and google for the datasheet. Mine is an MCS-12086 with an inbuilt oscillator. On analyzing the datasheet you will figure out how your sensor works. If it lists a bunch of registers and their use you are in luck yet again. If it tells you a bunch of commands that you should send the sensor to receive data then bad luck your job is going to be too hard try getting another mouse.
STEP 3:The Fun Soldering Part
Now comes the connections section if your sensor doesn't have an external oscillator your job is pretty easy. Look up the datasheet for the pin diagram and locate the pins for SDIO, SCLK, VCC and GND. Without harming or ripping out any components solder a wire to each of these pins. If you directly want to use the PS/2 wires you can do that but your arduino would be over-burdened as it will suck too much power so you will need an external power source. Better option is to just directly solder on the sensor pins.
STEP 4:Connecting to your Micro-controller
Connect the SDIO and SCLK wires to digital pins on your arduino and the VCC and GND to the arduino's 5V and GND respectively. If you haven't soldered and directly used the mouse's wires connect VCC and GND to an external battery.
PART 2:The Coding (Pretty Straightforward)
STEP 1:Download this library for arduino from here and put it in the the libraries folder where you installed your arduino GUI.
STEP 2:Now the tricky part. If your IC works on registers look up what register is for what and modify the register number from the cpp library file. I have written the code for pan-101 so if you have pan-101 you don't need to modify anything.
STEP 3:Now open a new arduino code in which you include the above library, then start a serial connection and the in the loop() function call the functions pan101_dx() and pan101_dy() and then print the values.
There you have it a working tracker unbelievably accurate. It gives values of dx and dy ranging from -127 to +127 depending on the direction of the movement. Have Fun do comment and post your queries. This is a difficult hack, so if I helped you make it work do tell me.
No comments:
Post a Comment