element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • 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 & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • 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
Project Videos
  • Challenges & Projects
  • element14 presents
  • Project Videos
  • More
  • Cancel
Project Videos
Documents Build Your own ESP32 Fitness Heart Rate Monitor / Tracker -- Episode 692
  • Documents
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Project Videos to participate - click to join for free!
Related
Recommended
Engagement
  • Author Author: cstanton
  • Date Created: 26 Nov 2025 4:15 PM Date Created
  • Last Updated Last Updated: 27 Nov 2025 3:27 PM
  • Views 358 views
  • Likes 4 likes
  • Comments 3 comments

Build Your own ESP32 Fitness Heart Rate Monitor / Tracker -- Episode 692

Join Milos as he puts together an open source heart rate monitor built around an ECG front end and an ESP32 C3, then takes it out for a run to see how it performs next to his everyday fitness gear. He walks through the signal processing, the BLE connection to his phone and the real world results from a full workout. It is a hands on build that shows what works, what drifts and what he plans to improve in the next version.

Time to Get Running!

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

Please note: Due to the nature of this project, it does involve placing electrodes onto the skin. The design of this project is intended with opto-isolation to prevent problems involving electricity and voltage levels, if you choose to recreate this project, you do so at your own risk and with the understanding that you're expected to have appropriate training and be a sufficiently 'competent' person. This project is also not presented with any health or medical certifications and as such is 'proof of concept' and not expected to be used in any official capacity as a medical device.

In this video, Milos went for a run! Before he did that though, he decided he wanted to try making his own heart rate tracker for running using an AD8232 ECG module and a XIAO ESP32 C3 microcontroller. The device sends the heart rate data to a phone over BLE and is recognized as a heart rate tracker by all fitness apps like Strava!

image

Idea and Plan

For a little while now Milos has gotten into running and he likes to keep track of his heart rate while he does that. He started off by using a smartwatch that has a built in PPG sensor, but later switched over to a chest strap with a heart rate sensor that measures electrical activity. He got curious to how hard it would be to make his own, and this is what he tries tackling in this video. He decided to make his device compatible with the chest strap that most other running tracker use as well.

image

To begin his work on this project, Milos decided to start off by selecting an AFE (Analog Front End) IC and go from there. He decided on using the AD8232 since it’s a popular IC because of the ECG module and because he already used in a previous project in his Open Cardiography Signal Measuring Device:

 Building an Open Source Blood Pressure & Heart Signal Monitor -- Episode 674 

The initial plan was for him to design a PCB using this IC, a Raspberry Pi Pico and a bunch of other things he wanted to try out like wireless charging and a microSD card slot, but in the end the ECG section on the PCB didn’t work. He tried resoldering multiple times and doing any modifications that came to his mind, but in the end, the signal he would get from the board just wasn’t good enough. At that point, he knew he had to do a full redesign of the PCB but decided to first try making a fully DIY version using small modules so he can test out the software side. Because of this, he decided to go with the AD8232 module and a XIAO ESP32 C3 MCU. Both are small, and the XIAO board provides really good BLE capabilities which is what he needed to send the data to the phone. Besides these two modules, the only other things that are needed are a battery, a switch and a small boost converter to increase the battery voltage to 5V.

image

Before putting the chest strap and going for a run, the hard part of the project had to be completed, the software. This includes first getting the data acquistion working properly and then trying to implement an algorithm to calculate the heart rate from the ECG signal. Below are pictures of the captured ECG signal using the modules described above.

image

image

Pan Tompkins

The Pan Tompkins algorithm is one of the most significant and widely used methods for ECG signal processing. It originates from a paper titled “A Real-Time QRS Detection Algorithm” that was published by Jiapu Pan and Willis J. Tompkins in 1985. The full paper can be viewed for free on the following link:

https://www.robots.ox.ac.uk/~gari/teaching/cdt/A3/readings/ECG/Pan+Tompkins.pdf

Because of the significance of this algorithm and paper, and the fact that it’s still a widely used method even though it has been 40 years since the paper was published, Milos decided to implement it in his project. This was by far the most challenging part of the project because he wanted to go step by step to get a good understanding of how the algorithm works.

image

In the video, he goes into a lot of detail first explaining on a drawing the whole process of the algorithm and then shows the implementation that he has written in Python in Google Colaboratory. For more details, check the full video. The final results from his PT integration can be seen in the two figures below.

To convert the whole algorithm from Python to C++ so he could use it on his ESP32 board, he decided to try using Cursor AI for the first time, which turned out to be a pretty good experience, since he managed to generate code by feeding it his PanTompkins Python script and the ESP codes for sampling the data and sending the data over BLE. While there were mistakes initially, they were relatively easy to fix!

image

image

Results

While the results looked promising on a really clean signal, it was now time for Milos to test it out on a run. He went for an easy 5K in his neighborhood wearing the device he made as well as he smartwatch as a control device (even though the smartwatch itself isn’t that super accurate as Milos notes in the video). To analyze the data, he recorded his run using Strava, which is one of the more popular fitness tracking apps. Strava initially recoreded the run using the ESP32 heart rate running tracker, but also records another parallel session that gets later added to strava because of a third party app to which the smartwatch is connected. In that way, Milos double recoreded the same activity with the only difference being the heart rate sensor. This was perfect for actually comparing the results, and if you go to your activity in Strava using a browser, you can actually download the whole activity as a FIT file and analyze it further using Python! Here is the heart rate data from his smart watch and the ESP32 Heart rate tracker.

image

image

While there are some similarities when you look at the signal, it is clear that they don’t match up properly. This is even more evident if we put both signals on the same graph. You can see that the ESP32 Heart rate tracker followed the smart watch pretty good in the beginning and in some sections, but in others, the readings were just off.

image

If we zoom in on certain segments, we can see that there are times when we can say both devices were essentially showing the same heart rate (within some amount of tolerance of course), while at other times, there really wasn’t much correlation between the two signals. Both cases can be seen in the figures below.

image

image

Since not even the smartwatch can be fully trusted and since Milos couldn’t see the raw data, he couldn’t determine the exact point where the algorithm was failing, or whether this was just to the input signal being too noisy. To determine that, he said he would need to make a device with proper data logging capabilities and with an AFE IC that could accomplish this task better than the AD8232 using two electrodes.

Milos is still happy with the results he got, the Pan Tompkins algorithm worked on the signals he put it through and the device was recognized without any issues by the fintess tracking apps. His next goal is to redesign a PCB with a different AFE IC and also add a microSD card slot for data logging so he could properly analyze the data. These are all plans for the V2 of this project, if you have any other ideas that you would like him to add to the heart rate fitness tracker, leave them in the comments below and you might see them pop in the next video!

Supporting Files and Links

-  Episode 692 Support Files 

-  https://www.robots.ox.ac.uk/~gari/teaching/cdt/A3/readings/ECG/Pan+Tompkins.pdf

-  Building an Open Source Blood Pressure & Heart Signal Monitor -- Episode 674  

Bill of Materials

Product Name Manufacturer Quantity Buy Kit
XIAO ESP32C3 - 113991054 SEEED STUDIO 1 Buy Now
AD8232 ECG Module - SEN0213 DFROBOT 1 Buy Now
White PLA - MC002554 MULTICOMP PRO 1 Buy Now
 

Additional Parts

Product Name Manufacturer Quantity
Wires
Snap Buttons
Heart Monitor Chest Strap
1S LION/LIPO Cell
Tiny Boost Converter

  • DIY wearable tech
  • microcontroller project
  • wearable electronics
  • BLE heart rate sensor
  • fitness data anlysis
  • running tracker
  • custom fitness tracker
  • heart rate detection
  • ECG heart rate tracker
  • ESP32 C3 project
  • ECG signal processing
  • AD8232 ECG module
  • friday_release
  • ECG monitoring
  • DIY chest strap
  • Pan Tompkins algorithm
  • Share
  • History
  • More
  • Cancel
Actions
  • Share
  • More
  • Cancel
  • Sign in to reply
Parents
  • milosrasic98
    milosrasic98 1 day ago

    If you have any suggestions on what you would like to see in the next version of this, let me know in the comments here!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
Comment
  • milosrasic98
    milosrasic98 1 day ago

    If you have any suggestions on what you would like to see in the next version of this, let me know in the comments here!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
Children
No Data
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