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
Azure Sphere Starter Kit
  • Products
  • Dev Tools
  • Avnet Boards Community
  • Azure Sphere Starter Kit
  • More
  • Cancel
Azure Sphere Starter Kit
Blog Beats Per Minute -- Home Is Where the Hack Is Challenge
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Azure Sphere Starter Kit to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: skruglewicz
  • Date Created: 8 Apr 2020 9:30 PM Date Created
  • Views 1725 views
  • Likes 10 likes
  • Comments 7 comments
  • azurespherehomehacks
  • mt3620
  • azure sphere sample
  • advent
Related
Recommended

Beats Per Minute -- Home Is Where the Hack Is Challenge

skruglewicz
skruglewicz
8 Apr 2020

Introduction

In this blog, I'll demonstrate how I connected a Heart Rate Sensor to the Avnet MT3620 kit. The Beats Per Minute are calculated and displayed on an attached OLED Display. The RED LED will indicate the users heart beat..

 

 

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

 

Beats Per Minutes
imageimage

 

 

 

Required Hardware (Bill of Materials)

 

• Avnet Azure Sphere MT3620 Starter Kit

Product Link:  https://www.element14.com/community/view-product.jspa?fsku=&nsku=02AH9206&COM=noscript

image

• Heart Sensor

Product Link: https://pulsesensor.com/products/pulse-sensor-amped

image

• 128x64 Yellow Blue SSD1306 I2C OLED Display

    eg. this one for $6.99 from Amazon...

Product Link: https://www.amazon.com/gp/product/B072Q2X2LL/

image

 

Table Of Contents

    • Table Of Contents
    • Hardware Configuration
      • Connecting the Pulse Sensor
    • Code
            • Some of the Heart sensor code was ported from a Raspberry PI project that I used to learn about the sensor.
            • For the ADC coding I used the
            • For OLED Code I used the codebase from the blog post
    • Build and Run the project
    • List of Potential Improvements
    • Conclusion

 

Hardware Configuration

 

Connecting the Pulse Sensor

 

Since we're using the Avnet Azure Sphere Starter Kit, We will be putting the 3 leads from the Heart Sensor into boards headers on the Click Socket #1.

The  sensor is very simple with three legs:

 

image

 

Heart Rate Sensor

• BLACK: Ground

• RED: Input: +3V or +5V

• PURPLE: Signal

 

The  Click Socket #1 and the color of the Sensor lead connected to it

• PIN AN - PURPLE lead

• PIN +5V - RED  lead

• PIN GND - BLACK lead

 

. image

See the pinout table below.  For Pin AN the Name used in code is GPIO42_ADC1

imageimageimage

 

 

Connecting the OLED Display

 

You will need to solder a header to the board. This is how I did mine using a 4 pin header I had lying around.

 

Solder a 4 pin header to the  OLED Display  interface on the board

imageimage
imageimage

 

 

Code

 

The code for this project s located  on a GitHub repository located here:

     https://github.com/skruglewicz/MyBPM)

This is built on the 20.04 Sphere SDK and is running Azure Sphere OS version 20.04 Update 2.

 

Some of the Heart sensor code was ported from a Raspberry PI project that I used to learn about the sensor.

I describe some details along with project links in the following document:

https://www.element14.com/community/docs/DOC-94898/l/sphere-adc-document#jive_content_id_RasPI_Project

The Github repo is here:

https://github.com/WorldFamousElectronics/Raspberry_Pi/tree/master/PulseSensor_C_Pi

This  project is working great for me on a Raspberry PI . Here  is the link to the project from the vendor of the Heart Pulse sensor.

https://github.com/WorldFamousElectronics/Raspberry_Pi/blob/master/PulseSensor_C_Pi/PulseSensor_C_Pi.md

 

For the ADC coding I used the

Microsoft High Level ADC Example

https://www.element14.com/community/external-link.jspa?url=https%3A%2F%2Fgithub.com%2FAzure%2Fazure-sphere-samples%2Ftree%2Fmaster%2FSamples%2FADC%2FADC_HighLevelApp

 

 

For OLED Code I used the codebase from the blog post

Avnet Azure Sphere Starter-Kit: Advanced Tutorial

https://www.element14.com/community/groups/azuresphere/blog/2019/08/01/azure-sphere-starter-kit-advanced-tutorial

 

 

Build and Run the project

See the following Azure Sphere Quickstarts to learn how to build and deploy this sample:

 

   -  with Visual Studio     https://docs.microsoft.com/azure-sphere/install/qs-blink-application

   -  with VS Code          https://docs.microsoft.com/azure-sphere/install/qs-blink-vscode

   -  on the Windows command line      https://docs.microsoft.com/azure-sphere/install/qs-blink-cli

   -  on the Linux command line     https://docs.microsoft.com/azure-sphere/install/qs-blink-linux-cli

 

List of Potential Improvements

There is certainly many improvements to be made to this project. Heare are a few of my intentions of features I will be adding.

 

  • Adding a Relay click that will use a buzzer to indicate when a BPM goes over a given BPM's . I was planning on getting this in but ran out of time.
  • Add a Mikroe Heart Rate 4 click https://www.mikroe.com/uv-4-click
  • Add MongoDB Atlas Dstbase support
      • Use the MongoDB C driver
      • connect to  an Atlas  server
      • Write the DATA to a cluster .
  • Add support for Azure IoT Hub, the Device Twin and Azure Time Series Insights
    (Hands-on exercise creating an IoT Hub, manipulating the Device Twin and viewing sensor data using Azure Time Series Insights) using the following project by Posted by bwillessimage in Azure Sphere

          http://avnet.me/mt3620-kit-OOB-ref-design-blog-p2

  • Add Support for Azure IoT Central for Sensor Display and Remote Control of Device Outputs(Introduction to using the different tabs in IoT Central, to create sensor visualizations and a device output control dashboard) using the following project by Posted by bwillessimage in Azure Sphere
    • http://avnet.me/mt3620-kit-OOB-ref-design-blog-p3

 

 

Conclusion

This was an interesting journey to learn more about the Azure Sphere mt3620.

  • It was a challenge, porting the C code from the Raspberry PI Project.
    • I needed to understand and lean about The ADC on the mt3620. The RasPi project had a ADC that was part of the Project Circuit..
      • Special thanks to bwillessimage in the Azure Sphere.group for you guidance on this.
    • I still need to tune up the signal and compare it to the data transmitted by the Raspberry pi project.
      • I'm not getting the same numbers for BPM on the MT3620 as on the RasPi project?
        • I believe it might be a signal or timing issue.
          • The RasPI output is closer to my average BPM of 83 bpm's then the MT3620

 

            •  

              As you can see the BPM is Lower on the MT3260?

              the Jitter is way higher?

              imageimage
              imageimage

               

            • I have included the RasPI source code and the Data from the RasPI and the MT3260
            • The code from the RasPi project
            • The output from the RasPi project PULSE_DATA_2020-05-25_17_56_16.txt
            • A Similar run of the mt360 sample1.txt
  • One of the sticking points was, How to connect the Heart sensor leads to the board.
    • It tuned out to be pretty straight forward. But wasn't easy for me to figure out how to map the GPIO on the Rasberry Pi to the GPIO mapping of the MT3620
  • Another Hurdle was getting a the OLED display to work.
    • I used all the code from the Avnet Azure Sphere Starter-Kit: Advanced Tutorial
    • I used the 3 objects olded.c, ,i2c.c,  and sd1306.c
    • Thanks to Peter Fenn and Brian Willess at Avnet, This is very feature rich example that helped me to figure out how to do most of my code.
  • Sign in to reply

Top Comments

  • ankur608
    ankur608 over 5 years ago +4
    Great article.
  • bwilless
    bwilless over 5 years ago +3
    Nice job Stephen!
  • skruglewicz
    skruglewicz over 5 years ago in reply to bwilless +3
    Thank you Brian for your help.
  • skruglewicz
    skruglewicz over 5 years ago in reply to kevinkeryk

    Thanks Kevin for the complement ... Steve K

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • kevinkeryk
    kevinkeryk over 5 years ago

    Great writeup skruglewicz thank you for putting this together!

     

    Fascinating application too!  With all of the medical stuff that is coming out you can never be too safe when it comes to medical device data security, right?

     

    Best Regards,

     

    -Kevin

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • skruglewicz
    skruglewicz over 5 years ago in reply to dubbie

    Hi ..

    thanks for the interest in my project..

    I would highly recommend purchasing the sensor. I purchased it for and experiment about two years ago. They also have an en ear clip, which is helpful to use the sensor during sleep or activity.

    I first used it on the raspberry pi when I started to experiment with edge devices in the health community.  The Ardunio project was the first circuit the sensor makers used end it looked to me to be a lot simpler than the raspberry PI solution. I did not have an Arduino device on hand.  If you do pursue the Arduino solution, I’d be interested in knowing your results.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • dubbie
    dubbie over 5 years ago

    An interesting project. I liked it so much I think I will get the sensor and try out an Arduino version.

     

    Dubbie

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • skruglewicz
    skruglewicz over 5 years ago in reply to bwilless

    Thank you Brian for your help.

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
>
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