AS5040 8-bit Programmable Magnetic Rotary Encoder
AS5040/AS5045/AS5140/AS5145/AS5145-I10(-I12)
Programmable Magnetic Rotary Encoder
AS5040-AB-v2.0
Adapterboard
OPERATION MANUAL
1 General Description
The AS5x40/AS5x45 series are contactless magnetic rotary
encoders for accurate angular measurement over a full turn
of 360°. They are system-on-chip, combining integrated Hall
elements, analog front end and digital signal processing in a
single device.
To measure the angle, only a simple two-pole magnet,
rotating over the center of the chip, is required. The magnet
may be placed above or below the IC.
The absolute angle measurement provides instant indication
of the magnet’s angular position with a resolution of
0.35° = 1024 (AS5x40 – 10bit ) or 0.0879° = 4096 (AS5x45 –
12bit) positions per revolution. This digital data is available as
a serial bit stream and as a PWM signal.
Furthermore, a user-programmable incremental output is
available, making the chip suitable for replacement of various
optical encoders.
The AS5145 is also available as 10bit or 12bit pre-
programmed version AS5145-I10(-I12).
An internal voltage regulator allows the AS5x40/AS5x45 to
operate at either 3.3 V or 5 V supplies.
2 The AS5040 Adapter board
2.1
Board description
The AS5040 adapter board is a simple circuit allowing test and evaluation of the AS5040/AS5045/AS5140/AS5145/AS5145-
I10/AS5145-I12 rotary encoder quickly without building a test fixture or PCB.
The PCB can be used as standalone unit or attached to a microcontroller. The standalone operation requires a 5V power supply
only; the magnet’s angle can be read on the PWM or analog output.
AS5x40/AS5x45
encoder
J1 connector
(Prg, power supply,
serial interface)
J2 connector
(PWM, incremental and
status outputs)
4 x 2.6mm mounting
holes
Figure 1: AS5040 Adapterboard
Revision 1.2, July 2009
www.austriamicrosystems.com
Page 1 of 11
AS5040/AS5045/AS5140/AS5145/AS5145-Ix Programmable Magnetic Rotary Encoder
Adapterboard Operation Manual
2.2
Mounting the AS5040 adapter board
Bearing
M2~M2.5 Screw + nut
Casing
Rotating shaft and magnet holder
Not ferromagnetic (plastic, brass, copper,
stainless steel, aluminum…)
Spacer
AS5040-AB PCB
Figure 2: AS5040 adapter board mounting and dimension
A diametric magnet must be placed over on under the AS5x40/AS5x45 encoder, and should be centered on the middle of the
package with a tolerance of 0.5mm.
The airgap between the magnet and the encoder casing should be maintained in the range 0.5mm~2mm.
The magnet holder must not be ferromagnetic. Materials as brass, copper, aluminum, stainless steel are the best choices to make
this part.
Revision 1.2, July 2009
www.austriamicrosystems.com
Page 2 of 11
AS5040/AS5045/AS5140/AS5145/AS5145-Ix Programmable Magnetic Rotary Encoder
Adapterboard Operation Manual
3 AS5x40/AS5x45 and adapter board pinout
J2
MagINCn
MagDECn
A_LSB_U
B_Dir_V
NC
Index_W
VSS
Prog
1
2
3
4
5
6
7
8
16
15
14
13
12
11
10
9
VDD5V
VDD3V3
NC
NC
PWM_LSB
CSn
CLK
DO
J1
Figure 3: AS5040 adapter board connectors and encoder pinout
Pin#
Board
Pin#
AS5040
Symbol
Type
Board
Description
JP1 - 1
JP1 - 2
JP1 - 3
JP1 - 4
JP1 - 5
JP1 - 6
JP1 - 7
JP2 - 1
JP2 - 2
JP2 - 3
7
9
10
11
15
16
8
7
1
2
GND
DO
CLK
CSn
3V3
5V
Prg
GND
MagINC
MagDEC
S
DO_T
DI_ST
DI_PU_ST
S
S
DI_PD
S
DO_OD
DO_OD
Supply ground
Data Output
of Synchronous Serial Interface
Clock
Input of Synchronous Serial Interface; Schmitt-Trigger input
Chip Select,
active low; Schmitt-Trigger input, internal pull-up resistor (~50kΩ) connect to VSS
in incremental mode
3V-Regulator Output
5V Supply
OTP
Programming
Input and Data Input for Daisy Chain mode. Internal pull-down resistor
(~74kΩ).
May be connected to VSS if programming is not used
Supply ground
Magnet Field
Magnitude INCrease;
active low, indicates a distance reduction between the
magnet and the device surface.
Magnet Field
Magnitude DECrease;
active low, indicates a distance increase between the
device and the magnet
AS5040 – AS5140 – AS5145 (programmed) only
Mode1.x:
Quadrature
A
channel
Mode2.x:
Least Significant Bit
Mode3.x:
U
signal (phase1)
AS5040 – AS5140 – AS5145 (programmed) only
JP2 - 4
3
A
DO
JP2 - 5
4
B
DO
Mode1.x:
Quadrature
B
channel quarter period shift to channel A.
Mode2.x:
Direction
of Rotation
Mode3.x:
V
signal (phase2)
AS5040 – AS5140 – AS5145 (programmed) only
Mode1.x and Mode2.x
:
Index
signal indicates the absolute zero position
Mode3.x:
W
signal (phase3)
AS5045 – AS5145 (unprogrammed)
Mode input, connect to VDD5 (Fast mode) or GND (Slow mode); do not change during
operation
JP2 - 6
6
Ind
DO
JP2 - 7
12
PWM
DO
Pulse Width Modulation
of approx. 1kHz;
LSB
in
Mode3.x
Table 1: Pin description
Pin types: DO_OD
DO
DI_PD
DI_PU
Revision 1.2, July 2009
digital output open drain
digital output
digital input pull-down
digital input pull-up
S
DI
DO_T
ST
supply pin
digital input
digital output / tri-state
Schmitt-Trigger input
Page 3 of 11
www.austriamicrosystems.com
AS5040/AS5045/AS5140/AS5145/AS5145-Ix Programmable Magnetic Rotary Encoder
Adapterboard Operation Manual
4 Operation use cases
4.1
Standalone SSI output mode
4.2
Standalone PWM output mode
Figure 4: Using the analog output with the adapter board
Figure 5: Using the PWM output with the adapter board
The most complete and accurate solution for a MCU to
read the angle of a magnet is the serial interface.
The serial word contains 16 bits for AS5x40 or 18 bits for
AS5x45 and consists of 10 bit (AS5x40) or 12 bit
(AS5x45) angle value and some other indicator bits like
MagINC, MagDEC, which can be read at the same time.
The AS5040 provides a pulse width modulated output
(PWM), whose duty cycle is proportional to the measured
angle. The PWM signal (J2 pin #7) with a period of
1025us (1us step) and 5V pulse voltage can be
connected to the capture/timer input of a microcontroller
in order to decode the angle value.
Angle
0 deg
(Pos 0)
1µs
102 5µs
PW
MIN
PW
M AX
359.65 deg
(Pos 1023)
102 4µ s
Figure 6: PWM duty cycle depending on magnet position
Revision 1.2, July 2009
www.austriamicrosystems.com
Page 4 of 11
AS5040/AS5045/AS5140/AS5145/AS5145-Ix Programmable Magnetic Rotary Encoder
Adapterboard Operation Manual
4.3
Standalone incremental output
Figure 7: Using the Incremental output with the adapter board
Three different incremental output modes are possible with quadrature A/B being the default mode (two-channel quadrature,
step / direction incremental signal (LSB) and the direction bit in clockwise (CW) and counter-clockwise (CCW) direction.
The pre-programmed version AS5145-I10 provides a 10bit and AS5145-I12 a 12bit incremental output.
The AS5045 do not offer an incremental output (see chapter 6).
For further information, please refer to datasheet.
Revision 1.2, July 2009
www.austriamicrosystems.com
Page 5 of 11