30 min

Decode the absolute position of any magnet using TMAG5273 and PIC18LF25K40

Contactless 3D sensing

3D Hall 11 Click with Curiosity HPC

Published Jan 23, 2024

Click board™

3D Hall 11 Click

Development board

Curiosity HPC


NECTO Studio



Collect information about the whole magnetic field for position determination in 3D environments



Hardware Overview

How does it work?

3D Hall 11 Click is based on the TMAG5273, a 3D linear Hall-effect sensor used to detect the strength of a magnetic field in all three dimensions (X, Y, and Z axes) in a range up to ±40mT or ±80mT from Texas Instruments. A precision analog signal chain and an integrated 12-bit ADC enable high accuracy and low drift magnetic field measurements while supporting a sampling of up to 20kSPS. It also has an integrated temperature sensor for multiple system functions, such as thermal budget check or temperature compensation calculation for a given magnetic field. The output signals (raw X, Y, and Z magnetic and temperature data) are accessible through

the I2C interface. This Click board™ can be configured to various power options, including Wake-Up and Sleep mode, optimizing system power consumption. Also, an integrated angle calculation engine (CORDIC) provides complete 360° angular position information for both on-axis and off-axis angle measurement topologies performed via two user-selected magnetic axes. It also features magnetic gain and offset correction to mitigate the impact of system mechanical error sources. 3D Hall 11 Click communicates with MCU using the standard I2C 2-Wire interface with a maximum clock frequency of 1MHz to enable any combination of magnetic axes and temperature measurements.

Besides a dedicated interrupt pin, the INT pin of the mikroBUS™ socket act as a system interrupt during low-power Wake-Up and Sleep mode and can also be used by an MCU to trigger a new sensor conversion. This Click board™ can operate with both 3.3V and 5V logic voltage levels selected via the VIO SEL jumper. This way, it is allowed for both 3.3V and 5V capable MCUs to use the communication lines properly. 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.

3D Hall 11 Click top side image
3D Hall 11 Click lateral side image
3D Hall 11 Click bottom side image

Features overview

Development board

Curiosity HPC, standing for Curiosity High Pin Count (HPC) development board, supports 28- and 40-pin 8-bit PIC MCUs specially designed by Microchip for the needs of rapid development of embedded applications. This board has two unique PDIP sockets, surrounded by dual-row expansion headers, allowing connectivity to all pins on the populated PIC MCUs. It also contains a powerful onboard PICkit™ (PKOB), eliminating the need for an external programming/debugging tool, two mikroBUS™ sockets for Click board™ connectivity, a USB connector, a set of indicator LEDs, push button switches and a variable potentiometer. All

these features allow you to combine the strength of Microchip and Mikroe and create custom electronic solutions more efficiently than ever. Each part of the Curiosity HPC development board contains the components necessary for the most efficient operation of the same board. An integrated onboard PICkit™ (PKOB) allows low-voltage programming and in-circuit debugging for all supported devices. When used with the MPLAB® X Integrated Development Environment (IDE, version 3.0 or higher) or MPLAB® Xpress IDE, in-circuit debugging allows users to run, modify, and troubleshoot their custom software and hardware

quickly without the need for additional debugging tools. Besides, it includes a clean and regulated power supply block for the development board via the USB Micro-B connector, alongside all communication methods that mikroBUS™ itself supports. Curiosity HPC development board allows you to create a new application in just a few steps. Natively supported by Microchip software tools, it covers many aspects of prototyping thanks to many number of different Click boards™ (over a thousand boards), the number of which is growing daily.

Curiosity HPC double image

Microcontroller Overview

MCU Card / MCU




MCU Memory (KB)


Silicon Vendor


Pin count


RAM (Bytes)


Used MCU Pins

mikroBUS™ mapper

Power Supply
I2C Clock
I2C Data
Power Supply

Take a closer look


3D Hall 11 Click Schematic schematic

Step by step

Project assembly

Curiosity HPC front no-mcu image hardware assembly

Start by selecting your development board and Click board™. Begin with the Curiosity HPC as your development board.

Curiosity HPC front no-mcu image hardware assembly
IR Sense 4 Click front image hardware assembly
MCU DIP 28 hardware assembly
Prog-cut hardware assembly
Curiosity HPC 28pin-DIP - upright/background hardware assembly
Necto image step 2 hardware assembly
Necto image step 3 hardware assembly
Necto image step 4 hardware assembly
Necto image step 5 hardware assembly
Necto image step 6 hardware assembly
Necto DIP image step 7 hardware assembly
Necto No Display image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Debug Image Necto Step hardware assembly

Track your results in real time

Application Output

After loading the code example, pressing the "DEBUG" button builds and programs it on the selected setup.

Application Output Step 1

After programming is completed, a header with buttons for various actions available in the IDE appears. By clicking the green "PLAY "button, we start reading the results achieved with Click board™.

Application Output Step 3

Upon completion of programming, the Application Output tab is automatically opened, where the achieved result can be read. In case of an inability to perform the Debug function, check if a proper connection between the MCU used by the setup and the CODEGRIP programmer has been established. A detailed explanation of the CODEGRIP-board connection can be found in the CODEGRIP User Manual. Please find it in the RESOURCES section.

Application Output Step 4

Software Support

Library Description

This library contains API for 3D Hall 11 Click driver.

Key functions:

  • c3dhall11_write_register This function writes a desired data to the selected register by using I2C serial interface.

  • c3dhall11_read_register This function reads data from the selected register.

  • c3dhall11_read_data This function reads new data which consists of X, Y, and Z axis values in mT, and temperature in Celsius. It also reads the angle in Degrees between X and Y by default, and magnitude data as well.

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 3DHall11 Click example
 * # Description
 * This example demonstrates the use of 3D Hall 11 click board by reading the magnetic
 * flux density from 3 axes, and the angle and magnitude between X and Y axes  
 * as well as 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 approximately every 100ms and displays the measurement values on the USB UART.
 * @author Stefan Filipovic

#include "board.h"
#include "log.h"
#include "c3dhall11.h"

static c3dhall11_t c3dhall11;
static log_t logger;

void application_init ( void ) 
    log_cfg_t log_cfg;  /**< Logger config object. */
    c3dhall11_cfg_t c3dhall11_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.
    c3dhall11_cfg_setup( &c3dhall11_cfg );
    C3DHALL11_MAP_MIKROBUS( c3dhall11_cfg, MIKROBUS_1 );
    if ( I2C_MASTER_ERROR == c3dhall11_init( &c3dhall11, &c3dhall11_cfg ) ) 
        log_error( &logger, " Communication init." );
        for ( ; ; );
    if ( C3DHALL11_ERROR == c3dhall11_default_cfg ( &c3dhall11 ) )
        log_error( &logger, " Default configuration." );
        for ( ; ; );
    log_info( &logger, " Application Task " );

void application_task ( void ) 
    c3dhall11_data_t sensor_data;
    if ( C3DHALL11_OK == c3dhall11_read_data ( &c3dhall11, &sensor_data ) )
        log_printf( &logger, " X-axis: %.1f mT\r\n", sensor_data.x_axis );
        log_printf( &logger, " Y-axis: %.1f mT\r\n", sensor_data.y_axis );
        log_printf( &logger, " Z-axis: %.1f mT\r\n", sensor_data.z_axis );
        log_printf( &logger, " Angle: %.1f Degrees\r\n", sensor_data.angle );
        log_printf( &logger, " Magnitude: %u\r\n", ( uint16_t ) sensor_data.magnitude );
        log_printf( &logger, " Temperature: %.2f Celsius\r\n\n", sensor_data.temperature );
        Delay_ms ( 100 );

void main ( void ) 
    application_init( );

    for ( ; ; ) 
        application_task( );

// ------------------------------------------------------------------------ END

Additional Support