The sensor consumes a very low amount of current, featuring an additional low power mode, which allows even lower power consumption, which with its low count of pins, makes this sensor a perfect choice for various IoT applications. The internal Hall sensors are matched, making the Click board™ perfectly suited for development of various gaming applications (joystick), general control applications such as contactless knobs and potentiometers, or some other type of human interface device (HID) based on an accurate angle sensing.
How does it work?
3D Hall 2 click carries the TLV493D-A1B6, a low power 3D magnetic sensor, from Infineon. This sensor relies on a Hall effect to accurately sense magnetic field changes on three perpendicular axes. The internal sensing elements are spinning Hall sensor plates, connected to a 12bit low noise Analog to Digital Converter (ADC), which sequentially samples each sensor, providing 12-bit spatial data over the I2C interface. An additional 8-bit thermal sensor is also available, and it is used for the thermal compensation.
The magnetic sensor has very low pin count (only 6), packed in a SOP6 casing. Therefore, the I2C interface is used for the reset too, while the interrupt pin is multiplexed with the I2C clock line. The interrupt is a useful feature which is used to signal a data ready event to the host microcontroller. For more robust data transfer, the device also contains a frame counter, which increases after each sensor sampling cycle. If the cycle was stopped for whatever reason, the frame counter will indicate this problem, and the application is able to take the necessary steps. Parity Error Check mechanism is also implemented for even more data transfer robustness.
Sensor provides raw data output, based on a strength of the magnetic field. The measurement is affected by many factors: slight manufacturing differences between ICs affect the readings, even the slight differences between Hall plates within the same IC might affect the accuracy, although the IC contains highly matched sensing elements. Also, the altitude might affect the readings, as well as temperature changes. Therefore, the sensor IC is equipped with the thermal sensor, used to measure influence of the ambient temperature. Unlike errors which occur as the result due to influence of other elements, the thermal influence is not linear and therefore, the host firmware should utilize a Look-up Table (LUT) for several thermal values, in order to achieve linear response. The thermal sensor allows reducing the error margin of the angle measurement from ±2° to ±3° by using such LUT table compensation. The datasheet contains the whole calibrating procedure, as well as the angle calculation based on raw sensor data, as well as formulas for conversion the thermal and the magnetic data.
There are two configuration registers, used to set the working parameters. The interrupt functionality, thermal sensor availability, the power mode, I2C interface speed, data parity test, and other working parameters are contained within two configuration registers, referred to as MOD1 and MOD2 in the datasheet. The I2C address of the device can be changed by overwriting corresponding I2C address bits in these two registers. The I2C slave address is additionally determined at the startup, by sampling the state of the SDA (I2C Serial Data) pin within first 200 µs, after which the address remains fixed until the next reset cycle. I2C pins (SCL and SDA) are routed to the mikroBUS™ of the Click board™ for an easy interfacing with the development system.
The Click board™ can operate with 3.3V MCUs only, and it is already equipped with the pull-up resistors. It is ready to be used as soon as it is inserted into a mikroBUS™ socket of the development system. The Click board™ comes supported by the library with the simple and easy to use functions, compatible with all the MikroElektronika compilers.
Specifications
Type |
Hall effect,Magnetic |
Applications |
It is perfectly suited for development of various gaming applications (joystick), general control applications such as contactless knobs and potentiometers, or some other type of human interface device (HID) based on an accurate angle sensing. |
On-board modules |
TLV493D-A1B6, a low power 3D magnetic sensor, from Infineon |
Key Features |
Three independent Hall sensor allow high accuracy, additional thermal sensor for compensation, small package case allows very compact desing, still offering a lot of features, low count of external components required |
Interface |
I2C |
Input Voltage |
3.3V |
Compatibility |
mikroBUS |
Click board size |
S (28.6 x 25.4 mm) |
Pinout diagram
This table shows how the pinout on 3D Hall 2 click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).
Notes | Pin | | Pin | Notes |
---|
|
NC |
1 |
AN |
PWM |
16 |
NC |
|
|
NC |
2 |
RST |
INT |
15 |
NC |
|
|
NC |
3 |
CS |
RX |
14 |
NC |
|
|
NC |
4 |
SCK |
TX |
13 |
NC |
|
|
NC |
5 |
MISO |
SCL |
12 |
SCL |
I2C Clock/INT |
|
NC |
6 |
MOSI |
SDA |
11 |
SDA |
I2C Data/ADDR |
Power supply |
3.3V |
7 |
3.3V |
5V |
10 |
NC |
|
Ground |
GND |
8 |
GND |
GND |
9 |
GND |
Ground |
Onboard jumpers and settings
Designator | Label | Default Position | Description |
---|
LD1 |
PWR |
- |
Power LED indicator |
Software support
We provide a library for the 3D Hall 2 click on our LibStock page, as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.
Library Description
The library initializes and defines the I2C bus driver and drivers that offer a choice for writing data in register and reads data from register. The library includes function for read hall X/Y/Z axis data, and temperature data.
Key functions:
void c3dhall2_getAxisTempData(float *axisData, float *tempData)
- Functions for gets Hall axis data and Temperature data
void c3dhall2_configuration(uint8_t settings1, uint8_t settings2)
- Functions for settings chip for measurement
Example description
The application is composed of three sections :
- System Initialization - Initializes I2C module
- Application Initialization - Initialization driver init and configuration chip
- Application Task - (code snippet) - Reads X/Y/Z hall axis and Temperature data. All data logs on the USBUART every 3 sec.
void applicationTask()
{
c3dhall2_getAxisTempData(&XYZ_Axis[0], &Temperature);
mikrobus_logWrite("Axis X: ", _LOG_TEXT);
FloatToStr(XYZ_Axis[0],demoText);
mikrobus_logWrite(demoText, _LOG_TEXT);
mikrobus_logWrite(" mT", _LOG_LINE);
mikrobus_logWrite("Axis Y: ", _LOG_TEXT);
FloatToStr(XYZ_Axis[1],demoText);
mikrobus_logWrite(demoText, _LOG_TEXT);
mikrobus_logWrite(" mT", _LOG_LINE);
mikrobus_logWrite("Axis Z: ", _LOG_TEXT);
FloatToStr(XYZ_Axis[2],demoText);
mikrobus_logWrite(demoText, _LOG_TEXT);
mikrobus_logWrite(" mT", _LOG_LINE);
mikrobus_logWrite("Temperature :", _LOG_TEXT);
FloatToStr(Temperature,demoText);
mikrobus_logWrite(demoText, _LOG_TEXT);
mikrobus_logWrite(" C", _LOG_LINE);
mikrobus_logWrite(" ", _LOG_LINE);
Delay_ms(3000);
}
The full application code, and ready to use projects can be found on our LibStock page.
Other mikroE Libraries used in the example:
Additional notes and information
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.