How does it work?
Magneto 12 Click as its foundation uses the A31315, a magnetic position sensor from Allegro Microsystems. This sensor integrates vertical and planar Hall-effect elements with precision temperature-compensating circuitry to detect two out of three magnetic field components (X and Y). Using configurable signal processing, linearization, and angle calculation allows the A31315 to accurately resolve the absolute rotary (full 360° and short-stroke <360°) or linear position of a moving magnetic target.
The A31315 features a ratiometric analog interface to output the angle between the two factory-selected axes (X and Y). When using the analog mode of the A31315, the capacitance is provided for the stability of the output. A load resistor R4 also provides a known diagnostic state in a line break or device tri-state event. A series resistor R5 can be placed (default resistor value is 0Ω) before the capacitance C2 to create a low-pass filter for additional filtering and lower noise. However, caution should be taken, as this could also reduce the operating output voltage based on the ratio of the filter resistor and the load resistance.
This Click board™ possesses two ways to communicate with the MCU. The analog output signal of the A31315 can be converted to a digital value using MCP3221, a successive approximation A/D converter with a 12-bit resolution from Microchip using a 2-wire I2C compatible interface, or can be sent directly to an analog pin of the mikroBUS™ socket labeled as AN. The MCP3221 provides one single-ended input with low power consumption, a low maximum conversion current, and a Standby current of 250μA and 1μA, respectively. Data can be transferred at rates of up to 100kbit/s in the Standard and 400kbit/s in the Fast Mode. Selection can be performed by onboard SMD jumper labeled as ADC SEL, setting it to an appropriate position marked as AN and ADC.
This Click board™ can be operated only with a 5V logic voltage level. The board must perform appropriate logic voltage level conversion before using MCUs with different logic levels. However, the Click board™ comes equipped with a library containing functions and an example code that can be used, as a reference, for further development.
Specifications
Type
Magnetic
Applications
Can be used for position sensing applications in automotive, industrial, and consumer applications
On-board modules
A31315 – magnetic position sensor from Allegro Microsystems
Key Features
Highly accurate 360° and short stroke (360°) rotary applications, detects two out of three magnetic field components, ratiometric analog output, high reliability, possibility of signal processing in analog and digital form, and more
Interface
Analog,I2C
Feature
No ClickID
Compatibility
mikroBUS™
Click board size
S (28.6 x 25.4 mm)
Input Voltage
5V
Pinout diagram
This table shows how the pinout on Magneto 12 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 | ADC SEL | Right | Output Voltage A/D Selection AN/ADC: Left position AN, Right position ADC |
Magneto 12 Click electrical specifications
Description | Min | Typ | Max | Unit |
---|---|---|---|---|
Supply Voltage | – | 5 | – | V |
Maximum Magnetic Flux Density | – | – | 1000 | G |
Rotation Angle Range | 0 | – | 360 | deg |
Resolution | – | 12 | – | bit |
Operating Temperature Range | -40 | +25 | +120 | °C |
Software Support
We provide a library for the Magneto 12 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 Magneto 12 Click driver.
Key functions
-
magneto12_read_voltage
This function reads raw ADC value and converts it to proportional voltage level. -
magneto12_set_vref
This function sets the voltage reference for Magneto 12 click driver. -
magneto12_read_angle
This function reads the sensor output voltage and converts it to angular position in degrees.
Example Description
This example demonstrates the use of Magneto 12 Click board™ by reading and displaying the magnet’s angular position in degrees.
void application_task ( void )
{
float angle = 0;
if ( MAGNETO12_OK == magneto12_read_angle ( &magneto12, &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.Magneto12
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.