Magneto 2 click
Magneto 2 click is a mikroBUS™ add-on board with Melexis's MLX90316 monolithic rotary
position sensor. Sensing flux density with the IC surface of the MLX90316 allows the click
to decode the absolute rotary (angular) position from 0 to 360 degrees.
In combination with the correct library, the magnetic flux density of a small magnet
(diametral magnetisation) rotating above the IC can be measured in a non-contacting way.
The sensor enables the design of novel generation of non-contacting rotary position
sensors that are frequently required for both automotive and industrial applications.
Magneto 2 click communicates with the target MCU through the mikroBUS™ SPI bus. The
board is designed to use a 5V power supply only.
Applications
Absolute Rotary Position Sensor, Pedal Position Sensor, Float-Level sensor, and
Throttle Position Sensor.
Key features
Triaxis® Hall Technology
Programmable Angular Range up to 360 Degrees
12 bit Angular Resolution
SPI interface
5V power supply
Key Benefits
CRC checks for even higher accuracy
Multiple filter settings for higher accuracy
Ready-to-use examples save development time
Supported in mikroC compiler
mikroBUS™ is specially designed pinout standard with SPI, I2C, Analog, UART, Interrupt, PWM, Reset and Power
supply pins. See Standard Specification.
Features and usage notes
Programmable Linear Transfer Characteristic
SPI interface
5V Power Supply
Tria⊗is® Hall Technology
40 bit ID number
Single Die ‐ SO8 or Dual Die (Full Redundant) ‐ TSSOP16, RoHS Compliant
Absolute Rotary Position Sensor IC
Changeable main frequency for DSP chip (7MHz or 20 MHz master clock)
Hysteresis Filter
FIR and IIR filters for higher output accuracy
Programming
This code initialises UART and SPI, reads data from the Magneto 2 click, and, if the readings are successful, prints
1 void main() {
2 char txt[20];
3 uint8_t check = 0;
4 float angle = 0.0;
5 UART1_Init_Advanced( 9600, _UART_8_BIT_DATA,
6
_UART_NOPARITY,
7
_UART_ONE_STOPBIT,
8
&_GPIO_MODULE_USART1_PA9_10 );
9 Delay_ms(300);
10
11 UART1_Write_Text("Uart initialized\r\n");
12
GPIO_Digital_Output( &GPIOD_BASE, _GPIO_PINMASK_13 ); // set CS pin as output
13
14
15
16
17
18
19
20
21
22
23
// Initialize SPI
SPI3_Init_Advanced(_SPI_FPCLK_DIV64, _SPI_MASTER | \
_SPI_8_BIT | _SPI_CLK_IDLE_LOW | \
_SPI_SECOND_CLK_EDGE_TRANSITION | \
_SPI_MSB_FIRST
|\
_SPI_SS_DISABLE
|\
_SPI_SSM_ENABLE
|\
_SPI_SSI_1, &_GPIO_MODULE_SPI3_PC10_11_12);
SPI_Set_Active(&SPI3_Read, &SPI3_Write);
// Sets the SPI1 module active
24
25
26 while (1)
27 {
28
check = read_mlx();
29
if ( check == 0)
// if read was successful, print success and angle
30
{
31
Uart1_Write_Text("Success \r\n");
32
angle = (float) mlx.angle;
33
angle /= 45.5;
34
floattostr(angle,txt);
35
Uart1_Write_Text(txt);
36
Uart1_Write_Text("\r\n");
37
}
38
else
// else print fail
39
Uart1_Write_Text("Fail \r\n");
40
41
Delay_ms(400);
// Wait 400ms
42 }
43 }
Code example that demonstrates the usage of Magneto 2 click with MikroElektronika hardware, written for
mikroC for ARM is available on Libstock.
MIKROE-1938
Magneto 2 click
Copyright © 1998 - 2016. MikroElektronika d.o.o.