Accurately detect movement and orientation of magnetic object in all three spatial dimensions, enabling precise position tracking in various applications
A
A
Hardware Overview
How does it work?
3D Hall 14 Click is based on the MLX90394, a high-precision 3-axis magnetometer from Melexis, which uses the Triaxis® Hall technology to deliver exceptional performance and enhance position sensing in various applications. The MLX90394 is made for micropower applications, making it an excellent choice for battery-powered solutions. It accurately measures magnetic fields along three axes (X, Y, and Z) and converts these measurements and IC temperature into 16-bit words. These data points are then communicated through an I2C interface. The sensor offers flexibility in operation, allowing for measurements to be taken either on demand or continuously, with user-selectable refresh rates. Despite its compact size, the MLX90394 excels in noise performance and maintains low power consumption across various configurations. One of the standout features of the MLX90394 is its intelligent wake-up modes, which enable the entire system to enter a deep sleep state until a magnetic field change is
detected. This detection can be based on different criteria: a change from an initial measurement (Static Delta), a change from the previous measurement (Dynamic Delta), or surpassing a predefined threshold (Absolute). This functionality ensures efficient power management by toggling the device between active and sleep modes, capturing both busy and slowly changing magnetic fields effectively. As mentioned, the 3D Hall 14 Click is ideal for various applications. It can be used in battery-powered tools, household appliances (white goods), industrial machinery, smart home devices, home security systems, and many other contexts where precise and reliable position sensing is crucial. This Click board™ is designed in a unique format supporting the newly introduced MIKROE feature called "Click Snap." Unlike the standardized version of Click boards, this feature allows the main sensor area to become movable by breaking the PCB, opening up many new possibilities for implementation. Thanks to the
Snap feature, the MLX9039 can operate autonomously by accessing its signals directly on the pins marked 1-8. Additionally, the Snap part includes a specified and fixed screw hole position, enabling users to secure the Snap board in their desired location. 3D Hall 14 Click uses a standard 2-Wire I2C interface to communicate with the host MCU with fast-mode support and frequencies up to 1MHz. In addition to I2C pins, this Click board™ also has the interrupt signal on the INT pin of the mikroBUS™ socket to provide a notification that violates programmed thresholds. This interrupt can serve as a wake-up on change (WOC) interrupt output or a synchronization output. This Click board™ can be operated only with a 3.3V logic voltage level. The board must perform appropriate logic voltage level conversion before using MCUs with different logic levels. Also, it comes equipped with a library containing functions and an example code that can be used as a reference for further development.
Features overview
Development board
EasyPIC v8 is a development board specially designed for the needs of rapid development of embedded applications. It supports many high pin count 8-bit PIC microcontrollers from Microchip, regardless of their number of pins, and a broad set of unique functions, such as the first-ever embedded debugger/programmer. The development board is well organized and designed so that the end-user has all the necessary elements, such as switches, buttons, indicators, connectors, and others, in one place. Thanks to innovative manufacturing technology, EasyPIC v8 provides a fluid and immersive working experience, allowing access anywhere and under any
circumstances at any time. Each part of the EasyPIC v8 development board contains the components necessary for the most efficient operation of the same board. In addition to the advanced integrated CODEGRIP programmer/debugger module, which offers many valuable programming/debugging options and seamless integration with the Mikroe software environment, the board also includes a clean and regulated power supply module for the development board. It can use a wide range of external power sources, including a battery, an external 12V power supply, and a power source via the USB Type-C (USB-C) connector.
Communication options such as USB-UART, USB DEVICE, and CAN are also included, including the well-established mikroBUS™ standard, two display options (graphical and character-based LCD), and several different DIP sockets. These sockets cover a wide range of 8-bit PIC MCUs, from the smallest PIC MCU devices with only eight up to forty pins. EasyPIC v8 is an integral part of the Mikroe ecosystem for rapid development. Natively supported by Mikroe software tools, it covers many aspects of prototyping and development thanks to a considerable number of different Click boards™ (over a thousand boards), the number of which is growing every day.
Microcontroller Overview
MCU Card / MCU
Architecture
PIC
MCU Memory (KB)
64
Silicon Vendor
Microchip
Pin count
28
RAM (Bytes)
3728
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Schematic
Step by step
Project assembly
Track your results in real time
Application Output via UART Mode
1. Once the code example is loaded, pressing the "FLASH" button initiates the build process, and programs it on the created setup.
2. After the programming is completed, click on the Tools icon in the upper-right panel, and select the UART Terminal.
3. After opening the UART Terminal tab, first check the baud rate setting in the Options menu (default is 115200). If this parameter is correct, activate the terminal by clicking the "CONNECT" button.
4. Now terminal status changes from Disconnected to Connected in green, and the data is displayed in the Received data field.
Software Support
Library Description
This library contains API for 3D Hall 14 Click driver.
Key functions:
c3dhall14_get_magnetic_flux
- This function reads the raw values of X, Y, and Z axis and converts them to magnetic flux data in microTesla.c3dhall14_get_temperature
- This function reads the raw temperature value and converts it to Celsius.c3dhall14_set_range
- This function sets the magnetic flux measurement range.
Open Source
Code example
This example can be found in NECTO Studio. Feel free to download the code, or you can copy the code below.
/*!
* @file main.c
* @brief 3D Hall 14 Click example
*
* # Description
* This example demonstrates the use of 3D Hall 14 click board by reading
* the magnetic field strength from 3 axes and the sensor internal temperature.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes the driver and performs the click default configuration.
*
* ## Application Task
* Reads data from the sensor and displays them on the USB UART every 200ms.
*
* @author Stefan Filipovic
*
*/
#include "board.h"
#include "log.h"
#include "c3dhall14.h"
static c3dhall14_t c3dhall14;
static log_t logger;
void application_init ( void )
{
log_cfg_t log_cfg; /**< Logger config object. */
c3dhall14_cfg_t c3dhall14_cfg; /**< Click config object. */
/**
* Logger initialization.
* Default baud rate: 115200
* Default log level: LOG_LEVEL_DEBUG
* @note If USB_UART_RX and USB_UART_TX
* are defined as HAL_PIN_NC, you will
* need to define them manually for log to work.
* See @b LOG_MAP_USB_UART macro definition for detailed explanation.
*/
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
c3dhall14_cfg_setup( &c3dhall14_cfg );
C3DHALL14_MAP_MIKROBUS( c3dhall14_cfg, MIKROBUS_1 );
if ( I2C_MASTER_ERROR == c3dhall14_init( &c3dhall14, &c3dhall14_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( C3DHALL14_ERROR == c3dhall14_default_cfg ( &c3dhall14 ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
void application_task ( void )
{
float x_axis = 0;
float y_axis = 0;
float z_axis = 0;
float temperature = 0;
if ( C3DHALL14_OK == c3dhall14_get_magnetic_flux ( &c3dhall14, &x_axis, &y_axis, &z_axis ) )
{
log_printf( &logger, " X-axis: %.1f uT\r\n", x_axis );
log_printf( &logger, " Y-axis: %.1f uT\r\n", y_axis );
log_printf( &logger, " Z-axis: %.1f uT\r\n", z_axis );
}
if ( C3DHALL14_OK == c3dhall14_get_temperature ( &c3dhall14, &temperature ) )
{
log_printf( &logger, " Internal temperature: %.2f C\r\n\n", temperature );
}
}
int main ( void )
{
/* Do not remove this line or clock might not be set correctly. */
#ifdef PREINIT_SUPPORTED
preinit();
#endif
application_init( );
for ( ; ; )
{
application_task( );
}
return 0;
}
// ------------------------------------------------------------------------ END