austriamicrosystems AG is now ams AG The technical content of this austriamicrosystems application note is still valid. Contact information: Headquarters: ams AG Tobelbaderstrasse 30 8141 Unterpremstaetten, Austria Tel: +43 (0) 3136 500 0 e-Mail: ams_sales@ams.com Please visit our website at www.ams.com 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 lv al id 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 preprogrammed version AS5145-I10(-I12). An internal voltage regulator allows the AS5x40/AS5x45 to operate at either 3.3 V or 5 V supplies. am lc s on A te G nt st il 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. 2 The AS5040 Adapter board 2.1 Board description AS5x40/AS5x45 J1 connector (Prg, power supply, serial interface) J2 connector (PWM, incremental and status outputs) ch ni encoder ca The AS5040 adapter board is a simple circuit allowing test and evaluation of the AS5040/AS5045/AS5140/AS5145/AS5145I10/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. Te 4 x 2.6mm mounting holes Figure 1: AS5040 Adapterboard Revision 1.2, July 2009 Page 1 of 11 www.austriamicrosystems.com 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 Spacer Not ferromagnetic (plastic, brass, copper, stainless steel, aluminum...) Te ch ni ca am lc s on A te G nt st il lv al id 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 Page 2 of 11 www.austriamicrosystems.com AS5040/AS5045/AS5140/AS5145/AS5145-Ix Programmable Magnetic Rotary Encoder Adapterboard Operation Manual MagINCn 1 16 VDD5V MagDECn 2 15 VDD3V3 A_LSB_U 3 14 NC B_Dir_V 4 13 NC NC 5 12 PWM_LSB Index_W 6 11 CSn VSS 7 10 CLK Prog 8 9 DO Figure 3: AS5040 adapter board connectors and encoder pinout al id J1 J2 3 AS5x40/AS5x45 and adapter board pinout Pin# Pin# Symbol Board AS5040 Board JP1 - 1 7 GND S JP1 - 2 9 DO DO_T Data Output of Synchronous Serial Interface JP1 - 3 10 CLK DI_ST Clock Input of Synchronous Serial Interface; Schmitt-Trigger input JP1 - 4 11 CSn JP1 - 5 15 3V3 JP1 - 6 16 5V JP1 - 7 8 Prg JP2 - 1 7 GND S JP2 - 2 1 MagINC DO_OD Magnet Field Magnitude INCrease; active low, indicates a distance reduction between the magnet and the device surface. JP2 - 3 2 MagDEC DO_OD Magnet Field Magnitude DECrease; active low, indicates a distance increase between the device and the magnet Description am lc s on A te G nt st il Supply ground lv Type DI_PU_ST Chip Select, active low; Schmitt-Trigger input, internal pull-up resistor (~50k) connect to VSS in incremental mode S 3V-Regulator Output S 5V Supply DI_PD 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 AS5040 - AS5140 - AS5145 (programmed) only 3 A DO Mode1.x: Quadrature A channel Mode2.x: Least Significant Bit Mode3.x: U signal (phase1) ca JP2 - 4 AS5040 - AS5140 - AS5145 (programmed) only 4 B DO ch ni JP2 - 5 6 Te JP2 - 6 JP2 - 7 12 Pin types: DO_OD DO DI_PD DI_PU Ind PWM 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 DO Pulse Width Modulation of approx. 1kHz; LSB in Mode3.x Table 1: Pin description digital output open drain digital output digital input pull-down digital input pull-up S DI DO_T ST Revision 1.2, July 2009 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 Standalone SSI output mode 4.2 Standalone PWM output mode am lc s on A te G nt st il lv al id 4.1 Figure 4: Using the analog 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. Figure 5: Using the PWM output with the adapter board 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. PW MIN 0 deg (Pos 0) 1s 102 5s PW M AX 359.65 deg (Pos 1023) ch ni ca Angle 102 4 s Te Figure 6: PWM duty cycle depending on magnet position Revision 1.2, July 2009 Page 4 of 11 www.austriamicrosystems.com AS5040/AS5045/AS5140/AS5145/AS5145-Ix Programmable Magnetic Rotary Encoder Adapterboard Operation Manual Standalone incremental output am lc s on A te G nt st il lv al id 4.3 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). Te ch ni ca For further information, please refer to datasheet. Revision 1.2, July 2009 Page 5 of 11 www.austriamicrosystems.com AS5040/AS5045/AS5140/AS5145/AS5145-Ix Programmable Magnetic Rotary Encoder Adapterboard Operation Manual Daisy chain mode ni ca am lc s on A te G nt st il lv al id 4.4 ch Figure 8: Using Daisy-Chain mode with the adapter board Te By using more than one adapter board, a setup in daisy chain mode is possible. In this mode capacitor C3 (refer to Fig.10) must be disconnected when using the 1nF capacitor shown in Fig.8. or directly replaced by this capacitor. The serial data of all connected devices is read from the DO pin of the first device in the chain. The Prog pin of the last device in the chain should be connected to VSS. The length of the serial bit stream increases with every connected device (board) by n * (16+1) bits. Due to R = 100R and C = 1nF, the CLK is limited the maximum 1MHz. Revision 1.2, July 2009 Page 6 of 11 www.austriamicrosystems.com AS5040/AS5045/AS5140/AS5145/AS5145-Ix Programmable Magnetic Rotary Encoder Adapterboard Operation Manual Programming the AS5040 am lc s on A te G nt st il lv al id 5 Figure 9: Programming the AS5040 After power-on, programming the AS5040 is enabled with the rising edge of CSn with Prog = high and CLK = low. 16 bit configuration data must be serially shifted into the OTP register via the Prog-pin. The first "CCW" bit is followed by the zero position data (MSB first / 10 bit for AS5x40 and 12 bit for AS5x45) and some mode settings (please refer to datasheet). Data must be valid at the rising edge of CLK. Te ch ni ca After writing data into the OTP register it can be permanently programmed by rising the Prog pin to the programming voltage VPROG of 7.3-7.5V. 16 CLK pulses must be applied to program the fuses. For exiting the programming mode, the chip must be reset by a power-on-reset. The programmed data is available after the next power-up. Revision 1.2, July 2009 Page 7 of 11 www.austriamicrosystems.com AS5040/AS5045/AS5140/AS5145/AS5145-Ix Programmable Magnetic Rotary Encoder Adapterboard Operation Manual 6 AS5040 Differences to AS5045 incremental encoder Not used Pin 3: not used Pin 4:not used Pins 1 and 2 MagINCn, MagDECn: same feature as AS5040, additional OTP option for red-yellow-green magnetic range MODE pin, switch between fast and slow mode PWM output: frequency selectable by OTP: 1s / step, 4096 steps per revolution, f=244Hz 2s/ step, 4096 steps per revolution, f=122Hz selectable by MODE input pin: 2.5kHz, 10kHz 384s (slow mode) 96s (fast mode) 0.03 degrees max. (slow mode) 0.06 degrees max. (fast mode) zero position, rotational direction, PWM disable, 2 Magnetic Field indicator modes, 2 PWM frequencies Pin 6 Pin 12 Propagation delay 48s 0.12 degrees zero position, rotational direction, incremental modes, index bit width Te ch ni ca Transition noise (rms; 1sigma) OTP programming options am lc s on A te G nt st il sampling frequency AS5040 10bit, 0.35/step read: 16bits (10bits data + 6 bits status) OTP write: 16 bits (10bits zero position + 6 bits mode selection) quadrature, step/direction and BLDC motor commutation modes Pin 3:incremental output A_LSB_U Pin 4:incremental output B_DIR_V MagINCn, MagDECn indicate in-range or out-of-range magnetic field plus movement of magnet in z-axis Pin 6:Index output PWM output: 1s / step, 1024 steps per revolution, 976Hz PWM frequency fixed at 10kHz @10bit resolution al id AS5045 12bits, 0.088/step. read: 18bits (12bits data + 6 bits status) OTP write: 18 bits (12bits zero position + 6 bits mode selection) lv Building Block Resolution Data length Revision 1.2, July 2009 Page 8 of 11 www.austriamicrosystems.com AS5040/AS5045/AS5140/AS5145/AS5145-Ix Programmable Magnetic Rotary Encoder Adapterboard Operation Manual 7 AS5040 adapter board hardware AS5040-AB-2.0 schematics am lc s on A te G nt st il lv al id 7.1 Figure 10: AS5040-AB-2.0 adapterboard schematics AS5040-AB-2.0 PCB layout Figure 11: AS5040-AB-2.0 adapter board layout Te ch ni ca 7.2 Revision 1.2, July 2009 Page 9 of 11 www.austriamicrosystems.com AS5040/AS5045/AS5140/AS5145/AS5145-Ix Programmable Magnetic Rotary Encoder Adapterboard Operation Manual Table of contents General Description........................................................................................................................................................... 1 The AS5040 Adapter board............................................................................................................................................... 1 2.1 Board description...................................................................................................................................................... 1 2.2 3 4 Mounting the AS5040 adapter board........................................................................................................................ 2 AS5x40/AS5x45 and adapter board pinout ....................................................................................................................... 3 Operation use cases.......................................................................................................................................................... 4 4.1 Standalone SSI output mode.................................................................................................................................... 4 4.2 Standalone PWM output mode................................................................................................................................. 4 4.3 Standalone incremental output ................................................................................................................................. 5 al id 1 2 Figure 7: Using the Incremental output with the adapter board ............................................................................................. 5 4.4 lv Programming the AS5040 ................................................................................................................................................. 7 AS5040 Differences to AS5045......................................................................................................................................... 8 AS5040 adapter board hardware ...................................................................................................................................... 9 7.1 AS5040-AB-2.0 schematics...................................................................................................................................... 9 7.2 am lc s on A te G nt st il 5 6 7 Daisy chain mode ..................................................................................................................................................... 6 AS5040-AB-2.0 PCB layout...................................................................................................................................... 9 Te ch ni ca Table of contents...................................................................................................................................................................... 10 Copyrights ................................................................................................................................................................................ 11 Disclaimer................................................................................................................................................................................. 11 Contact Information .................................................................................................................................................................. 11 Revision 1.2, July 2009 Page 10 of 11 www.austriamicrosystems.com AS5040/AS5045/AS5140/AS5145/AS5145-Ix Programmable Magnetic Rotary Encoder Adapterboard Operation Manual Copyrights Copyright (c) 1997-2009, austriamicrosystems AG, Schloss Premstaetten, 8141 Unterpremstaetten, Austria-Europe. Trademarks Registered (R). All rights reserved. The material herein may not be reproduced, adapted, merged, translated, stored, or used without the prior written consent of the copyright owner. All products and companies mentioned are trademarks or registered trademarks of their respective companies. Disclaimer am lc s on A te G nt st il lv al id Devices sold by austriamicrosystems AG are covered by the warranty and patent indemnification provisions appearing in its Term of Sale. austriamicrosystems AG makes no warranty, express, statutory, implied, or by description regarding the information set forth herein or regarding the freedom of the described devices from patent infringement. austriamicrosystems AG reserves the right to change specifications and prices at any time and without notice. Therefore, prior to designing this product into a system, it is necessary to check with austriamicrosystems AG for current information. This product is intended for use in normal commercial applications. Applications requiring extended temperature range, unusual environmental requirements, or high reliability applications, such as military, medical life-support or lifesustaining equipment are specifically not recommended without additional processing by austriamicrosystems AG for each application. The information furnished here by austriamicrosystems AG is believed to be correct and accurate. However, austriamicrosystems AG shall not be liable to recipient or any third party for any damages, including but not limited to personal injury, property damage, loss of profits, loss of use, interruption of business or indirect, special, incidental or consequential damages, of any kind, in connection with or arising out of the furnishing, performance or use of the technical data herein. No obligation or liability to recipient or any third party shall arise or flow out of austriamicrosystems AG rendering of technical or other services. Contact Information Headquarters austriamicrosystems AG A-8141 Schloss Premstaetten, Austria Tel: +43 (0) 3136 500 0 Fax: +43 (0) 3136 525 01 Te ch ni ca For Sales Offices, Distributors and Representatives, please visit: http://www.austriamicrosystems.com Revision 1.2, July 2009 Page 11 of 11 www.austriamicrosystems.com Mouser Electronics Authorized Distributor Click to View Pricing, Inventory, Delivery & Lifecycle Information: ams: AS5140 AB