How does it work?
Magnetic Rotary 2 Click as its foundation uses the AEAT-9922, an angular magnetic rotary sensor manufactured with a CMOS standard process providing accurate angular measurement over a full 360 degrees of rotation from Broadcom Limited. It can accurately measure a magnet’s rotational angle when it is placed in alignment and perpendicular to the device by using its integrated Hall sensors to detect its magnetic field. The detected magnetic signals are then taken as input signals to be properly conditioned to negate their non-idealities before inputting them into the analog amplifiers for strength amplification and filtering. After which, the amplified analog signals are then fed into the internal analog-to-digital converter (ADC) to be converted into digital signals for the final digital processing stage.
A simple two-pole magnet generates the necessary magnetic field by rotating it perpendicularly. Wide magnetic field sensor configurations allow On-Axis (end of shaft) or Off-Axis (side of the shaft) modes in application. The used magnet should have sufficient magnetic field strength (mT) to generate the magnetic field for signal generation. The device provides digital information of magnetic field strength high and magnetic field strength low to indicate whether the magnets are too close or far away from our device’s surface.
Magnetic Rotary 2 Click communicates with MCU through a standard SPI interface supporting the common SPI mode, SPI Mode 1. Digital processing provides a digitized output of the absolute and incremental signals. Each output is configurable via CS pin, MSEL (Mode Selection for desirable protocol) jumper, and AEAT-9922 internal PSEL registers configurable through memory. In addition, an absolute angular representation also can be selected using a pulse width modulated (PWM) signal by populating onboard R2 resistor, which provides an instant indication of the magnet’s angular position with a selectable and one-time programmable resolution from 10 to 18 bits. Alongside this feature, the communication error signal labeled as ERR and routed on the INT pin of the mikroBUS™ socket can be activated by populating the onboard R3 resistor.
The incremental outputs are available from digital outputs of their respective A, B, and I pins, the same for the U, V, and W commutation signals, routed to the upper-right side onboard header. The incremental positions are indicated on ABI and UVW signals with a comprehensive user-configurable resolution from 1CPR and up to 10,000CPR of ABI signals, and pole pairs from 1 to 32 pole pairs (from 2 to 64 poles) for UVW commutation signals.
This Click board™ can operate with both 3.3V and 5V logic voltage levels selected via the VCC SEL jumper. This way, it is allowed for both 3.3V and 5V capable MCUs to use the communication lines properly. However, the Click board™ comes equipped with a library containing easy-to-use functions and an example code that can be used, as a reference, for further development.
Specifications
Type
Magnetic
Applications
Can be used as a versatile solution capable of supporting a broad range of applications with its robust architecture to measure and deliver absolute and incremental signals
On-board modules
AEAT-9922 – an angular magnetic rotary sensor manufactured with a CMOS standard process providing accurate angular measurement over a full 360 degrees of rotation from Broadcom Limited
Key Features
Programmable angular magnetic encoder, selectable angular resolution, flexible incremental ABI resolution, user-programmable zero position, direction, index width and index position, SPI interface, and more
Interface
SPI
Feature
No ClickID
Compatibility
mikroBUS™
Click board size
M (42.9 x 25.4 mm)
Input Voltage
3.3V or 5V
Pinout diagram
This table shows how the pinout on Magnetic Rotary 2 Click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).
Onboard settings and indicators
Label | Name | Default | Description |
---|---|---|---|
LD1 | PWR | – | Power LED Indicator |
JP1 | VCC SEL | Left | Logic Level Voltage Selection 3V3/5V: Left position 3V3, Right position 5V |
JP2 | MSEL | Left | Mode Selection 1/0: Left position 1, Right position 0 |
J1 | ABI | Unpopulated | Incremental Outputs Header |
Magnetic Rotary 2 Click electrical specifications
Description | Min | Typ | Max | Unit |
---|---|---|---|---|
Supply Voltage | 3.3 | – | 5 | V |
Magnet Rotation Angle Range | 0 | – | 360 | deg |
Absolute Resolution | 10 | – | 18 | bits |
Incremental Output Resolution (ABI) | 1 | – | 10.000 | CPR |
Operating Temperature Range | -40 | +25 | +125 | °C |
Software Support
We provide a library for the Magnetic Rotary 2 Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.
Package can be downloaded/installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.
Library Description
This library contains API for Magnetic Rotary 2 Click driver.
Key functions
-
magneticrotary2_write_register
This function writes a data byte to the selected register by using SPI serial interface. -
magneticrotary2_read_register
This function reads a data byte from the selected register by using SPI serial interface. -
magneticrotary2_get_angle
This function reads the absolute position raw data and converts it to degrees (Angle).
Example Description
This example demonstrates the use of Magnetic Rotary 2 click board by reading and displaying the magnet’s angular position in degrees.
void application_task ( void )
{
float angle = 0;
if ( MAGNETICROTARY2_OK == magneticrotary2_get_angle ( &magneticrotary2, &angle ) )
{
log_printf( &logger, " Angle: %.2f degreesrnn", angle );
Delay_ms ( 100 );
}
}
The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.
Other Mikroe Libraries used in the example:
- MikroSDK.Board
- MikroSDK.Log
- Click.MagneticRotary2
Additional notes and informations
Depending on the development board you are using, you may need USB UART click, USB UART 2 Click or RS232 Click to connect to your PC, for development systems with no UART to USB interface available on the board. UART terminal is available in all MikroElektronika compilers.
mikroSDK
This Click board™ is supported with mikroSDK – MikroElektronika Software Development Kit. To ensure proper operation of mikroSDK compliant Click board™ demo applications, mikroSDK should be downloaded from the LibStock and installed for the compiler you are using.
For more information about mikroSDK, visit the official page.