-
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.
- IoT Sensing SDK (ISSDK) v1.8 offered as middleware in MCUXpresso SDK for supported platforms
- MCXUpresso SDK 2.14.0 for FRDM-MCXN947
- MCUXPresso SDK 2.14.2 for FRDM-MCXA153
- MCUXpresso IDE v11.9.0 or newer
- Git v2.39.0
- Teraterm (https://osdn.net/projects/ttssh2/releases/) or RealTerm (https://sourceforge.net/projects/realterm/)
- FRDM-MCXN947 MCU board OR
- FRDM-MCXA153 MCU board
- FRDMSTBI-NMH1000 sensor board (https://www.nxp.com/part/FRDMSTBI-NMH1000)
- Hall Switch 3 click board (https://www.mikroe.com/hall-switch-3-click)
- Personal Computer
- Mini/micro C USB cable
- Download and Install MCUXpresso IDE 2.19.0 or newer and Install following the installer instructions.
- Download and Install MCXUpresso SDK 2.14.0 for FRDM-MCXN947 OR
- Download and Install MCUXPresso SDK 2.14.2 for FRDM-MCXA153
- Install Git v2.39.0 (for cloning and running west commands)
- Download and Install RealTerm (for checking examples output)
- Clone this repository to get the example projects:
- Change directory to cloned project folder:
cd dm-nmh1000-magnetic-switch-example
- Open MCUXpresso IDE and select a directory to create your workspace.
- Install "MCXUpresso SDK 2.14.0 for FRDM-MCXN947" (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.
- 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.
-
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 DetectedMag Threshold (50) Crossed: Mag Out = 152
Mag Wake Up Detected
- Reach out to NXP Sensors Community page for more support - NXP Community
- Learn more about NMH1000 ultra-low power mangetic switch, refer to - NMH1000 DS
- Accelerate your sensors development using Sensor ToolBox, refer to - Sensors Development Ecosystem
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
Version | Description / Update | Date |
---|---|---|
1.0 | Initial release on Application Code Hub | January 17th 2024 |