Main Content

Hall-Effect Rotary Encoder

Four-element Hall-effect rotary encoder

  • Hall-Effect Rotary Encoder block

Libraries:
Simscape / Electrical / Sensors & Transducers

Description

The Hall-Effect Rotary Encoder block models a 360° rotary position sensor using four equally spaced Hall elements under a magnetized, rotating magnet. The elements generate four sinusoidal waveforms.

This figure shows a schematic of the encoder. The hall elements, yp, yn, xp, and xn, remain in a fixed position while the north and south poles of the magnet rotate at the angle θ.

Equations

These equations describe the voltages between the elements of the rotary encoder:

vx=Vx0+Axcos(θ)

vy=Vy0+Aycos(θπ2+β),

where:

  • vx is the voltage between elements xp and xn;

  • vy is the voltage between elements yp and yn;

  • Ax and Ay are the voltage amplitudes for the x and y axes that reflect the sensitivity mismatch;

  • Vx0 and Vy0 are the voltage offsets for the x and y axes;

  • β is the quadrature error.

The block uses this equation to decode the angle:

θout=arctan(vyvx).

Variables

To set the priority and initial target values for the block variables before simulation, use the Initial Targets section in the block dialog box or Property Inspector. For more information, see Set Priority and Initial Target for Block Variables.

Nominal values provide a way to specify the expected magnitude of a variable in a model. Using system scaling based on nominal values increases the simulation robustness. You can specify nominal values using different sources, including the Nominal Values section in the block dialog box or Property Inspector. For more information, see System Scaling by Nominal Values.

Examples

Ports

Output

expand all

Physical signal output port for the decoded position in terms of the rotational angle of the magnetic field in the x-y plane.

Dependencies

To enable this port, set the Output interface parameter to Decoded angular position.

Conserving

expand all

Mechanical rotational conserving port associated with the sensor positive probe.

Mechanical rotational conserving port associated with the sensor negative (reference) probe.

Electrical conserving port associated with the y-axis positive Hall field.

Dependencies

To enable this port, set the Output interface parameter to Electrical connections.

Electrical conserving port associated with the y-axis negative Hall field.

Dependencies

To enable this port, set the Output interface parameter to Electrical connections.

Electrical conserving port associated with the x-axis positive Hall field.

Dependencies

To enable this port, set the Output interface parameter to Electrical connections.

Electrical conserving port associated with the x-axis negative Hall field.

Dependencies

To enable this port, set the Output interface parameter to Electrical connections.

Parameters

expand all

X-axis voltage amplitude, in volts.

Y-axis voltage amplitude, in volts.

Potential difference in the electric current flow through the electric conductor in the absence of external magnetic field on the x-axis, in volts.

Potential difference in the electric current flow through the electric conductor in the absence of external magnetic field on the y-axis, in volts.

Amount of quadrature error. Quadrature switching can decrease offset errors.

Port interface for decoded information.

Set this parameter to Electrical connections to output the Hall voltages at each sensor. Choosing this option enables the yp, yn, xp, and xn conserving ports.

Set this parameter to Decoded angular position to output the rotational angle of the magnetic field in the x-y plane. Choosing this option enables the Angle physical signal port.

Extended Capabilities

expand all

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Version History

Introduced in R2019b