How does it work?
MR Angle Click as its foundation uses the KMZ60, a high precision sensor for magnetic angle measurement from NXP Semiconductors. The integrated MR sensor element, a sensitive magnetic field sensor, employs the MR effect of thin-film permalloy. The sensor contains two parallel supplied Wheatstone bridges, which enclose a sensitive angle of 45 degrees. A rotating magnetic field in the surface parallel to the chip (x-y plane) will deliver two independent sinusoidal output signals, one following a cosine and the second following a sine function. It also comes with a Power-Down mode to enable or disable the device and a possibility for the temperature coefficient of the sensor amplitude to be compensated.
MR Angle Click communicates with MCU through the SPI serial interface using the MCP3204, a 12-bit 4-channel A/D converter from Microchip. The output sine and cosine signals from the KMZ60 are wired as pseudo-differential input signals to the MCP3204. The MCP3204 samples both channels of the sensor simultaneously using an SPI interface, allowing access to both channels on one data line. Besides, it possesses additional functionality routed on two GPIO pins, such as Power-Down mode and temperature compensation.
The KMZ60 can be used as specified with temperature compensation of the MR sensor signal. Pin TCE is used to enable the temperature compensation, routed on the RST pin of the mikroBUS™ socket (connected to the ground if no temperature compensation is required). The output signal amplitude will decrease with increasing temperature related to the temperature compensation of the MR sensor. The Power-Down feature labeled as PDN and routed on the PWM pin of the mikroBUS™ socket switches the device into Power-Down mode and sets the sine and cosine outputs in a high impedance state to avoid current consumption.
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 properly use the SPI communication lines. 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 for rotor position detection for BLDC motors and Electronic Power Steering (EPS) applications, steering angle measurement, window wiper position detection, and general contactless angular measurement (e.g., throttle valves or actuators).
On-board modules
KMZ60 – high precision sensor for magnetic angle measurement from NXP Semiconductors
Key Features
High precision sensor for magnetic angle measurement, temperature compensated output signal amplitude, Power-Down mode to enable or disable the device, integrated instrumentation amplifier, fully automotive qualified, 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 MR Angle 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 |
MR Angle Click electrical specifications
Description | Min | Typ | Max | Unit |
---|---|---|---|---|
Supply Voltage | 3.3 | – | 5 | V |
Rotation Angle | 0 | – | 360 | deg |
Resolution | – | 12 | – | bits |
Operating Temperature Range | -40 | +25 | +85 | °C |
Software Support
We provide a library for the MR Angle 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 MR Angle Click driver.
Key functions:
mrangle_cfg_setup
– Config Object Initialization function.mrangle_init
– Initialization function.mrangle_default_cfg
– Click Default Configuration function.
Examples description
This library contains API for the MR Angle Click driver. This demo application shows an example of angle measurement.
The demo application is composed of two sections :
void application_init ( void ) { log_cfg_t log_cfg; /**< Logger config object. */ mrangle_cfg_t mrangle_cfg; /**< Click config object. */ // Logger initialization. LOG_MAP_USB_UART( log_cfg ); log_cfg.level = LOG_LEVEL_DEBUG; log_cfg.baud = 115200; log_init( &logger, &log_cfg ); log_printf( &logger, "rn" ); log_info( &logger, " Application Init " ); // Click initialization. mrangle_cfg_setup( &mrangle_cfg ); MRANGLE_MAP_MIKROBUS( mrangle_cfg, MIKROBUS_1 ); err_t init_flag = mrangle_init( &mrangle, &mrangle_cfg ); if ( init_flag == SPI_MASTER_ERROR ) { log_error( &logger, " Application Init Error. " ); log_info( &logger, " Please, run program again... " ); for ( ; ; ); } mrangle_default_cfg ( &mrangle ); log_info( &logger, " Application Task " ); log_printf( &logger, "-------------------------rn" ); Delay_ms( 1000 ); }
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.MrAngle
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. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.
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.