Discover how these sensors can revolutionize navigation, robotics, and beyond, making your devices smarter and more efficient than ever before
A
A
Hardware Overview
How does it work?
3D Hall 7 Click is based on the AK09970N, a low power 3D magnetic sensor from AKM Semiconductor. This sensor relies on a Hall effect to accurately sense magnetic field changes on three perpendicular axes. The internal magnetic field sensing elements are multiplexed and connected to a pre-amplifier and then to a 16-bit low noise Analog to Digital Converter (ADC), which sequentially samples each sensor, providing 16-bit spatial data over the digital interface. The magnetic sensor has a very low pin count. Therefore, SPI and I2C lines are multiplexed on the same pins. In order to allow functionality for both SPI and I2C interfaces, 3D Hall 7 click have onboard jumpers for communication interface selection. Thus, the communication interface selection procedure relies on switching the appropriate SMD jumpers, named COMM SEL. Note that all of the I2C/SPI group jumpers need to be switched at the same side: all three should either be soldered as I2C or SPI. If one of them shows in the opposite position from the rest, the communication with the IC might not be possible. The power consumption is a big concern as of lately, with the introduction of the IoT. The ability to work in a low power mode is a must for every device which is to be used for any type of IoT
networking. The AK09970N magnetic sensor features power down mode, single measurement mode and seven continuous measurement modes, allowing the user to make a perfect balance between sampling frequency, measurement accuracy and power consumption. The power consumption is in a close relationship with the data output refresh rate (ODR). The AK09970N magnetic sensor also features a powerful programmable interrupt engine, which allows many event sources to be signaled via the two interrupt pins (INT and ODINT), which are routed from the sensor to the mikroBUS™ INT and AN pins respectively. A very useful function of the interrupt engine is the signaling of the data ready event. That way, the host MCU does not have to poll the sensor for the data acquisition. The sensor can simply trigger an interrupt when the data is ready for reading. The interrupt engine allows some other customizations of the interrupt signal, such as the magnetic sensor overflow, ADC overflow and Switch event. The 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 IC is equipped with the temperature independent reference voltage, thus minimizing the influence the mentioned unwanted factors. The power mode, output data rate, interrupt thresholds for each axis, and other working parameters, including the availability of the I2C interface, are contained within the configuration registers of the AK09970N magnetic sensor. The sensor is highly configurable, with many configuration options. The AK09970N datasheet contains an in-depth explanation of all the registers and their functionality. However, 3D Hall 7 software library contains simplified functions that allow straight-forward readings to be performed, reducing the steps needed for a proper initialization and configuration of the device. 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
UNI-DS v8 is a development board specially designed for the needs of rapid development of embedded applications. It supports a wide range of microcontrollers, such as different STM32, Kinetis, TIVA, CEC, MSP, PIC, dsPIC, PIC32, and AVR MCUs regardless of their number of pins, and a broad set of unique functions, such as the first-ever embedded debugger/programmer over WiFi. 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, UNI-DS v8 provides a fluid and immersive working experience, allowing access anywhere and under any
circumstances at any time. Each part of the UNI-DS v8 development board contains the components necessary for the most efficient operation of the same board. An advanced integrated CODEGRIP programmer/debugger module offers many valuable programming/debugging options, including support for JTAG, SWD, and SWO Trace (Single Wire Output)), and seamless integration with the Mikroe software environment. Besides, it 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
HOST/DEVICE, CAN (on the MCU card, if supported), and Ethernet is also included. In addition, it also has the well-established mikroBUS™ standard, a standardized socket for the MCU card (SiBRAIN standard), and two display options for the TFT board line of products and character-based LCD. UNI-DS 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
Type
8th Generation
Architecture
PIC
MCU Memory (KB)
96
Silicon Vendor
Microchip
Pin count
100
RAM (Bytes)
3808
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 7 Click driver.
Key functions:
c3dhall7_get_axis_data
- Get Axis data functionc3dhall7_get_status
- Measurement status functionc3dhall7_get_status
- Measurement status function.
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
* \brief 3dHall7 Click example
*
* # Description
* Read the position of magnetic
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes driver init, test communication and configuration device for measurement.
*
* ## Application Task
* Reads 3 Axis of the magnetic sensor and logs this data to USBUART every 500ms.
*
*
* \author MikroE Team
*
*/
// ------------------------------------------------------------------- INCLUDES
#include "board.h"
#include "log.h"
#include "c3dhall7.h"
// ------------------------------------------------------------------ VARIABLES
static c3dhall7_t c3dhall7;
static log_t logger;
// ------------------------------------------------------ APPLICATION FUNCTIONS
void application_init ( )
{
c3dhall7_dev_info_t info;
uint8_t red_data;
log_cfg_t log_cfg;
c3dhall7_cfg_t cfg;
/**
* 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.
c3dhall7_cfg_setup( &cfg );
C3DHALL7_MAP_MIKROBUS( cfg, MIKROBUS_1 );
c3dhall7_init( &c3dhall7, &cfg );
c3dhall7_device_reset( &c3dhall7 );
// Test communication
c3dhall7_device_info( &c3dhall7, &info );
if ( info.device_id == C3DHALL7_DEVICE_ID )
{
log_printf( &logger, "---- Communication [ OK ]!!! ----\r\n" );
}
else
{
log_printf( &logger, "---- Communication [ ERROR ]!!! ----\r\n" );
for ( ; ; );
}
// Configuration
c3dhall7_default_cfg ( &c3dhall7 );
}
void application_task ( void )
{
c3dhall7_axis_t axis;
c3dhall7_get_axis_data( &c3dhall7, &axis );
log_printf( &logger, "---- Measurement data of magnetic sensor ----\r\n" );
log_printf( &logger, "X axis: %d \r\n", axis.x );
log_printf( &logger, "Y axis: %d \r\n", axis.y );
log_printf( &logger, "Z axis: %d \r\n", axis.z );
log_printf( &logger, "---------------------------------------------\r\n");
Delay_ms( 500 );
}
void main ( void )
{
application_init( );
for ( ; ; )
{
application_task( );
}
}
// ------------------------------------------------------------------------ END