Experience the future of direction-finding with our electronic compass technology. It offers precision and responsiveness, making it an essential tool for applications based on position detection, navigation, and orientation.
A
A
Hardware Overview
How does it work?
Compass 2 Click is based on the AK8963, a 3-axis electronic compass from AKM Semiconductor. This electronic compass includes an A/D converter for magnetometer data output in two selectable resolutions. The sensitivity for 14-bit resolution is typically 0.6μT/LSB, while for 16-bit, it is typically 0.15μT/LSB. Some other functions built into this electronic compass are a power-on reset circuit, a data-ready indicator, a magnetic sensor overflow monitor function, a self-test function for a built-in internal magnetic source, and very low power consumption. The AK8963 has several operating modes. All internal circuits are turned off in Power-down mode while all registers are accessible (fuse ROM data cannot be read correctly). In Signal measurement mode, the sensor is measured, and data is processed. The Continuous measurement
mode differs from the Single measurement because the sensor is measured periodically at 8Hz or 100Hz, after which the data is processed. The third measurement mode is an External trigger measurement that will start after the AK8963 gets a trigger input. To check if the sensor is working normally, AK8963 uses the Self-test mode. This test the AK8963 achieves by generating a magnetic field by its internal magnetic source, and then the sensor is measured. The last is the Fuse ROM access mode, which reads Fuse ROM data (sensitivity adjustment data for each axis). This Click board™ allows the use of both I2C and SPI interfaces. Selection is made by positioning SMD jumpers marked SPI I2C to the appropriate position. All jumpers must be on the same side, or the Click
board™ may become unresponsive. When the I2C interface is selected, the AK8963 allows the choice of its I2C address, using the ADDR SEL SMD jumper set to an appropriate position marked 1 or 0. In addition to the general reset function (RST pin), there is also the INT pin used as an interrupt signal to tell the host MCU about the status of the AK8963, and the TRG pin which serves as a trigger pin to make the AK8963 to enter the External Trigger measurement mode. 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
PIC18F57Q43 Curiosity Nano evaluation kit is a cutting-edge hardware platform designed to evaluate microcontrollers within the PIC18-Q43 family. Central to its design is the inclusion of the powerful PIC18F57Q43 microcontroller (MCU), offering advanced functionalities and robust performance. Key features of this evaluation kit include a yellow user LED and a responsive
mechanical user switch, providing seamless interaction and testing. The provision for a 32.768kHz crystal footprint ensures precision timing capabilities. With an onboard debugger boasting a green power and status LED, programming and debugging become intuitive and efficient. Further enhancing its utility is the Virtual serial port (CDC) and a debug GPIO channel (DGI
GPIO), offering extensive connectivity options. Powered via USB, this kit boasts an adjustable target voltage feature facilitated by the MIC5353 LDO regulator, ensuring stable operation with an output voltage ranging from 1.8V to 5.1V, with a maximum output current of 500mA, subject to ambient temperature and voltage constraints.
Microcontroller Overview
MCU Card / MCU
Architecture
PIC
MCU Memory (KB)
128
Silicon Vendor
Microchip
Pin count
48
RAM (Bytes)
8196
You complete me!
Accessories
Curiosity Nano Base for Click boards is a versatile hardware extension platform created to streamline the integration between Curiosity Nano kits and extension boards, tailored explicitly for the mikroBUS™-standardized Click boards and Xplained Pro extension boards. This innovative base board (shield) offers seamless connectivity and expansion possibilities, simplifying experimentation and development. Key features include USB power compatibility from the Curiosity Nano kit, alongside an alternative external power input option for enhanced flexibility. The onboard Li-Ion/LiPo charger and management circuit ensure smooth operation for battery-powered applications, simplifying usage and management. Moreover, the base incorporates a fixed 3.3V PSU dedicated to target and mikroBUS™ power rails, alongside a fixed 5.0V boost converter catering to 5V power rails of mikroBUS™ sockets, providing stable power delivery for various connected devices.
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Click board™ Schematic
Step by step
Project assembly
Track your results in real time
Application Output
This Click board can be interfaced and monitored in two ways:
Application Output
- Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
UART Terminal
- Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.
Software Support
Library Description
This library contains API for Compass 2 Click driver.
Key functions:
compass2_get_axis_data
- This function gets the data from one specified axiscompass2_new_measurement
- This function prepares the device for a new measurementcompass2_reset
- This function does a hardware reset of the device.
Open Source
Code example
The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.
/*!
* \file
* \brief Comass2 Click example
*
* # Description
* The example prepares the device for a new measurement and reads and displays data from all three axes.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes and configures the click and logger modules.
*
* ## Application Task
* Reads and displays data from all three axes every two seconds.
*
* \author MikroE Team
*
*/
// ------------------------------------------------------------------- INCLUDES
#include "board.h"
#include "log.h"
#include "compass2.h"
// ------------------------------------------------------------------ VARIABLES
static compass2_t compass2;
static log_t logger;
// ------------------------------------------------------ APPLICATION FUNCTIONS
void application_init ( )
{
log_cfg_t log_cfg;
compass2_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.
compass2_cfg_setup( &cfg );
COMPASS2_MAP_MIKROBUS( cfg, MIKROBUS_1 );
compass2_init( &compass2, &cfg );
compass2_reset( &compass2 );
Delay_ms( 100 );
compass2_default_cfg( &compass2 );
Delay_ms( 100 );
}
void application_task ( )
{
int16_t x_axis;
int16_t y_axis;
int16_t z_axis;
compass2_new_measurement( &compass2 );
log_printf( &logger, " --- Axis ---\r\n" );
x_axis = compass2_get_axis_data( &compass2, COMPASS2_X_AXIS );
y_axis = compass2_get_axis_data( &compass2, COMPASS2_Y_AXIS );
z_axis = compass2_get_axis_data( &compass2, COMPASS2_Z_AXIS );
log_printf( &logger, "X: %d\r\n", x_axis );
log_printf( &logger, "Y: %d\r\n", y_axis );
log_printf( &logger, "Z: %d\r\n", z_axis );
log_printf( &logger, "----------------\r\n" );
Delay_ms( 2000 );
}
void main ( )
{
application_init( );
for ( ; ; )
{
application_task( );
}
}
// ------------------------------------------------------------------------ END
Additional Support
Resources
Category:Magnetic