Avago ADNK-5023-HTP2 Guide

ADNK-5023-HTP2
Optical Mouse Designer’s Kit
Design Guide
Introduction
The IBM Personal System/2 (PS/2) is an industry standard
serial interface between a computer and peripher-
als such as a mouse, joystick, keyboard, etc. This design
guide describes how a cost-eective PS/2 optical mouse
can be built using Avago Technologies small form factor
ADNS-5020EN optical mouse sensor and Holtek Semi-
conductor HT82M35A-1002 masked microcontroller. The
document starts with the basic operations of a computer
mouse peripheral followed by an introduction to the
Avago Technologies ADNS-5020EN Optical Navigation
Sensor and the HT82M35A-1002 masked microcontroller.
A schematic of the HT82M35A-1002 masked microcon-
troller to the ADNS-5020EN optical mouse sensor and
buttons of a standard mouse can be found in Appendix A.
The ADNS-5020EN data sheet is available from the Avago
web site at http://www.avagotech.com/. The HT82M35A-
1002 data sheet is available from the Holtek web site at
www.holtek.com.
Optical Mouse Basics
The optical mouse measures changes in position by
optically acquiring sequential surface images (frames),
and mathematically determining the direction and
magnitude of movement. The Z-wheel movement is
done in the traditional method by decoding the quadra-
ture signal generated by optical sensors. In this reference
design, PS/2 protocol is used to provide a standard way
of reporting mouse movement and button presses to the
PC.
Introduction to ADNS-5020EN Optical Mouse Sensor
Avago’s ADNS-5020EN optical sensor is used in this
reference design as the primary navigation engine. This
Optical Navigation Technology contains an Image Ac-
quisition System, a Digital Signal Processor, and a three-
wire serial port. The HT82M35A-1002 periodically reads
the ADNS-5020EN’s Delta_X and Delta_Y registers to
obtain any horizontal and vertical motion information
happening as a result of the mouse being moved. The
three-wire synchronous serial port is used to set and read
parameters in the ADNS-5020EN, and to read out the
motion, (delta) X and (delta) Y information.
This motion information will be reported to the PC to
update the position of the cursor. The advantages of
using ADNS-5020EN optical sensor are: good tracking
accuracy, small form factor, sensor programming ex-
ibility via SPI port, and the automatic frame rate feature.
Furthermore, ADNS-5020EN sensor has built-in oscilla-
tor and on-chip LED driver to minimize external compo-
nents. Additionally, Burst mode is another special serial
port operation mode which may be used to reduce the
serial transaction time for motion read operation
Motion Read is activated by reading the Motion_Burst
register. The ADNS-5020EN will respond with the
contents of the Delta_X, Delta_Y, SQUAL, Shutter_Upper,
Shutter_Lower, Maximum_Pixel and Pixel_Sum registers
in that order.
Downloaded from Arrow.com.

2
Mechanical Z-Wheel
The motion of Z-wheel is detected using the traditional
method by decoding the quadrature signal generated by
mechanical encoder. The Z-pinwheel is connected to the
Z-encoder through its shaft. The rotational movement of
the shaft is decoded into on and o levels in a quadrature
output pattern. Every change in the Z-encoder outputs
represents a count of mouse movement. Comparing the
last state of the Z-encoder to the current state derives
direction information. As shown in Figure 1, traveling in
clockwise direction produces a unique set of state tran-
sitions, and traveling in counter clockwise direction
produces another set of unique state transitions. In
this reference design, only the motion at the Z-wheel is
detected using this method.
Optical Z-Wheel Basics
The motion of Z-wheel is detected using the traditional
method by decoding the quadrature signal generated by
optical sensors. Two phototransistors are connected in
a source follower conguration. An infrared LED shines,
causing the phototransistors to turn on. In between the
phototransistors and LED is a pinwheel that turns on the
mouse ball rollers. The fan of this pinwheel is mechanical-
ly designed to block the infrared light such that the pho-
totransistors are turned on and o in a quadrature output
pattern. Every change in the phototransistor outputs rep-
resents a count of mouse movement. Comparing the last
state of the optics to the current state derives direction
information. As shown in Figure 3 below, traveling along
the quadrature signal to the right produces a unique set
of state transitions, and traveling to the left produces
another set of unique state transitions. To design mouse
with optical Z-wheel using HT82M35A-1002 microcon-
troller, please refer to Appedix A schematics. ZLED should
be driven externally by VDD (DC mode).
Figure 1. Mechanical Z-Wheel Output Signal Generation
Mouse Buttons
Mouse buttons are connected as standard switches. These
switches are pulled up by the pull up resistors inside the
microcontroller. When the user presses a button, the
switch will be closed and the pin will be pulled LOW to
GND. A LOW state at the pin is interpreted as the button
being pressed. A HIGH state is interpreted as the button
has been released or the button is not being pressed.
Normally the switches are debounced in rmware for 15-
20ms. In this reference design there are three switches:
left, Z-wheel, and right.
Figure 2. Optics Quadrature Signal Generation
Downloaded from Arrow.com.Downloaded from Arrow.com.

3
Introduction to the HT82M35A-1002
The HT82M35A-1002 is designed as 3-key 3D PS/2 optical
mouse controller. It provides serial interface to access the
sensor ADNS-5020EN or compatible sensors. A 2MHz RC
oscillator is needed for system frequency with external
pull-high resistor (140kohm).
Serial Peripheral Interface (SPI)
The HT82M35A-1002 provides a SPI compatible interface.
The SPI circuit supports byte serial transfer in either
Master or Slave mode. The integrated SPI circuit allows
the HT82M35A-1002 to communicate with external SPI
compatible hardware, in this case the ADNS-5020EN.
Hardware Implementation
The standard hardware to implement a mouse is shown
in Figure 3. For X and Y movement, the optical sensor is
used. The Z- wheel movement is detected by mechanical
encoder that output quadrature signals. For each button
there is a switch that is pulled up internally by the built in
pull up resistors.
Left Button
ADNS-5020EN
optical mouse sensor
Wheel Button
Right Button
Z Optics
Holtek
HT82M35A-1002
microcontroller
PS/2 Interface
SDIO
SCLK
NCS
SCLK/SDATA
Avago
Figure 3. HT82M35A-1002 –ADNS-5020EN Optical Mouse Hardware Block Diagram
Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.

4
ADNK-5023-HTP2 Designer’s Kit – Optical Mouse
The ADNK-5023-HTP2 reference design mouse unit
allows users to evaluate the performance of the Optical
Tracking Engine (sensor, lens, LED assembly clip, LED)
over PS/2 connection, using a Holtek Controller. This kit
also enables users to understand the recommended me-
chanical assembly. (See Appendix C, D, and E)
System Requirements
PCs using Windows® 95/ Windows® 98/ Windows® NT/
Windows® 2000/ Windows® XP with PS/2 port.
Compatibility
Microsoft Intelli 3D PS/2 and IBM PS/2 mouse compatible
Functionality
3-button, scroll wheel mouse.
Operating (For PS/2 Mode)
1. Turn o the PC.
2. Plug the mouse unit’s PS/2 connector into the PC’s
PS/2 port.
3 Turn on the PC. All of the mouse buttons and scroll
wheel will function exactly like a standard PS/2 mouse.
To Disassemble the ADNK-5023-HTP2 Unit
The ADNK-5023-HTP2 comprises of the plastic mouse
casing, printed circuit board (PCB), lens, buttons, and PS/2
cable. (See Figure 4.) Unscrewing the one screw located
at the base of the unit can open the ADNK-5023-HTP2
unit. Lifting and pulling the PCB out of the base plate can
further disassemble the mouse unit.
Caution: The lens is not permanently attached to the
sensor and will drop out of the assembly.
Component Summary
Below is the summary of the components contained in
the ADNK-5023-HTP2 Designer’s Kit.
Sensor
The sensor technical information is contained in the
ADNS-5020EN Data Sheet.
Lens
The lens technical information is contained in the ADNS-
5100/5100-001 Data Sheet. The ange on the standard
ADNS-5100 lens is for ESD protection.
LED Assembly Clip
The information on the assembly clip is contained in the
ADNS-5200 Data Sheet.
LED
The LED technical information is contained in the HLMP-
ED80-XX000 Data Sheet.
Base Plate Feature – IGES File
The IGES le on the CD-ROM provides recommended
base plate molding features to ensure optical alignment.
This includes PCB assembly diagrams like solder xture in
assembly and exploded view, as well as solder plate. See
Appendix D for details.
Reference Design Documentation – Gerber File
The Gerber File presents detailed schematics used in
ADNK-5023-HTP2 in PCB layout form. See Appendix C for
more details.
Overall circuit
A schematic of the overall circuit is shown in Appendix A
of this document. Appendix B lists the bill of materials.
Figure 4. Exploded view drawing of optical tracking engine with ADNS-
5020EN optical mouse sensor.
Note: While reassembling the components, please make sure that the Z
height (Distance from lens reference plane to surface) is valid. Refer to
Figure 4.
ADNS-5200 (LED Clip)
HLMP-ED80 (LED)
Sensor
Customer supplied PCB
ADNS-5100 (Lens)
Customer supplied base
plate with recommended
IGES drawing
alignment features per
Figure 5. Distance from lens reference plane to surface
Sensor
Lens
Lens reference plane
Object Surface
2.40
0.094
Z=
Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.

5
Appendix A: Schematic Diagram of the Overall Circuit
Figure A1. Circuit-level block diagram for ADNK-5023-HTP2 designer’s kit optical mouse using the Avago ADNS-5020EN optical mouse sensor and Holtek HT82M35A-
1002 Controller.
Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.

6
Appendix B: Bill of Materials for Components Shown on schematic
Comment Footprint Designator Qty
Resistor 68R 1% 0.25w 0603 [SMD] R6.R7 2
Resistor 4k7 1% 0.25w 0603 [SMD] R1.R2 2
Resistor 140k 1% 0.25w 0603 [SMD] R4 1
Resistor 47k 1% 0.25w 0603 [SMD] R5 1
Ceramic Cap. 100nF 50V 0603 [SMD] C2.C4.C5.C9 4
Ceramic Cap. 470PF 50V 0603 [SMD] C6.C7 2
Ceramic Cap. 3.3uF 16V 1206 [SMD] C8 1
Ceramic Cap. 4.7uF 10V 1206 [SMD] C3 1
Tantalum Cap. 100UF 16V Case D [SMD] C1 1
Diode 1N4148* Axial Diode D2 1
Mouse Optical Sensor ADNS-5020EN ADNS-5020EN U2 1
Molex-5P Header Pin 2.54mm J1 1
Pin Header 40P 2.54mm J2.J3.J4 1
Connector – Jumper Set 2.54mm J2.J3.J4 3
Connector – IC Socket DIP-18pin U1* 1
Switch – Micro Switch SMD SW1.SW2.SW3 3
HLMP-ED80 LED 5mm R/A LED1 1
Z – ENCODER ZDET SW5B 1
Cable – PS/2 cable - 1
Microcontroller HT82M35A-1002 DIP-18pin U1 1
Notes: *optional
Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.

7
Appendix C: PCB Layout
Figure C1. PCB Schematic (Top Layer) Figure C2. PCB Schematic (Top Silkscreen Overlay)
Figure C3. PCB Schematic (Bottom Layer) Figure C4. PCB Schematic (Bottom Silkscreen Overlay)
Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.

8
Appendix D: Base Plate Feature
Figure D1. Bottom, top and side view of base plate
Figure D2. Overall view of base plate
Appendix E: Sectional view of PCB assembly
Figure E1. Sectional view of PCB assembly highlighting all optical mouse components (optical mouse sensor, clip, lens, LED, PCB, and base plate).
Sensor
LED
Clip
PCB
Surface
Base Plate
Lens / Light Pipe
Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.

9
Appendix F: Kit Components
The PS/2 portion of the rmware handles the following requests and commands listed in the table below.
Hex Code Command Action
0xFF Reset Resets mouse to default states
0xFE Resend Resends last data to host
0xF6 Set Default Sets mouse to use default parameters
0xF5 Disable Disables the mouse
0xF4 Enable Enables the mouse
0xF3 Set Sampling Rate Set sampling rate to 10,20,40,60,80,100,200/second
0xF2 Read Device Type Returns 0x00 to host, indicating the device is a mouse
0xF0 Set Remote Mode Sets remote mode so data values are only reported after a read data command
0xEE Set Wrap Mode Set wrap mode until 0xFF or 0xEC is received
0xEC Reset Wrap Mode Reset to previous mode of operation.
0xEB Read Data Responds by sending a mouse report packet to host
0xEA Set Stream Mode Sets stream mode
0xE9 Status Request Returns current mode, en/disabled, scaling, button, resolution, and sampling rate
information to the host.
0xE8 Set Resolution Sets resolution to 1,2,4,8 counts/mm
0xE7 Set Scaling 2:1 Sets scaling to 2:1
0xE6 Reset Scaling Resets scaling to 1:1
0xAA Completion Code Command completion code
0xFA Peripheral ACK Sent to acknowledge host requests
The PS/2 specication calls out the following default mouse report format. Byte 0 is the button data (1=pressed,
0=released), X and Y optics sign bits, and X and Y overow bits. Byte 1 is the X optics data in 2’s complement format.
Byte 2 has the Y optics data in 2’s complement format. At reset or power-on the standard PS/2 reporting format is
enabled.
Bit 7 Bit 0
Byte 0
Y Overow X Overow Y sign X sign Always 1 Middle
Button
Right button Left button
Byte 1 X X X X X X X X
Byte 2 Y Y Y Y Y Y Y Y
Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.

10
After the following sequence of commands, the wheel report format is enabled.
0xF3, 0xC8 Set Sampling Rate 200 per second
0xF3, 0x64 Set Sampling Rate 100 per second
0xF3, 0x32 Set Sampling Rate 50 per second
0xF2, 0x03 Read Device Type returns a value of 0x03
After the Read Device Type command returns 0x03 to indicate that this is a Microsoft compatible three button-wheel
mouse, the wheel report format is enabled. After this initialization sequence, the PS/2 wheel reporting format is
enabled. The fourth byte represents the wheel data. This byte is assigned 0x01 for forward wheel movement and 0xFF
for backward wheel movement. When the wheel is idle, this value is 0x00.
Bit 7 Bit 0
Byte 0 Y Overow X Overow Y sign X sign Always 1 Middle Button Right button Left button
Byte 1 X X X X X X X X
Byte 2 Y Y Y Y Y Y Y Y
Byte 3 Wheel* Wheel* Wheel* Wheel* Wheel* Wheel* Wheel* Wheel*
The PS2 data transmission according to the PS/2 Hardware Interface Technical Reference including eleven bits for
each byte sent. The bits are sent in the following order with data valid on the falling edge of the clock. See the PS/2
Hardware Interface Technical Reference manual for timing information.
Start Bit
(Always 0)
Data
Bit 0
Data
Bit 1
Data
Bit 2
Data
Bit 3
Data
Bit 4
Data
Bit 5
Data
Bit 6
Data
Bit 7
Odd Parity
Bit
Stop Bit
(Always 1)
Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.

Appendix G: Kit Components
The designer’s kit contains components as follows:
Part Number Description Name Quantity
ADNK-5023-HTP2 Mouse Reference Design Mouse Reference Design Unit 1
ADNS-5020EN Solid-State Optical Mouse Sensor Sensor 5
HT82M35A-1002 Holtek Microcontroller Microncontroller 5
ADNS-5100 Round Lens Plate Lens 5
ADNS-5100-001 Trim Lens Plate Lens 5
ADNS-5200 LED Assembly Clip (Transparent) LED Clip 5
HLMP-ED80-XX000 639 nm T 1 ¾ (5 mm) Diameter LED LED 5
ADNK-5023-HTP2
CD
Includes Documentation and Support Files for ADNK-5023-HTP2
Documentation
a. ADNS-5020EN Data Sheet
b. HT82M35A-1002 Data Sheet
c. ADNS-5100 Data Sheet
d. ADNS-5200 Data Sheet
e. HLMP-ED80-XX000 LED Data Sheet
Hardware Support Files
a. ADNK-5023-HTP2 BOM List
b. ADNK-5023-HTP2 Schematic
c. IGES Base Plate Feature File
d. Gerber File
Software Support Files
a. Microcontroller .OTP code
(which can be programmed into HT48R06A-1 OTP microcontroller for evaluation)
1
For product information and a complete list of distributors, please go to our web site: www.avagotech.com
Avago, Avago Technologies, and the A logo are trademarks of Avago Technologies, Limited in the United States and other countries.
Data subject to change. Copyright © 2007 Avago Technologies Limited. All rights reserved.
AV02-1059EN - February 28, 2008
Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.
Table of contents
Other Avago Mouse manuals

Avago
Avago ADNK-3083 Guide

Avago
Avago ADNK-2083-ND24 User manual

Avago
Avago ADNK-5033-CSBT Guide

Avago
Avago ADNK-3043-ND24 Guide

Avago
Avago ADNK-5003 Guide

Avago
Avago LaserStream ADNK-6093-SP11 Guide

Avago
Avago ADNK-2703 Guide

Avago
Avago ADNK-5703 Guide

Avago
Avago ADNK-6003-SP01 Guide

Avago
Avago ADNK-6013-SP01 Guide