You are on page 1of 6

Optical Mouse Hack By Mohammed

Rana Basheer
 

The ability to know where we are is vital


skill we often use in decision making and
often taken for granted. When dealing with
robots this capability can be a complex
expensive task but at the same time a
powerful and sometimes essential
capability.

Some of techniques that could be applied


Fig 1. Optical Mouse for positional are
feedback
1. Dead Reckoning Using Incremental
 
Optical encoders at the wheel
2. Radio Beacons and GPS
3. Optical Mouse !!!!!

Dead Reckoning Using


Incremental Optical
Encoders at the wheel
Fig 2. The Incremental Optical Encoder
This has been the most common method
attached to a motor
for estimating the position of the robot.
  This method relies on the feedback from
the optical incremental encoder attached to
the wheels as shown in Fig 1. The
arrangement consists of two pairs of photo
emitter and detector which are placed in
such a way that the pulse train generated
by the detector when the motor or the
wheels rotate is 90 degree phase shifted to
each other as shown in Fig 3. By counting
Fig 3. Incremental Optical Encoder the pulse train the robot can estimate how
far it has moved from the reference
 
Fig 4. Quadruple Encoding

 
LED

HDNS-2000

position. The quadruple encoding also gives


information about the direction of rotation.

One of the major problem associated with


this type of feedback is the systems
Fig 5. Optical Mouse (Top View) tolerance against slipping between the
wheels and the floor when the robot is
cruising at very high speeds. Due to this
slippage the wheel rotates while the robot
does not actually move that distance. This
results in a false position information.

Radio Beacons and GPS


Navigating using active beacons has been
with us for centuries. Using the stars for
navigation is one of the oldest example of
Fig 6. HDNS-2000 Optical Sensor
Module global referenced navigation; technology
has brought forward many other systems,
  such as light houses and more recently
radio navigation systems.
2. Global Positioning System GPS

The simple idea of the beacon system is to


provide the user with position information
relative to that of the beacon system, if
this point is known as global location then
the position of the user with respect to this
global location can be found.

Major disadvantage of beacon systems is


there unsuitability for indoor use due to a
combination of attenuation of signals due
to obstacles, and the multipath fading
Fig 7. HDNS-2000 Pin Layout
introduced due to multiple reflection of RF
by walls and other surfaces.
 
Motorola Microcontroller
Motorola Mini-Ranger Falcon and Harris
Infogeometric System are some of the
commercially available ground based
beacon system. The Global Positioning
System (GPS) is provided by the US
military through a constellation of 24
satellites which are placed 55 degrees to
the equator at a distance of 28,000 Kms.
The Differential GPS (DGPS) is very
accurate providing a resolution of 1-5
Fig 8. CMOS Camera meter for civilian purpose but this
technology is not applicable for any sort of
  indoor use.

 Optical Mouse
When I built ADAM-1 the most important
problem that I faced was estimating the
position of my robot. The cheap dc motor
that I used has no optical encoder attached
to it neither the gear system that I got
from a Tamiya toy allowed any possibility
of attaching an optical encoder to it. 
Fig 9. Motorola Chip MC68HC908JB8 to
control HDNS-2000 Though I have been using Optical mouse
even before I started building ADAM-1 the
  idea of using optical mouse for determining
the position never struck me. But when I
was faced with the same problem in ADAM-
2 I got the idea of using optical mouse.

Using optical mouse for position detection


has several advantages. First the sensor
detects the actual distance the robot has
moved in 2-dimension hence even if the
robot wheel slips at high speeds the robot
was still able to accurately determine its
position. Second since no mechanical parts
are involved they are very reliable.

Theory of Operation
Fig 10. Pin Layout of MC68HC908JB8
Optical mouse uses a tiny camera to take
  approximately 1,500 pictures every
  second. The pictures are taken by bouncing
light from a small, red light emitting diode
  (LED) off the surface under the mouse,
onto a Complimentary Metal Oxide
Semiconductor (CMOS) camera. The CMOS
camera sends each image to a Digital
Signal Processor (DSP) for analysis. The
DSP, operating at 18 MIPS, is able to
detect the changing pattern in the images
between movements. Based on these
patterns, the DSP determines how far the
mouse has moved and sends the
corresponding coordinates to the external
microcontroller.

Agilent technologies makes this optical


sensor modules called HDNS-2000. HDNS-
2000 consists of an Image Acquisition
System (IAS), Digital Signal Processor, two
channel quadrature output and 2 wire
serial port.

The optical mouse modules that I used


were taken from the IBM optical mouse
that I bought from Wall Mart for 29$. I
removed the plastic outter casing and also
removed the strip wire attachment to the
mouse buttons. The figure 5 shows the
HDNS-2000 chip from Agilent in the IBM
Optical mouse PCB.

Quadratur
Pin Name PS/2 Mode
e Mode
 PS/2  PS/2
1  PS2_C Interface Interface
Clock Clock
 MODE/X  Select PS/2
2  XA output
A Mode
 Right Button
3  RB/XB  XB output
Input
 Middle Button
4  MB/YB  YB output
Input
 Left Button
5  LB/YA  YA output
Input
 LED control  LED control
6  XY_LED
output output
 3.3 VDC
7  Vdd3  3.3 VDC input
input
 Internal  Internal
8  REFB
Reference Reference
 Oscillator  Oscillator
9  OSC1
Input Input
10  GND  Ground  Ground
 Oscillator  Oscillator
11  OSC2
Output Output
12  GND  Ground  Ground
 5 VDC
13  Vdd5  5 VDC input
input
 5 VDC
14  Vdd5  % VDC input
input
15  NRESET  NRESET  NRESET
 PS/2
 PS/2
16  PS2_D Interface
Interface Data
Data
Table 1. Pin Description for HDNS-2000
The PCB also contains the MC68HC908JB8
HCMOS Microcontroller Unit from Motorola.
Fig 8 gives a more closer view of the
Motorola microcontroller while fig 9. gives
the pin out of this chip. Though HDNS-
2000 has the capability to provide a PS/2
interface the Motorola microcontroller helps
to provide a dual interface (PS/2 or USB).
At power up, the firmware in the Motorola
microcontroller tests the CLK (green wire)

You might also like