3.6.2 BLE Fitness Tracker Application on SAM E51 Curiosity Nano Evaluation Kit and Nano Base for Click Boards
Description
The application demonstrates a solution based on Microchip products for the health care industry and wearable products. The application displays heart rate readings (in beats per minute - bpm) on a very low power consuming display and posts this Heart Rate data to Microchip Bluetooth Data (MBD)android mobile application via BLE (Bluetooth Low Energy).
The Mikro Elektronika Heart Rate 9 click board is used to read the heart pulse. Mikroelektronika Eink E-Paper display 2,9" 296x128 dots display is used for displaying heart rate. The Eink E-Paper display 2,9" 296x128 dots display device contains the eINK click adapter board and the Eink E-Paper display 2,9" 296x128 dots display. RNBD451 Add On Board Bluetooth module is used to send the heart rate data over BLE.
The Heart Rate 9 click introduces Microchip's proprietary method of measuring multiple signals in a body using pseudorandom binary sequence generation and phase division multiplexing This algorithm for processing data from the sensor and it can send data for 3 different diodes (green, ir, red) who give out a diagram of the heartbeat and its frequency per minute.
The Eink E-Paper display 2,9" 296x128 dots display is a very low power consumption display and it can retain the information, even after disconnecting from the power source. The host MCU SAM E51 is interfaced with the Heart Rate 9 click over the USART interface and eINK click over SPI Interface.
Modules/Technology Used
- Peripheral Modules
- Timer
- EIC
- SERCOM (SPI)
- SERCOM (USART)
- RNBD451
- STDIO Library
Hardware Used
Software/Tools Used
This project has been verified to work with the following versions of software tools:
Refer Project Manifest present in harmony-manifest-success.yml under the project folder firmware/src/config/sam_e51_cnano.
- Refer the Release Notes to know the MPLAB X IDE and MCC Plugin version
- Install Microchip Bluetooth Data Android App in the Android mobile or
- Install Microchip Bluetooth Data iOS App in the iOS mobile
Because Microchip regularly updates tools, occasionally issue(s) could be discovered while using the newer versions of the tools. If the project does not seem to work and version incompatibility is suspected. It is recommended to double-check and use the same versions that the project was tested with. To download original version of MPLAB Harmony v3 packages, refer to document How to Use the MPLAB Harmony v3 Project Manifest Feature (DS90003305).
RNBD451 Add On Board Setup
-
Connect the SAM E51 Curiosity Nano Evaluation Kit to the Host PC as a USB Device through a Type-A male to micro-B USB cable connected to Micro-B USB (Debug USB) port
-
Adjust the PWR SEL (Power Supply Selection) Jumper JP1 to the mikro 3V3 setting (i.e short J1 and J2), designated for the mikroBUS interface on the RNBD451 Add-On Board as indicated in the below image. By doing so, this configuration enables the RNBD module to draw power directly from the MCU's power supply. This eliminates the necessity of using an additional USB cable to power up the RNBD451 Add-On Board.
Setup
- Mount SAM E51 Curiosity Nano Evaluation Kit on "CNANO56_HOST_CONN" (U3) connector of Curiosity Nano Base board.
- Mount Heart Rate 9 click board on mikro bus 3 connector of Curiosity Nano Base board.
- Mount the Eink E-Paper display 2,9" 296x128 dots display(eINK click + eink epaper 2.9 296x128 dispaly) on the mikro bus 1 connector of Curiosity Nano Base board
- Mount the RNBD451 Add On Board on to mikro bus 2 connector of Curiosity Nano Base board
- Power the SAM E51 Curiosity Nano
Evaluation Kit from a Host PC through a Type-A male to Micro-B USB cable connected to
Micro-B port (J105).
Programming Hex File
The prebuilt hex file can be programmed by following the below steps.
- Open MPLAB X IDE
- Close all existing projects in IDE, if any project is opened.
- Go to File -> Import -> Hex/ELF File.
- In the Import Image File
window,
- Create Prebuilt Project,
- Click the Browse button to select the prebuilt hex file.
- Select Device as ATSAME51J20A.
- Ensure the proper tool is selected under Hardware Tool and click on Next button.
- Select Project Name and Folder,
- Select appropriate project name and folder and click on Finish button
- Create Prebuilt Project,
- In MPLAB X IDE, click on Make and Program Device button to program the device.
- Follow the steps in Running the Demo section below.
Programming/Debugging Application Project
- Open the project (ble_fitness_tracker\firmware\sam_e51_cnano.X) in MPLAB X IDE
- Ensure SAM E51 Curiosity Nano is selected as hardware tool to program/debug the application
- Build the code and program the device by clicking on the Make and Program Device button in MPLAB X IDE tool bar
- Follow the steps in Running the Demo section below
Running the Demo with BLE
Before proceeding, install the Microchip Bluetooth Data android app in an Android Smartphone.
- Enable Bluetooth and location from Smartphone settings.
- Perform reset by unplugging and re-plugging the power cable of SAM E51 Curiosity Nano Evaluation Kit.
- Parallelly, open the Microchip
Bluetooth Data (MBD) android app from the smartphone and tap on Bluetooth Smart
icon on the dashboard. If prompted, allow the application to turn on Bluetooth.
- After power-up, the application displays the Microchip logo on the Eink E-Paper display 2,9" 296x128 dots display and initializes the heart rate sensor.
- After successful initialization of the heart rate sensor, two integrated LEDs on the heart rate 9 click lights up.
- Scan for Bluetooth devices by tapping
START SCAN option on the MBD APP.The RNBD451 device should appear as MCHP_SAM_E51_HR in the list of Bluetooth devices.
- Stop the scan and connect the MCHP
BLE device by clicking on MCHP_SAM_E51_HR.This will establish a connection between the MBD BLE application and the RNBD451 BLE device.
- Once BLE device is connected, the
application shows the different services screen. Scrolll down and tap on the Heart
Rate Service, it will redirect to Sensor Location screen.
- Press the SW0 and keep the
finger on Pulse Detection Indicator on the heart rate 9 click sensor as shown in the
figure below, do not push or put pressure on the sensor (the heart rate values may not
be accurate).
- In the bottom right corner of the
Sensor Location screen, disable and enable the Notify Button.
- LED0 on SAM E51 Curiosity Nano Evaluation Kit will glow on.
- Wait till the LED "LED0" on SAM E51
Curiosity Nano Evaluation Kit goes off. Once the LED is off, lift the finger.Note: Make sure smartphone screens are not turned off and do not switch to any other App(s) on the smartphone.
- The heart rate value (in bpm - beats
per minute) gets displayed on the Sensor Loaction screen as shown in the figure
below. The same heart rate value gets displayed on the Eink E-Paper display 2,9" 296x128
dots display.
Running the Demo without BLE
- Perform reset by unplugging and re-plugging the power cable of SAM E51 Curiosity Nano Evaluation Kit.
- After power-up, the application displays the Microchip logo on the Eink E-Paper display 2,9" 296x128 dots display and initializes the heart rate sensor.
- After successful initialization of the heart rate sensor, two integrated LEDs on the heart rate 9 click lights up.
- Press the switch SW0 on SAM E51 Curiosity Nano Evaluation Kit, LED "LED0" on SAM E51 Curiosity Nano Evaluation Kit glows on.
- Place the index finger gently on the
heart rate 9 click sensor as shown in the figure below, do not push or put pressure on
the sensor (the heart rate values may not be accurate) .
- Wait till the LED “LED0” on SAM E51 Curiosity Nano Evaluation Kit goes off and then lift the finger.
- The heart rate value (in bpm - beats per minute) gets displayed on the Eink E-Paper display 2,9" 296x128 dots display.
Comments
- Reference Training Module:
- This application demo builds and
works out of box by following the instructions above in Running the Demo
section. If the user needs to enhance/customize this application demo, should use the
MPLAB Harmony v3 Software framework. Refer links below to setup and build the
applications using MPLAB Harmony.
- How to Setup MPLAB Harmony v3 Software Development Framework (DS90003232).
- How to Build an Application by Adding a New PLIB, Driver, or Middleware to an Existing MPLAB Harmony v3 Project (DS90003253).
- Video - How to Set up the Tools Required to Get Started with MPLAB® Harmony v3 and MCC
- Create a new MPLAB Harmony v3 project using MCC
- Update and Configure an Existing MHC-based MPLAB Harmony v3 Project to MCC-based Project