0% found this document useful (0 votes)
39 views8 pages

Athena To Optical Mouse

The document discusses how to interface with an optical mouse sensor chip called the ADNS-2610 by removing it from a cheap optical mouse and connecting it to an microcontroller. It provides code examples to read sensor registers and pixel data for use in building custom sensors.

Uploaded by

Srivas Venkatesh
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views8 pages

Athena To Optical Mouse

The document discusses how to interface with an optical mouse sensor chip called the ADNS-2610 by removing it from a cheap optical mouse and connecting it to an microcontroller. It provides code examples to read sensor registers and pixel data for use in building custom sensors.

Uploaded by

Srivas Venkatesh
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Interface to Optical Mouse Sensor

Friday, May 28 2004 @ 08:16 PM EDT

In this article we will show you how to interface the Athena to the ADNS-2610.

Most optical mice are based on a technology where a small sensor take a small microscopic picture of the surface and
detects the mouse movement by mathematically comparing sequential images.

I went to my local electronics store and picked up the cheapest optical mouse I could find. The GE HO98802 cost me
about $17 but I have seen them for as little as $9 on the web.

The heart of the mouse is the ADNS-2610 Optical Mouse Sensor.

The actual sensor has a 18x18 pixel matrix. Each pixel can measure 63 light levels. While you are not going to be
taking mega pixel images with this sensor it is enough to follow a line or measure the distance a wheel or lever moves.

We will show you how to interface to this sensor while it is still mounted in the mouse enclosure. This is recommended
until you are familiar with the lens system and its capabilities.
Disassembly

Performing the steps from this point on will void the mouse warranty and make the mouse unusable as a normal mouse.

The Mouse is opened by removing a single screw on the bottom of the mouse. Once removed lift up slightly and push
the main cover forward. Some of the button covers will also fall off as you remove the cover but don’t worry we wont
be using them.

Remove the main PCB by lifting it from the base. This will reveal the base and lens. The lens is removable. It also acts
as a reflector for the LED. The LED light is used to illuminate the surface.
The small chip shown here is the mouse controller. We need to remove this chip. You can do this one of two ways. If
you have a solder sucker or desolder equipment you can just remove the chip. If not you can use a small pair of cutters
to cut each lead.

Removed Chip
Remove the orange and white wires connected to the mouse cable and reconnect them to the pins 6 and 7 shown here.
These are the IO clock and data ports to the 2610 chip.

Cut the end of the cable and connect the wires to a small 4 pin header as shown. The color codes are as follows:

green=Gnd
Blue=5v
White=Clock 2610
Orange=Data 2610
At this point you can replace the mouse PCB back on the base. Don’t reattach the cover until you feel every thing is
working correctly.

Once you connect power to the cable the LED should light then go dim.

Program 1 This first program will just do a basic test to see if everything is working correctly.

'adns-2610 squal test


'Data port wired to Athena port 0
'Clock port wired to Athena port 1
'Athena providing power to all

dim dat

output 0
output 1
high 0
high 1

'------------------------------
'squal test
'-----------------------------

loop:
output 0
shiftout 0,1,136,4
high 1
input 0
shiftin 0,1,136,dat
print dat
goto loop

This program reads the SQUAL register and displays its value. The SQUAL reading is a surface quality reading that
indicates the number of readable features on the given surface. If the mouse is not against the surface you should get a
0 reading. Once the mouse comes in contact with a surface you should see lots of numbers.

Program 2

This next program reads the x and y movement between calls. This measurement on a single axis could be used to
monitor a wheel. As the wheel moves the sensor would tell you how much.

'adns-2610 delta test


'Data port wired to Athena port 0
'Clock port wired to Athena port 1
'Athena providing power to all

dim dat

output 0
output 1
high 0
high 1

'------------------------------
'Delta test
'-----------------------------

loop:

gety:
output 0
shiftout 0,1,136,2
high 1
input 0
shiftin 0,1,136,dat
if dat = 0 then
goto getx
endif

if dat < 127 then


print "y=+",dat
else
dat = dat ^ 255 + 1
print "y=-",dat
endif

getx:
output 0
shiftout 0,1,136,3
high 1
input 0
shiftin 0,1,136,dat
if dat = 0 then
goto loop
endif

if dat < 127 then


print "x=+",dat
else
dat = dat ^ 255 + 1
print "x=-",dat
endif
goto loop

Program 3

This program reads the pixel registers. These registers contains the actual pixel levels. There are 324 pixels and they
are read one after another.

'ADNS2610 Raw Pixel Dump


'Data port wired to Athena port 0
'Clock port wired to Athena port 1
'Athena providing power to all
'Use KRConnect to capture Pixesl at 19200 baud

dim addr,dat
debugbaud HBAUD19200
output 0
output 1
high 0
high 1

'Turn on LED and leave it on


shiftout 0,1,136,128
shiftout 0,1,136,1

'------------------------------
'Blind Pixel Dump
'-----------------------------

loop:
output 0
shiftout 0,1,136,8
high 1
input 0
shiftin 0,1,136,dat
debug dat
goto loop

Note that this program sets the baud rate to 19200. It is designed to be used with the KRconnect program. KRconnect
has a new feature called capture that will collect this pixel data and display it on a small window on the form.

Make sure you set the baud rate on KRcapture to 19200. You must close the Athena compiler before you start the open
the KRcapture port.
This is a single thin pen line on a white piece of paper.

Where to now

At this point you know the basics and have the most important registers. Its up to you to see how you can build some
neat sensors. The interface is via SPI so its not affected by IRQ's you should be able to make a neat CoProc with an
Athen, Athena485 or Perseus.

With a chip like the Perseus or AthenaHS you can set the baud rate even higher. But keep in mind that if you want to
read pixel data there is limit and if read too fast you will start to get errors.

Related Products

Athena......... http://kronosrobotics.com/xcart/customer/product.php?productid=16276
Athena485...... http://kronosrobotics.com/xcart/customer/product.php?productid=16381
Perseus........ http://kronosrobotics.com/xcart/customer/product.php?productid=16382
EZRS232 Driver. http://kronosrobotics.com/xcart/customer/product.php?productid=16167

0 comments

http://kronosrobotics.com/gl/article.php?story=20040528201648857

You might also like