This example use FRDM-MCXW71 and on-board FXLS8974CF accelerometer as Tilt sensor with MPL3115 absolute pressure sensor using expansion board FRDMSTBC-P3115 to demonstrate connected smart sensing inhaler application.
- The demo showcases detection of tidal breathin pattern of patient to align dosage dispensation using high precision, digital pressure sensor MPL3115. This feature can be used to implement intelligent dosage trigger function.
- The demo also showcases detection of correct inhaler posture to deliver right amount dosage using 3-axis accelerometer FXLS8974CF as Tilt sensor.
- Connected smart inhaler inform on dosages inhaled over BLE wireless UARTallowing remote patient monitoring, helps with patient’s adherence to dosages and compliance.
NOTE: For this demonstration, a syringe with tubing is connected to MPL3115 pressure sensor on FRDMSTBC-P3115 board to simulate pressure change due to patient's inhalation. The pressure threshold is set appropriately and is configurable based on actual inhalation pressure dip pattern.
- Software
- Hardware
- Setup
3.1 Hardware Setup
3.2 Software Setup - Run Demos
4.1 Run Demo 1
4.2 Run Demo 2 - Support
- IoT Sensing SDK (ISSDK) v1.8 offered as middleware in MCUXpresso SDK for supported platforms
- MCUXpresso SDKv2.16.0 for FRDM-MCXW71 or newer
- MCUXpresso IDE v11.10.0
- FreeMaster Tool v3.2 or newer
- NXP IoT ToolBox App - Android Store or NXP IoT ToolBox App - Apple Store.
- FRDM-MCXW71/7x MCU board with on-board FXLS8974CF accelerometer
- FRDMSTBC-P3115 expansion board for MPL3115 absolute pressure sensor.
- 12mm pressure port and a pressure syringe.
- Personal Computer
- Mini/micro C USB cable
- Android or Apple Mobile Phone supprting BLE wireless connectivity.
- The FRDM-MCXW71 board comes with pre-flashed code in Narrow Band Unit (NBU) for the radio core.
- In case you need to reflash the NBU firmware, please follow instructions available at:
Flash NBU Firmware on FRDM-MCXW71
Check NBU Incompatible Versions
- Connect FRDM-MCXW71 to FRDM-STBC-P3115 shield board.
- Connect J7 and J8 pins 1-2 on FRDM-STBC-P3115 shield board.
- Make sure to glue a 12mm pressure port to the pressure sensor part (MPL3115 on FRDM-STBC-P3115 board).
- Connect a syringe to the pressure port to be able to apply pressure change.
- Connect a micro USB cable from connector MCU-LINK to a host computer.
- Android or Apple Mobile Phone to see demo output on NXP IoT ToolBox App.
The image below show the Hardware Setup:
- Download and Install MCUXpresso IDE v11.10.0
- Go to download section and select "Previous" tab.
- Search for MCUXpresso IDE v11.10.0 and download.
- Download and Install MCUXpresso SDKv2.16.0 for FRDM-MCXW71 or newer
- Download and Install FreeMaster Tool v3.2 or newer
- Download and Install NXP IoT ToolBox App - Android Store or NXP IoT ToolBox App - Apple Store
- Clone this repository to get the example projects:
- Change directory to cloned project folder:
cd dm-smart-sensing-inhaler
- Open MCUXpresso IDE and select a directory to create your workspace.
- Install MCXUpresso SDK 2.16.0 for FRDM-MCXW71 (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 project ("smart_sensing_inhaler_fmstr_project" or "smart_sensing_inhaler_ble_project") that you want to open and run.
- Right click on project and select build to start building the project.
- Connect a USB-C cable between the host PC and the MCU-Link USB port on the target FRDM-MCXW71 board.
- Choose the "smart_sensing_inhaler_fmstr_project" project.
- Right click on the project and select "Debug As". Select MCUXpresso IDE LinkServer (inc. CMSIS DAP) probes.
- Debugger will start downloading the program to device. MCU-LINK probes will be identified. Click “OK” to continue.
- Click on “Resume” button or press “F8” key on your keyboard to continue running the downloaded program on device.
- Click on “Terminate” button or press “CNTR + F2” to terminate the debug session.
- Disconnect the USB-C cable connected to FRDM-MCXW71 and reconnect. You will see RED LED on the FRDM-MCXW71.
- Wait till you see GREEN LED blinking on FRDM-MCXW71, that will confirm completion of MPL3115 calibration.
- Launch FreeMASTER application installed on your Windows PC.
- Click on "Connection Wizard" and select Next>.
- Select "Use direct connection to on board USB port" and click Next>.
- The FreeMASTER tool detects the COM port (Select the identified COM port on next screen) with the configured baud-rate automatically. Confirm the COM port and baud-rate, click "Next>".
- FreeMASTER detects the board connection and will ask to confirm the detected settings. Confirm by selecting "Yes" and click "Finish".
- FreeMASTER opens an option to "Open an Existing Project". Select the option.
- Browse to "<dm-smart-sensing-inhaler\smart_sensing_inhaler\freemaster_gui/ folder
- Select "Inhaler_FreeMASTER.pmpx" sensor demo project. Click "Open".
- FreeMASTER launches the smart sensing sensor demo.
- Pull the syringe to create change in pressure (similar to when inhalation will be done). The pressure sensor will detect dip in pressure.
- The inhaler will detect the tidal breathing inhalation based on change in pressure, and dosage#1 will be dispensed.
- Wait till you see GREEN LED blinking on FRDM-MCXW71 before pulling the syringe again.
- One you see GREEN LED blinking, try pulling syringe again and inhaler will show total meds inhaled and total remaining dosages to send refill reminder. The status can be seen on the "Inhaler View".
- While the GREEN LED is blinking, try changing the board up and down, the accelerometer will detect tilt and inform to correct the posture. This status can be seen on the "Inhaler View".
Click on "Inhaler View" to visualize the inhaler status.
- Connect a USB-C cable between the host PC and the MCU-Link USB port on the target FRDM-MCXW71 board.
- Choose the "smart_sensing_inhaler_ble_project" project.
- Right click on the project and select "Debug As". Select MCUXpresso IDE LinkServer (inc. CMSIS DAP) probes.
- Debugger will start downloading the program to device. MCU-LINK probes will be identified. Click “OK” to continue.
- Click on “Resume” button or press “F8” key on your keyboard to continue running the downloaded program on device.
- Click on “Terminate” button or press “CNTR + F2” to terminate the debug session.
- Disconnect the USB-C cable connected to FRDM-MCXW71 and reconnect.
- To enable your board to start its BLE advertising, press and release button SW3.
- Open the installed NXP IoT Toolbox (available from Play Store and App Store) on your mobile phone. Make sure bluetooth connection is ON.
- Inside the application, click on the Wireless UART widget. Scan should start automatically.
- When a device called NXP_WU appears, click on it. Your phone should now be connecting to the board.
- After connecting with the FRDM-MCXW71 device, the serial UART terminal will show this message:
- Pull the syringe to create change in pressure (similar to when inhalation will be done). The pressure sensor will detect dip in pressure.
- The inhaler will detect the tidal breathing inhalation based on change in pressure, and dosage will be dispensed.
- Wait till you see GREEN LED blinking on FRDM-MCXW71 before pulling the syringe again.
- One you see GREEN LED blinking, try pulling syringe again and inhaler will show total meds inhaled and total remaining dosages to send refill reminder.
- While the GREEN LED is blinking, try changing the board up and down, the accelerometer will detect tilt and inform to correct the posture. The inhaler posture orientation correction message can be seen on the wireless console application.
- Reach out to NXP Sensors Community page for more support - NXP Community
- For more details on FXLS8974CF SDCD block, refer to the application note - AN12004
- Learn more about FXLS8974CF 3-axis accelerometer, refer to - FXLS8974CF DS
- Learn more about FXPQ3115 absolute pressure sensor, refer to - FXPQ3115 DS
- Learn more about MPL3115 absolute pressure sensor, refer to - MPL3115 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 functionality, enter your questions on the NXP Community Forum
Version | Description / Update | Date |
---|---|---|
1.0 | Initial release on Application Code Hub | October 30st 2024 |
If applicable - note software licensing here with links to licenses, otherwise remove this section
if applicable - note components your application uses regarding to license terms - with authors / licenses / links to licenses, otherwise remove this section