element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Freedom development platform
  • Products
  • Dev Tools
  • Freedom development platform
  • More
  • Cancel
Freedom development platform
Blog Build and Run the BLE Wireless Connectivity Example Demos on the FRDM-KW40Z [Demonstrating Heart Rate monitor using android app based on Bluetooth Low Energy implemented on KW40Z]
  • Blog
  • Forum
  • Documents
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Freedom development platform to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: bheemarao
  • Date Created: 2 Jun 2016 7:37 AM Date Created
  • Views 733 views
  • Likes 2 likes
  • Comments 0 comments
  • kinetis w series
  • ble + 15.4
  • heart rate sensor
  • frdm-kw40z
Related
Recommended

Build and Run the BLE Wireless Connectivity Example Demos on the FRDM-KW40Z [Demonstrating Heart Rate monitor using android app based on Bluetooth Low Energy implemented on KW40Z]

bheemarao
bheemarao
2 Jun 2016

In continuation to my earlier blog on [demonstrating wireless point-to-point out of the box connectivity based on SMAC]

 

This document demonstrates the simulation of the Heart rate sensor (emulating by connecting a potentiometer) using NXP Bluetooth Low Energy Software for the KW40Z wireless microcontroller platforms.

 

The starting point is to port an existing BLE example application project that is available in the current KW40Z Connectivity Software package.

This document covers installation of the software packages, hardware setup, build and usage of the provided demo applications.

 

The KW40Z is a highly-integrated single-chip device that enables BluetoothRegistered  Smart/BluetoothRegistered Low Energy (BLE) v4.1 and IEEERegistered 802.15.4-2011 RF connectivity for portable, extremely low-power embedded systems. Applications include portable health care devices, wearable sports and fitness devices, AV remote controls, computer keyboards and mice, gaming controllers, access control, security systems, smart energy and home area networks.

The KW40Z MCU integrates a 2.4 GHz transceiver supporting a range of FSK/GFSK and O-QPSK modulations, an ARMRegistered CortexRegistered-M0+ CPU, 160 KB Flash and 20 KB SRAM, BLE Link Layer hardware, 802.15.4 packet processor, hardware security and peripherals optimized to meet the requirements of the target applications. The KW40Z has enough on-chip memory to concurrently run both a Bluetooth Low Energy stack and an IEEE 8021.5.4 MAC/PHY for multi-mode applications.

The platform features a composite USB device called OpenSDA which serves as debugger interface and as a USB-to-serial converter via a virtual COM port application. Several firmware images can be programmed on the OpenSDA device, such as these:

  • developer.mbed.org/handbook/CMSIS-DAP
  • segger.com/opensda.html
  • http://www.pemicro.com/opensda/

 

Pre-requisite:

 

  • FRDM-KW40ZFRDM-KW40Zwith CMSIS DAP Link bootloader(to perform openSDA drag and drop

Install the boot loader driver with OpenSDA_V2_1.bin from below segger link:

https://www.segger.com/downloads/jlinkopensda

  • Smart phone with installed “Kinetis BLE Toolbox” Android app
  • Installed KW40Z_Connectivity_Software_1.0.0.exe software package

 

Bluetooth Low Energy

 

The Software Development Package provides a Bluetooth Low Energy v4.1-compliant host stack and controller implementation with a set of GATT-based profiles and services implemented on top.

 

Bluetooth Low Energy Heart Rate Monitor (Reference Design)

The BLE Heart Rate Sensor is a portable device operated by a rechargeable battery. It includes the proper circuitry to obtain and process ECG signals for heart rate calculation. A SoC that includes a M0+ core microcontroller and a BLE radio acquires processes and reports the gathered information via BLE to an enabled Smartphone or device.

 

The ECG signal is obtained from the finger tips and processed by the Kinetis KW40Z SoC Then the user’s heart rate is calculated and transmitted to a smartphone application using BLE The reference design can be powered by a Li-Ion coin-cell battery Due to the low-power features of Kinetis KW40Z MCU a 3.6V 200mA/h Li-Ion coin-cell rechargeable battery can provide the power of up to 40 hours of continuous use The NXP  MC34671MC34671 is in used as a battery charger solution for the device

 

image

The Heart Rate Sensor application implements a GATT server and the following profile and services:  Heart Rate Profile v1.0

  • Heart Rate Service v1.0
  • Battery Service v1.0
  • Device Information Service v1.1

 

The application behaves as a GAP peripheral node. It enters the GAP General Discoverable Mode and waits for a GAP central node to connect. When the collector configures notifications, the sensor starts sending heart rate measurements every second.

Each of Wireless Connectivity Stack comes with a list of demo applications and driver examples ready to be compiled and run.

 

Link to Bluetooth Heart Rate Monitor Reference Design|NXP

 

Note:

We are showing just a“simulation(actual sensors are not there and they are emulated by potentiometer of Heart rate sensor with Freedom board  FRDM-KW40ZFRDM-KW40Z

FRDM-KW40ZFRDM-KW40Zand BLE HEART Monitor reference design are different

 

Steps involved:

The first step is to download the “KW40Z_Connectivity_Software_1.0.1.exe” installer

Download and install KW40Z_Connectivity_Software_1.0.0.exe from below link

[http://www.nxp.com/webapp/Download?colCode=KW40Z-CONNECTIVITY-SOFTWARE&Parent_nodeId=1433195919005714784795&Parent_pageType=product]

 

The package contains various demo applications that can be used to get a first feel for the software.

After installing installer automatically creates or updates the KSDK13_FWK524_PATH environment variable required by the KW40Z BLE projects. Once the above steps are performed, you can start using the BluetoothRegistered Low Energy Demo Applications.

 

After installing, you will find below resources inside the connectivity software path:

image

The example projects are been located in below link:

C:\Freescale\KW40Z_Connectivity_Software_1.0.1\ConnSw\examples\bluetooth

image

There are two options in executing the Heart rate sensor example project:

 

1) Build and Run a Bluetooth LE Example Application.

      or

2) Flashing a Binary Image File without Using an IDE. Use the precompiled binary provided by KW40Z Connectivity Software which is located at

“C:\Freescale\KW40Z_Connectivity_Software_1.0.1\ConnSw\tools\binaries”

 

To go with option-1 we need to have a copy of the IAR Embedded Workbench for ARMRegistered version 7.40.2 or higher. This connectivity software package does not include support for any other toolchains.

I am going with option-2 i.e to flash a pre-existing binary image file and demonstrate using android app “Kinetis BLE Toolbox”

The KW40Z connectivity software package contains in the ConnSw\tools\binaries folder a series of pre-compiled binary applications that can be flashed onto a development board.

image

In order to flash the corresponding binaries to the  FRDM-KW40ZFRDM-KW40Z board the best approach is to use the OpenSDA on-board interface CMSIS-DAP Mass Storage Device functionality by simply dragging and dropping the binary image in the mass storage drive exposed by this OpenSDA firmware

 

Plug on the frdm-kw40z hardware board to your computer via usb cable

image

After plugging in you will get the below AutoPlay DAPLink window (you board gets detect as DAPLink drive)

image

Open the DAPLink folder and copy paste the “BLE_HRS_frdmkw40z.bin” file from the location “C:\Freescale\KW40Z_Connectivity_Software_1.0.1\ConnSw\tools\binaries”

image

Now paste this file into the DAPLink folder as shown below:

image

Now your target board is ready to execute

I have installed Kinetis BLE Toolbox Android app on Samsung smart phone as shown below:

image

After flashing the board, the sensor is put in deep sleep (all 4 LEDs are off). To wake up and start advertising, press the SW4 button. When in GAP Discoverable Mode, the LED1 is on. When the central node connects to the peripheral, LED1 remains solid.

To disconnect the node, hold the SW4 button pressed for 2-3 seconds. The node re-enters the GAP Discoverable Mode when the SW4 button is pressed again.

 

By default the heart rate value format is set to 8 bits and the contact status is on.

To vary the heart rate value, use the potentiometer on the back of the board.

 

To make the Heart Rate Sensor visible, press the SW4 button to start sending advertisements. The sensor name “FSL_HRS” shows on the device when its scanning is active. A solid LED1 indicates a successful connection between the two devices. Hold the SW4 button pressed for 2-3 seconds anytime to get the sensor to initiate disconnect.

 

If configured, the sensor notifies the application with heart rate measurements every second. Also, the battery level and various device information is exposed for reading.

image

Follow below steps to execute the project

 

Step-1:

To make the Heart Rate Sensor visible, press the SW4 button.

 

Step-2: open the Kinetis BLE Toolbox app in your smart phone, for the first time it will ask its Bluetooth to switch on

image

Now your app will look like as shown below:

image

Step-3: Click on Heart rate icon

image

Step-4: You can find “FSL_HRS” Bluetooth device on the App as shown below:

image

Click on FSL_HRS to select this device. Then you can see the status as connected as shown below:

 

image

Step-5: Now vary the potentiometer to see the sensor value as shown below:

image

You can see the corresponding graphical value on the app as shown below:

image

The Video output execution is shown in below video:

 

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

Happy Executing the Heart rate sensor example using app on smart phone on KW40Z (wireless MCU)...  image image image image

  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube