Operation Manual

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: [email protected]
Please visit our website at www.ams.com
AS5030 8-bit Programmable Magnetic Rotary Encoder
AS5030
AS5030-AB-2.0 Adapterboard
8 bit Programmable Magnetic Rotary Encoder
OPERATION MANUAL
1 General Description
lv
al
id
A software programmable (OTP) zero position simplifies
assembly as the zero position of the magnet does not need
to be mechanically aligned.
A Power Down Mode together with fast startup- and
measurement cycles allows for very low average power
consumption and makes the AS5030 also suitable for battery
operated equipment.
am
lc s
on A
te G
nt
st
il
The AS5030 is a contactless magnetic rotary encoder for
accurate angular measurement over a full turn of 360°.
It is a 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 absolute angle measurement provides instant indication
of the magnet’s angular position with a resolution of 8 bit =
256 positions per revolution. This digital data is available as a
serial bit stream and as a PWM signal.
In addition to the angle information, the strength of the
magnetic field is also available as a 6-bit code.
Data transmission can be configured for 1-wire (PWM), 2wires (CLK, DIO) or 3-wires (CLK, DIO, CS).
2 The AS5030 Adapterboard
2.1
Board description
The AS5030 adapter board is a simple circuit allowing to test and evaluate the AS5030 rotary encoder quickly without having to build
a test fixture or PCB.
The PCB can be used as standalone unit or attached to a microcontroller.
The standalone operation requires only a 5V power supply, the magnet’s angle can be read on the PWM or analog output.
P2 solder bridge
ni
ca
JP1 connector
(Alarm, PWM, analog,
power supply)
JP2 connector
(serial IO, power supply)
4 x 2.6mm mounting
holes
ch
Close (default): 3 wire serial mode
Open: 2 wire serial mode
P1 solder bridge
Te
Close (default): Sin/Cos output disabled
Open: Sin/Cos output enabled
AS5030 encoder
Analog Sin/Cos outputs
(P1 must be opened)
Figure 1: AS5030 Adapterboard
Revision 1.0, 26.February 2009
Page 1 of 10
www.austriamicrosystems.com
AS5030 8-bit Programmable Magnetic Rotary Encoder
Adapterboard Operation Manual
2.2
Mounting the AS5030 adapter board
Bearing
M2~M2.5 Screw + nut
Casing
Rotating shaft and magnet holder
Spacer
Not ferromagnetic (plastic, brass, copper,
stainless steel, aluminum…)
al
id
AS5030-AB PCB
Te
ch
ni
ca
am
lc s
on A
te G
nt
st
il
lv
JP2 connector, 3 pin
(Analog out, 5V, GND)
Figure 2: AS5030 adapter board mounting and dimension
A 6x2.5mm diametral magnet must be placed over on under the AS5030, and should be centered on the middle of the package with
a tolerance of 0.5mm.
The airgap between the magnet and the AS5030 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.0, 26.February 2009
Page 2 of 10
www.austriamicrosystems.com
AS5030 8-bit Programmable Magnetic Rotary Encoder
Adapterboard Operation Manual
3 AS5030 and adapter board pinout
GND Mag PWM DX
Ana
5V
GND
Prog
CLK
5V
GND
DIO
DI
CS
AS5030-AB-2.0
P2
P1
AS5030
al
id
GND SINn SIN COSn COS
Figure 3: AS5030 adapter board connectors and encoder pinout
Pin#
Pin#
Board
AS5030
JP1 - 1
Type
3
GND
S
JP1 - 2
13
5V
S
Positive supply voltage, 4.5V to 5.5V
JP1 - 3
10
CLK
DI_ST
Clock Input of Synchronous Serial Interface; Schmitt-Trigger input
JP1 - 4
11
CS
DI_ST
Chip Select for serial data transmission, active high; Schmitt-Trigger input,
external pull-down resistor (~50kΩ) required in read-only mode
JP1 - 5
12
DIO
DIO
Data output / command input for digital serial interface
JP1 - 6
-
DI
DI
Command input for digital serial interface. Connect to GND if not used.
JP1 - 7
2
PROG
S
OTP Programming voltage supply pin. Leave open or connect to VDD if not used
JP2 - 1
3
GND
S
Supply ground
JP2 - 2
13
5V
S
Positive supply voltage, 4.5V to 5.5V
JP2 - 3
-
Analog
-
0~5V analog output. Generated by the PWM output and filtered.
JP2 - 4
9
DX
DO
Digital output for 2-wire operation and Daisy Chain mode
JP2 - 5
16
PWM
DO
Pulse Width Modulation output, 2.26µs pulse width per step (2.26µs ~ 512µs)
JP2 - 6
1
MagRNG
DO_T
Push-Pull output. Is HIGH when the magnetic field strength is too weak, e.g. due to missing
magnet
JP2 - 7
3
GND
S
JP3 - 1
7
COS
-
Must be left unconnected for normal operation. COS output in SIN/COS mode (P1 open)
JP3 - 2
6
COSn
-
Must be left unconnected for normal operation. COSn output in SIN/COS mode (P1 open)
JP3 - 3
5
SIN
-
Must be left unconnected for normal operation. SIN output in SIN/COS mode (P1 open)
JP3 - 4
4
SINn
-
Must be left unconnected for normal operation. SINn output in SIN/COS mode (P1 open)
JP3 - 5
3
GND
S
Supply ground
bridge
am
lc s
on A
te G
nt
st
il
Supply ground
Supply ground
ca
Te
P2
C1
ch
bridge
14
ni
P1
Description
lv
Symbol
15
C2
DI
Configuration input for Sin/Cos output:
-
Connect to VSS for normal operation (P1 closed, by default)
-
High level (P1 open) to enable Sin/Cos outputs
This pin is scanned at power-on-reset and at wakeup from one of the Ultra Low Power Modes
Configuration input for serial wire mode:
DI
-
Connect to VSS for 3-wire operation (P2 closed, by default)
-
High level (P2 open) for 2-wire operation
This pin is scanned at power-on-reset and at wakeup from one of the Ultra Low Power Modes
Table 1: Pin description
Pin types: S:
supply pin
DI_ST: digital input / Schmitt-Trigger
DIO:
bi-directional digital pin
DO:
DO_T:
DI:
digital output
digital output / tri-state
digital input (standard CMOS; no pull-up or pull-down)
Revision 1.0, 26.February 2009
Page 3 of 10
www.austriamicrosystems.com
AS5030 8-bit Programmable Magnetic Rotary Encoder
Adapterboard Operation Manual
4 Operation use cases
4.1
Standalone Analog output mode
The simplest setup to test the AS5030 is to use the
adapter board in standalone mode. A 3-pin header
connector is present on JP2.
al
id
A header connector is present on JP2 on pin 1, 2, 3.
Connect a regulated power supply on 5V (pin #2) and
GND (pin #1).
lv
The “Ana” (pin #3) is an analog output, which is an RC
filtered signal of the PWM output of the AS5030. The
external device (AD converter, voltmeter…) connected on
the “Ana” pin should have an input impedance >470kΩ,
otherwise it should be buffered with an op. amp.
am
lc s
on A
te G
nt
st
il
By rotating the magnet, a progressive analog voltage
from 0 to 5V can be measured on the “Ana” pin (JP2 #3).
Rotating the magnet clock wise (AS5030 chip on the top
side) increases the Ana voltage, and counter clockwise
will decrease the voltage.
Figure 4: Using the analog output with the adapter board
4.2
Because of the RC filter, the response time of a jump
359°Æ0° (5VÆ0V) and 0°Æ359° (0VÆ5V) is 100ms.
Standalone PWM output mode
ni
ca
Instead of getting a proportional analog voltage
increasing with the magnet’s angle on the “Ana” output, a
PWM signal (JP2 pin #5) with a period of 581us, 2.26us
step and 5V pulse voltage can be connected to the
capture/timer input of a microcontroller in order to decode
the angle value.
Te
ch
Figure 6: PWM duty cycle depending on magnet position
Figure 5: Using the PWM output with the adapter board
Revision 1.0, 26.February 2009
Page 4 of 10
www.austriamicrosystems.com
AS5030 8-bit Programmable Magnetic Rotary Encoder
Adapterboard Operation Manual
5 Using the serial interface with MCU
The most complete and accurate solution for a MCU to read the angle of a magnet is the serial interface.
The 8 bit value of the angle will be directly read, and some other indicators as AGC value or alarm bits can be read at the
same time.
Serial commands can be sent to the AS5030 as well, like the low power mode, lock AGC or reset.
Note: The MCU must have 5V I/O connected to the AS5030 adapter board, the AS5030 is a 5V device.
5.1
2-wire serial interface
5.2
Jumper configuration: P1 and P2 close.
am
lc s
on A
te G
nt
st
il
lv
Jumper configuration: P1 close, P2 open.
3-wire serial interface
al
id
The connection between the MCU and the adapter board can be made with 2, 3 or 4 wires.
Figure 8: Bidirectional serial connection (3 wire)
ca
Figure 7: Bidirectional serial connection (2 wire)
The MCU GPIO used for the DIO data signal should be
bi-directional: the MCU sends a 5 bit command first then
receives a 16 bit value on the same line. The DI input of
the adapter board must be connected to GND in this
mode.
See AS5030 datasheet chapter 4.15.
The C source code for reading an angle with this
hardware configuration is described in Chapter 7.
Te
ch
ni
By opening P2, the AS5030 is configured to 2-wire data
transmission mode.
Only Clock (CLK) and Data (DIO) signals are required. A
Chip Select (CS) signal is automatically generated by the
DX output, when a time-out of CLK occurs (typ. 20μs).
Revision 1.0, 26.February 2009
Page 5 of 10
www.austriamicrosystems.com
AS5030 8-bit Programmable Magnetic Rotary Encoder
Adapterboard Operation Manual
5.3
4-wire serial interface
5.4
Jumper configuration: P1 and P2 close.
am
lc s
on A
te G
nt
st
il
lv
al
id
Jumper configuration: P1 and P2 close.
Serial daisy chain mode
Figure 9: Bidirectional serial connection (4 wire)
The command line and data line are separated:
The command line is a MCU output connected to DI, the
data line is an input of the MCU connected to DIO.
Te
ch
ni
ca
With this configuration, synchronous blocks like SPI can
be easily used to receive the 16 bit data value from the
AS5030. This communication method simplifies the
firmware code as well.
Figure 10: Daisy chain setup (3 wire)
The Daisy Chain mode allows connection of more than
one AS5030 to the same MCU.
Independent of the number of connected devices, the
interface to the controller remains the same with only
three signals: CSn, CLK and DO.
In Daisy Chain mode, the data from the second and
subsequent devices is appended to the data of the first
device.
See AS5030 datasheet chapter 4.21.
Revision 1.0, 26.February 2009
Page 6 of 10
www.austriamicrosystems.com
AS5030 8-bit Programmable Magnetic Rotary Encoder
Adapterboard Operation Manual
6 AS5030 adapterboard hardware
6.1
AS5030-AB-2.0 schematics
PROG
C2
U1
(C2 = HIGH)
GND
SINn
SIN
COSn
COS
Header 5
1
2
3
4
5
6
7
8
MagRNGn
PROG
VSS
Test3
Test2
Test1
Test0
TC
PWM
C2
C1
VDD
DIO
CS
CLK
DX
16
15
14
13
12
11
10
9
R3
PWM
C2
C1
5V
DIO
CS
CLK
DX
Analog
15k
C1
2.2u/10V
C3
2.2u/10V
GND
DI
AS5030
GND
Q1
BSS138
GND
5V
Closed: SinCos output disabled (default)
R2
100k P1
Open: SinCos output enabled
C1
Solder_Bridge
5V
JP1
7
6
5
4
3
2
1
R1
100k
DI
DIO
CS
CLK
5V
GND
Header 7
MagRNGn
PWM
DX
Analog
5V
GND
Closed: 3 wire mode (Default)
R4
100k P2
Open: 2 wire mode
C2
5V
GND
Solder_Bridge
Header 7
SERIAL I/O
OPTIONAL I/O
GND
am
lc s
on A
te G
nt
st
il
Figure 11: AS5030-AB-2.0 adapterboard schematics
AS5030-AB-2.0 PCB layout
Te
ch
ni
ca
6.2
GND
JP2
PROG
7
6
5
4
3
2
1
lv
5
4
3
2
1
Analog SIN/COS output
MagRNGn
nc
JP3
al
id
GND
Figure 12: AS5030-AB-2.0 adapterboard layout
Revision 1.0, 26.February 2009
Page 7 of 10
www.austriamicrosystems.com
AS5030 8-bit Programmable Magnetic Rotary Encoder
Adapterboard Operation Manual
7 C-Source code, simple AGC & Angle read
void main()
// This program reads
{
short SSI_Stream;
byte angle_value, agc_value;
float angle_degree;
the angle and AGC value from AS5030
// 16-bit value where the serial result will be saved
// 8-bit results: Angle and AGC
// Angle in degree
SSI_Stream = SerialRead (0);
// Send command “READ” (command ‘00000’)
// and reads the 16-bit result from AS5030
angle_value = (byte)(SSI_Stream & 0x00FF);
// Extract the angle value (8 bit)
agc_value = (byte)((SSI_Stream >> 8) & 0x3F);
// Extract the AGC value (6 bit)
angle_degree = (float)value * (360/256);// Convert the 8-bit angle to degrees (0-360°)
}
// This function writes the command
// and receives the result from the AS5030
al
id
short SerialRead(unsigned char command)
{
short RX_buffer;
// CS pin = ‘1’, AS5030 selected
// Send the command (exemple “READ” command ‘00000’)
DIO_HIGH_IMP();
RX_buffer = SSIread();
// DIO output high impedance (input mode), ready to read
// Receive the 16bit result from the AS5030
delay_us(Delay_Serial);
CLEAR_CS();
// CS pin = ‘0’
am
lc s
on A
te G
nt
st
il
return RX_buffer;
lv
SET_CS();
delay_us(Delay_Serial);
SSIwrite(command);
}
short void SSIread()
// This function reads the 16-bit value from the AS5030 DIO pin
{
xdata unsigned char current_bit;
short result;
result = 0;
// Is the shift buffer for the 16 bit data receive
for (current_bit = 16; current_bit; current_bit--)
// 16 steps loop (16 bit data)
{
result <<= 1; // Shift buffer value left 1 step (first time doesn’t count)
delay_us(Delay_Serial);
result += (VAL_DIO) ? 1 : 0;
// Small delay to be get the correct level on DIO
// If ‘1’ on DIO, store ‘1’ on the LSB else ‘0’
SET_CLK();
delay_us(Delay_Serial);
CLEAR_CLK();
// Generate a CLK pulse to shift the data on DIO
}
return result;
}
void SSIwrite(unsigned char command) // This function writes the 5-bit command to
{
// the AS5030 DIO pin
unsigned char current_bit;
unsigned char this_bit
ni
ca
for (current_bit = 5; current_bit; current_bit--)
// 5 steps loop (5 bit command)
{
this_bit = (command >> (current_bit-1)) & 0x01;
// Value of bit 5, then
// bit 4, …, bit 0
// If the current command bit is ‘1’:
if (this_bit) SET_DIO();
// then send ‘1’ on DIO (push-pull output)
else
CLEAR_DIO();
// Otherwise send ‘0’ on DIO (push-pull output)
Te
ch
if (current_bit == 1) // If Last Bit has been written
{
delay_us(Delay_Serial);
SET_CLK();
// Set Clock
delay_us(Delay_Serial);
DIO_HIGH_IMP();
// And DIO output of CPU in input mode
delay_us(Delay_Serial);
CLEAR_CLK();
// Clear Clock (datasheet timings)
}
else
{
// Else generate a CLK pulse to shift the data on DIO
delay_us(Delay_Serial);
SET_CLK();
delay_us(Delay_Serial);
CLEAR_CLK();
}
}
}
Revision 1.0, 26.February 2009
Page 8 of 10
www.austriamicrosystems.com
AS5030 8-bit Programmable Magnetic Rotary Encoder
Adapterboard Operation Manual
Table of contents
General Description........................................................................................................................................................... 1
The AS5030 Adapterboard................................................................................................................................................ 1
2.1
Board description...................................................................................................................................................... 1
2.2
AS5030 and adapter board pinout..................................................................................................................................... 3
Operation use cases.......................................................................................................................................................... 4
4.1
Standalone Analog output mode .............................................................................................................................. 4
5
6
Standalone PWM output mode................................................................................................................................. 4
al
id
4.2
Using the serial interface with MCU .................................................................................................................................. 5
5.1
2-wire serial interface................................................................................................................................................ 5
5.2
3-wire serial interface................................................................................................................................................ 5
5.3
4-wire serial interface................................................................................................................................................ 6
5.4
Serial daisy chain mode............................................................................................................................................ 6
lv
3
4
Mounting the AS5030 adapter board........................................................................................................................ 2
AS5030 adapterboard hardware ....................................................................................................................................... 7
6.1
AS5030-AB-2.0 schematics...................................................................................................................................... 7
6.2
am
lc s
on A
te G
nt
st
il
1
2
AS5030-AB-2.0 PCB layout...................................................................................................................................... 7
Te
ch
ni
ca
7
C-Source code, simple AGC & Angle read........................................................................................................................ 8
Table of contents........................................................................................................................................................................ 9
Copyrights ................................................................................................................................................................................ 10
Disclaimer................................................................................................................................................................................. 10
Contact Information .................................................................................................................................................................. 10
Revision 1.0, 26.February 2009
Page 9 of 10
www.austriamicrosystems.com
AS5030 8-bit Programmable Magnetic Rotary Encoder
Adapterboard Operation Manual
Copyrights
Copyright © 1997-2009, austriamicrosystems AG, Schloss Premstaetten, 8141 Unterpremstaetten, Austria-Europe.
Trademarks Registered ®. 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.0, 26.February 2009
Page 10 of 10
www.austriamicrosystems.com