ALLEGRO microsystems A31315 Short-Stroke Rotary User Guide
- June 3, 2024
- ALLEGRO microsystems
Table of Contents
microsystems A31315 Short-Stroke Rotary
User Guide
A31315 Short-Stroke Rotary
SHORT-STROKE ROTARY APPLICATION OF THE A31315
By David Hunter
Allegro MicroSystems
Introduction
This guide is intended to assist the reader in applying the A31315 Samples Programming Software to their shortstroke rotary application, such as a throttle-body, which uses the A31315 Advanced Linear Sensor and a target motion of 0 to 90°. It aims to briefly discuss the magnetic target and instruct the reader on the application of gain and offset, two-point programming, and linearization for the highest level of performance possible.
Magnetic Target
Magnetic target selection is typically approached with twocore requirements:
target cost and target field strength. For applications using the A31315, it
is preferable that the peak field strength in any one channel reach a minimum
of 300 G for overall sensor performance but is not required. This number is
blind to material types and air gaps, but cost sensitivities will influence
those factors. A neodymium N52 material can produce an excellentfield strength
for the given size but may cost significantlymore than an AlNiCo magnet at a
weaker field, requiringa narrower air gap.
For the example in this document, a diametrically polarized N35 magnet of
0.375-inch diameter is used with a 4 mm air gap (reducing the peak field). The
sensor is installed on a real throttle body module and is intended to be
programmed to linearly output sensed positionfrom 0.5 to 4.5 V. A simple 1-D
linear sensor sensing a rotating diametricallypolarized magnet will not
receive a linear field proportionate to angle; at best, it will detect a
sinusoidal signal. Further, unless every magnet is precisely installed from
module to module, the initial angle will be unknown,which means a lookup table
mapping of input to output becomes less viable.
The A31315 offers sensing of two axes which—through the application of an
integrated arctangent function via a CORDIC engine—can provide a generalized
initial magnetic position. Figure 1 illustrates the ideal case where a
magnetic target of 250 G strength travels over 90° from an arbitrary starting
point.
Figure 1: Ideal sensed input of a perfect 250 G magnet.
In reality, a magnet is an imperfect quantity. Additionally, the position of the sensor once installed is seldom perfectly centered. The result is then measured as shown in Figure3.
Figure 3: Sensed magnetic target.
Note the distorted shape of the top curve, as well as a gross
offset.
Figure 4: Reported angle output with the distorted inputs.
For the sensor to then reflect the position truthfully, it needs its own
corrections.
The A31315 provides three layers of corrections to obtain the most accurate
representation of the physical position of the module:
- Sensor gain and offset adjustments for each channel input (Including additional temperature coefficient options for more complex cases).
- Two-point correction of angle output to adjust starting point reporting and gain slope.
- Linearization up to 33 points to correct for nonlinear imperfections.
Fixing the Hall Sensor Gain and Offset
For the best performance, correcting gain and offset up front will have the
greatest impact on performance later on.
To correct for the sensor data, one needs to model the sensed signals. This is
typically easiest to do by finding one signal that touches zero. For the
signals in Figure 3,
the bottom curve crosses zero at 30.36 degrees, but is not symmetric about
this zero. The curve itself is descending, suggesting that it can be described
with a cosine function. Therefore, the top curve is the complementary sine
function.
There are numerous approaches to fitting the sensed curves to mathematical
models of varying degrees of accuracy. With the goal being to find the angle
of mechanical position, the signals should be kept simple to sine and cosine
functions with amplitudes and offsets as the only variable to be
found.
For this application, the use of curve-fitting found the inputs to be
approximated as:
Equation 1: a(θ) = 202 cos(θ + 0.53) [G] Equation 2: b(θ) = 225 sin(θ + 0.53)
[G] Numerically (by counts), Equation 1 and Equation 2 are described as:
Equation 3: a(θ) = 6646 cos(θ + 0.53)
Equation 4: b(θ) = 7373 sin(θ + 0.53)
In order to obtain the corrected gain and offset, there are four registers in
the A31315 that handle these coefficients:
- Offs_c_a – adjusts the offset of channel A.
- Offs_c_b – adjusts the offset of channel B.
- Sens_c_a – adjust the sensitivity of Channel A.
- Sens_c_b – adjusts the sensitivity of channel B.
The default values are:
- Offsc
= 0 . - Sensc
= 2048.
When using the A31315 Samples programming software, these registers are found
in the EEPROM tab, shown in Figure 6.Figure 6: Offset registers
in the A31315 Samples software.
Figure 7: Sense registers within the Samples software.
Ultimately, the amplitudes should be equalized to achieve best results. In
this case, with channel A, the sensitivity is less than the desired 225 G
measured for channel B.
So leveraging the sensitivity register, the sensitivity will be increased from
1 to 7373/6646 or 1.109.
Equation 5: sens_c_b = 1.109 × 2048
Equation 6: sens_c_b = 2048 [default] The sensitivity will affect the offset
values, so gain should be corrected before considering offset adjustments.
Restating equation 3:
Equation 7: a(θ) = 7373 sin(θ + 0.53)
In instances where an offset was needed, this would be adjusted after the gain
adjustment of the front end. While the sensitivity is generally intuitive
(2048 counts = 1,
1024 counts = 0.5, etc.), the offset registers are two bits smaller and
additionally signed in nature, making every one count of offset equivalent to
eight counts of output.
Figure 8: The ideal curves compared to the sensor with gain and
offset applied. Note the nonlinear distortion in Channel A’s output versus the
ideal signal.
Figure 9: The resulting angle output reported by the sensor compared
to the ideal angle output.
Angle Gain and Offset Correction
For compliance to the feedback and control system, the sensor must output
analog values from 0.5 to 4.5 V. Presently, the angle output provided would
grant 0.166 to 0.458 V, hardly of value. Thus, an additional function is
necessary to correct for this limited range. The A31315 offers a two-point
programming block that will adjust the starting point of the output, as well
as adjust the gain slope of the angle output.
There are two methods to program the coefficient andoffset values in the two-
point programming block:
-
Register manipulation via:
□ Angle_gain
□ Pre_gain_offset -
Semi-automatic via Samples Programming Software
Register Manipulation
Performing the adjustments through register manipulation isstraightforward and
is easily calculated by hand. Relevantregisters for this block are found
within the “Short-Stroke”option of the dropdown menu within the EEPROM tab.
Figure 10: Two-point programming register group selection
Thus far, the plots have been expressed relative to the 90-degree rotation.
The samples software operates on the assumption of 360° maximum and so will
express results
differently than have been shown so far.
Internally, the A31315 operates on a range of 0 to 65535 counts to represent
the final angle. To set the zero point, an offset would be added to induce a
rollover and reach a count of 0. However, when noise considerations are given,
it is useful to add a small additional offset to overcome the noise. If the
final value is 90 degrees, and a small offset of 0.05 degrees is added, the
offset can be found from the equation:
Equation 8: 90.05 = current_minimum + offset
In the case of Figure 9, the minimum is around 11.5°, so:
Equation 9: 90.05 – 11.5 = 78.55
For the value to enter into the Code field (see Figure 11):
Equation 10: Counts = 78.55 / 90 × 32768
Equation 11: Counts = 28599
Entering 28599 into the “code” field of the register table would populate the
corresponding value field with 314.198°.
This would be correct in applications that traverse the full 360°, and
incidentally is the value four times the result of Equation 11.
Angle gain is just as easy to obtain; first find the present change of angle:
Equation 12: 34° – 11.5° = 22.5°
Then find the maximum possible output angle:
Equation 13: max_angle = 90 × 65535 / 65536
Equation 14: max_angle = 89.998
The needed gain is then:
Equation 15: angle_gain = 89.998 / 22.5
Equation 16: angle_gain = 3.9999
This value may be entered directly into the “value” field of the angle_gain
row within the software. This may be computed manually as:
Equation 17: Angle_gain = 3.999 × 1024
Equation 18: Angle_gain = 4096Figure 11: Manually
processed two-point-programming values.
From the settings written to the two-point programming block, the new results
are shown below:
Figure 12: New angle output vs. input after two-point programming
block.
It is at this time that angle error should be given attention.
Figure 13 shows the angle error exhibited by the sensor.Figure 13: Angle error of the sensor with two-point programming
applied.
Linearization
The last step in tuning the A31315 is to correct for the angle errors of
Figure 13.
The linearization engine of the A31315 can take 6 to 33 angle samples and
perform a piecewise correction on the results.
For this example, only eight points will be leveraged as a good balance of
accuracy and configuration time. Table 1 presents a list of true input
position, to sensed position:
Table 1: Ideal position vs sensed output
Real Position | Sensed Position |
---|---|
0 | 0.00825 |
11.24983 | 8.3757 |
22.49965 | 19.25903 |
33.74948 | 30.13688 |
44.99933 | 41.86065 |
56.24915 | 53.30018 |
67.49898 | 65.38375 |
89.99863 | 89.63883 |
Table 2: Same values of Table 1, corrected to satisfy the software’s requirements of range.
Real Position (corrected) | Sensed Position (corrected) |
---|---|
0 | 0.033 |
44.9993 | 33.5028 |
89.9986 | 77.0361 |
134.9979 | 120.5475 |
179.9973 | 167.4426 |
224.9966 | 213.2007 |
269.9959 | 261.535 |
359.9945 | 358.5553 |
These values may be entered directly or loaded from a file into the
Linearization tab within the samples software.
Note: Be mindful, as the software operates on 360° ranges, all values
should be multiplied by 4 to be compliant with the software’s
expectation.Figure 14: Linearization
tab within the A31315 Samples Software.
In this case, a simple click of “Write to Device” computes the coefficients
and programs the device. The new final result is shown in Figure 15.Figure 16: Angle output error post-linearization.
As Figure 16 illustrates, the angle error changed from a serious 3° down to
0.08° or less.
Thus, with the A31315, high accuracy is obtained in measuring the butterfly
valve’s true position for the feedback and control system.
Once the sensor has been tuned to the desired operating range, the final step
is to configure the part to produce the intended output. In this application,
correct output spans 0.5 to 4.5 V, leaving margins for wire-break detect or
other diagnostic/error detecting. The A31315 includes output scaling through
the register be_scale. For this particular application, setting be_scale to 6
compresses the output to within 0.5 V from either rail, granting the specified
range. Figure 17 illustrates the analog output as a function of butterfly
valve position.
Figure 17: Analog Output as a function of butterfly valve position.
Revision History
Number | Date | Description |
---|---|---|
– | 21-Sep-20 | Initial release |
1 | 19-Sep-22 | Minor editorial update (improved text spacing) |
Copyright 2022, Allegro MicroSystems.
The information contained in this document does not constitute any
representation, warranty, assurance, guaranty, or inducement by Allegro to the
customer with respect to the subject matter of this document. The information
being provided does not guarantee that a process based on this information
will be reliable, or that Allegro has explored
all of the possible failure modes. It is the customer’s responsibility to do
sufficient qualification testing of the final product to ensure that it is
reliable and meets all design requirements. Copies of this document are
considered uncontrolled documents.
955 PERIMETER ROAD
• MANCHESTER, NH 03103
• USA +1-603-626-2300
• FAX: +1-603-641-5336
• ALLEGROMICRO.COM
Read User Manual Online (PDF format)
Read User Manual Online (PDF format) >>