/dm-nmh1000-magnetic-switch-example

This demo describes how to configure NMH1000 magnetic switch sensor to enable magnetic wakeup usecase. Such usecase can find many applications where user would like to completely shut off power supply or put the device in power down mode based on magnetic field applied. Eg include, smart meters, shelf labels, reed switch replacement, smart home etc

Primary LanguageCOtherNOASSERTION

NXP Application Code Hub

Magnetic Wake-up Example using NMH1000 Magnetic Switch Sensor

  • This example demo describes how to configure NMH1000 magnetic switch sensor to enable magnetic wake-up use-case. Such use-case can find many applications where user would like to completely shut off power supply or put the device in power down mode etc. based on magnetic field applied. Examples include, smart meters, shelf labels, reed switch replacement, smart home etc.

  • Please refer to NMH1000 Magnetic Switch Sensor Datasheet for more information.
    https://www.nxp.com/docs/en/data-sheet/NMH1000.pdf

  • NMH1000 is an ultra-low power monolithic Hall effect magnetic field sensor that provides a small footprint in low-current and low-operating-voltage, I2C mode or standalone mode.

  • This magnetic switch sensor triggers an output when surrounding magnetic field is greater than the user-defined detection threshold.

  • It can find lots of applications requiring change in magnetic field strength to wake-up and raise interrupt to wake-up host MCU/System.

  • The image below shows NMH1000 magnetic switch sensor block diagram.

  • Boards: FRDM-MCXN947, FRDM-MCXA153

  • Accessories: nxp_frdm_stbi_nmh1000, mikroe_hall_switch_3_click

  • Categories: Low Power, Sensor

  • Peripherals: I2C, UART

  • Toolchains: MCUXpresso IDE

Table of Contents

  1. Software
  2. Hardware
  3. Setup
  4. Results
  5. Support

1. Software

2. Hardware

3. Setup

3.1 Step 1: Download and Install required Software(s)

  • Install MCUXpresso IDE 2.19.0
  • Download and Install MCXUpresso SDK 2.13.1 for MCX-N9XX-EVK
  • Download and Install MCXUpresso SDK 2.14.2 for FRDM-MCXA153
  • Install Git v2.39.0 (for cloning and running west commands)
  • RealTerm (for checking examples output)

3.2 Step 2: Clone the APP-CODE-HUB/dm-nmh1000-magnetic-switch-example

  • Clone this repository to get the example projects:
  • Change directory to cloned project folder:
    cd dm-nmh1000-magnetic-switch-example

3.3 Step 3: Build example projects

  • Open MCUXpresso IDE and select a directory to create your workspace.
  • Install MCXUpresso SDK 2.13.1 for MCX-N9XX-EVK (drag and drop SDK zip into "Installed SDK" view) into MCUXpresso IDE.
  • Install MCXUpresso SDK 2.14.2 for FRDM-MCXA153 (drag and drop SDK zip into "Installed SDK" view) into MCUXpresso IDE.
  • Go to "Quickstart Panel" and click on "Import Project(s) from file system",
  • Select "Project directory (unpacked)" and browse to the cloned project folder.
  • Select example projects that you want to open and run.
  • Right click on project and select build to start building the project.

3.4 Step 4: Run example projects

  • Connect the chosen example project HWs: FRDM-MCXN947 with FRDMSTBI-NMH1000 or Hall Switch 3 click board FRDM-MCXA153 with Hall Switch 3 click board
  • Right click on project for chosen MCU and expansion board and select "Debug As".
  • Select MCUXpresso IDE LinkServer (inc. CMSIS DAP) probes.
  • Connect a USB cable between the host PC and the MCU-Link USB port on the target board.
  • Open a serial terminal (RealTerm) with the following settings:
    • 115200 baud rate
    • 8 data bits
    • No parity
    • One stop bit
    • No flow control
  • Download the program to the target board.
  • Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

4. Results

  • Show the on the board up to detect motion event. Refer to example project doc/readme.txt for more details.

  • When the demo runs successfully, you can see the Samples printed to the terminal.

    ISSDK NMH1000 Magnetic Switch Sensor Example !
    Successfully Initialized NMH1000 Sensor
    Successfully Applied Sensor Configuration for Mage Wakeup
    Waiting for Magnetic Field to Change

  • Change in magnetic field (place a magnet) near NMH1000, you can see that sensor detect change in magnetic fie

    Mag Threshold (50) Crossed: Mag Out = 180
    Mag Wake Up Detected

    Mag Threshold (50) Crossed: Mag Out = 152
    Mag Wake Up Detected

5. Support

Project Metadata

Board badge Board badge

Category badge Category badge

Peripheral badge Peripheral badge Peripheral badge

Toolchain badge

Questions regarding the content/correctness of this example can be entered as Issues within this GitHub repository.

Warning: For more general technical questions regarding NXP Microcontrollers and the difference in expected funcionality, enter your questions on the NXP Community Forum

Follow us on Youtube Follow us on LinkedIn Follow us on Facebook Follow us on Twitter

7. Release Notes

Version Description / Update Date
1.0 Initial release on Application Code Hub January 17th 2024