How does it work?
Hall Switch 3 Click is based on the NMH1000, a Hall-effect magnetic switch from NXP Semiconductor. The switch processes its input over the functional blocks that consist of a configurable state machine, an analog-to-voltage conversion of the input, and a comparison to generate the bi-state output. The output is arranged in a linear succession. The NMH1000 has a transducer that generates a small charge proportional to the proximal magnetic flux density. The Hall-effect charge is converted to voltage and compared with the pre-defined threshold voltage. This determines the state of the switch’s output.
Hall Switch 3 Click uses a standard 2-wire I2C interface to communicate with the host MCU, supporting a clock frequency of up to 1MHz. The output of the switch, according to the pre-defined threshold, is available over the output OUT pin.
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.
Specifications
Type
Magnetic
Applications
Can be used for the development of electronic system wake-up, home automation systems (door or window open/close), contactless switches, lids or tray position detecting switches, proximity detection applications, and more
On-board modules
NMH1000 – a Hall-effect magnetic switch from NXP Semiconductor
Key Features
Selectable threshold, selectable sample rate, output indicates of absence of a magnetic field as compared to an internally set threshold, consists of a state machine, analog-to-voltage conversion, generation of a bi-state output, arranged in linear succession, and more
Interface
I2C
Feature
ClickID
Compatibility
mikroBUS™
Click board size
S (28.6 x 25.4 mm)
Input Voltage
3.3V
Pinout diagram
This table shows how the pinout on Hall Switch 3 Click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).
Onboard settings and indicators
Label | Name | Default | Description |
---|---|---|---|
LD1 | PWR | – | Power LED Indicator |
Hall Switch 3 Click electrical specifications
Description | Min | Typ | Max | Unit |
---|---|---|---|---|
Supply Voltage | – | 3.3 | – | V |
Magnetic Field Threshold | ±100 | – | ±230 | G |
Sensitivity | – | 1.75 | – | G/LSB |
Software Support
We provide a library for the Hall Switch 3 Click as well as a demo application (example), developed using MIKROE compilers. The demo can run on all the main MIKROE development boards.
Package can be downloaded/installed directly from NECTO Studio Package Manager(recommended), downloaded from our LibStock™ or found on Mikroe github account.
Library Description
This library contains API for Hall Switch 3 Click driver.
Key functions
-
hallswitch3_get_mag_data
This function is used to indicates a relative magnetic field strength. -
hallswitch3_set_out_data_rate
This function provides the capability for the user to override the fixed sample rate controlling the sleep-compare-Vout cycle time. -
hallswitch3_get_status
This function reads a status reporting of modes and selections.
Example Description
This example demonstrates the use of Hall Switch 3 Click board™ by reading and displaying the magnetic field strength value.
void application_task ( void )
{
int8_t mag_data = 0;
if ( HALLSWITCH3_OK == hallswitch3_get_mag_data( &hallswitch3, &mag_data ) )
{
log_printf( &logger, " Magnetic Field: %d [Gs]rn", ( int16_t ) mag_data );
if ( HALLSWITCH3_OUT_STATE_LOW == hallswitch3_check_mag_field( &hallswitch3 ) )
{
log_printf( &logger, " The switch is open.rn" );
}
}
Delay_ms( 1000 );
}
The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended), downloaded from our LibStock™ or found on Mikroe github account.
Other Mikroe Libraries used in the example:
- MikroSDK.Board
- MikroSDK.Log
- Click.HallSwitch3
Additional notes and informations
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. UART terminal is available in all MIKROE compilers.
mikroSDK
This Click board™ is supported with mikroSDK – MIKROE 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.