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..




Beats Per Minutes




Required Hardware (Bill of Materials)


• Avnet Azure Sphere MT3620 Starter Kit

Product Link:

• Heart Sensor

Product Link:

• 128x64 Yellow Blue SSD1306 I2C OLED Display

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

Product Link:


Table Of Contents


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:



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



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



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





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

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:

The Github repo is here:

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.


For the ADC coding I used the

Microsoft High Level ADC Example



For OLED Code I used the codebase from the blog post

Avnet 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

   -  with VS Code

   -  on the Windows command line

   -  on the Linux command line


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
  • 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 Brian Willesselement14 Team in Azure Sphere




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..
    • 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?


            • I have included the RasPI source code and the Data from the RasPI and the MT3260
  • 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 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.