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
Design For A Cause 2021
  • Challenges & Projects
  • Design Challenges
  • Design For A Cause 2021
  • More
  • Cancel
Design For A Cause 2021
Blog Blog#4 Beats Per Minute Nano - System Implementation and Testing
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: skruglewicz
  • Date Created: 15 May 2021 4:07 AM Date Created
  • Views 811 views
  • Likes 4 likes
  • Comments 2 comments
  • beats per minute nano
  • arduino nano 33 iot
  • arduino
  • design_for_a_cause_2021
Related
Recommended

Blog#4 Beats Per Minute Nano - System Implementation and Testing

skruglewicz
skruglewicz
15 May 2021

image

BLOG# 4 - Beats Per Minute Nano

A Heart Rate Monitor using the Arduino Nano 33 IoT Board

System Implementation and Testing

This is my 4th blog post in a series of blog post for the Design Challenge: Design for A Cause 2021

Updated

version 1.4

<<< PREVIOUS BLOGNEXT BLOG  >>>

Blog# 3 Beats Per Minute Nano - System Design

Blog#5 Beats Per Minute Nano -  Conclusions and Future Enhancements

 

  • INTRODUCTION

    • This blog will describe the implementation and testing phase of my idea. My original idea was to port the software from a project that I developed for the Azure Sphere MT3620 Evaluation Kit. I had used the C code examples from the Raspberry Pi for the PulseSensor and was able to get the software to run to complete the project.  I describe this project at the beginning of  BLOG# 1 - Beats Per Minute Nano - INTRODUCTION and the code is on my GitHub repo at  MyBPM
    • After doing research on implementing the PulseSensor on the Arduino described in  Blog# 2 Beats Per Minute Nano - Research & Experimentation , I found that it would be so much easier to use the code from there Arduino library. They have implemented all the Timing and BPM calculation logic into there library, that I had to implement in my other project. This made it so much easier to implement my idea.
    • I took pieces of the example code that worked  The "GettingStartedProject"  and created a TEST sketch Pulsesensor_test.ino
    • For the OLED logic,  I took pieces of the code from Blog#2 An OLED Example Project  and created a test sketch  OLED_Test.ino
    • Then I combined the code from the 2 test sketches and created the Final Sketch BPM_NANO.ino
    • For the breadboard wiring I combined the connections from Blog#2 PulseSensor and OLED examples to be used for the above 2 TEST Sketches and the final Sketch
    • These sketch's will be listed and described below.

 

 

  • Blog# 3 Beats Per Minute Nano - System Design
  • INTRODUCTION
  • Electronics build
  • Software Programming
    • Testing
      • PulseSensor test
        • Pulsesensor_test.ino
        • CODE -- PulseSensor.ino
        • PulseSensor Library Function Descriptions
        • TEST RUN Video
        • Electrical Conclusions and Findings
        • Software Conclusions and Findings
      • OLED test
        • OLED_test.ino
        • CODE -- OLED_test.ino
        • Electrical Conclusions and Findings
        • Software Conclusions and Findings
    • Run Application
        • BPM_NANO.ino
        • CODE -- BPM_NANO.ino
        • Run the application

  • Electronics build

    • For wiring my idea, I approached it as follows:
      • As mentioned, for the breadboard wiring I combined the connections from Blog#2 PulseSensor and OLED examples.
      • The wiring diagram is pictured in the design section Breadboard Wiring  from Blog#3
      • I used the examples from my research to test the final breadboard wiring and they both worked the first time.
      • I then went on the implement 2 test and 1 final Sketch, to complete my idea.
  • Software Programming

    • My approach for implementing the software was to take the code that I had been experimenting with in blog#2 and create test sketches for the Pulsesensor and the OLED components. then I would combine the test sketch's to create the finial sketch.
    • Test Sketch's:
      • Pulsesensor_test.ino
      • OLED_Test.ino
    • Final Sketch
      • BPM_NANO.ino
    • List each code block
    • Video of the execution of each code block
    • Describe the routines used.
    • Conclusions and/or Problem encountered.
    • Testing

      • PulseSensor test

        • Pulsesensor_test.ino

          • I used the following sketch to test the wiring and the code for the PulseSensor. You can paste it into the Arduino IDE and try it out, If you have wired the breadboard as specified in my Design Blog#3.
          • The Beats Per Minute value is printed out to the Arduino IDE Serial Monitor. I created the sketch from the The "GettingStartedProject"  example on the pulseSensor.com website.
            • I added the code that follows to get the current BPM after every 50 samples are taken.
              • int myBPM = pulseSensor.getBeatsPerMinute();

                Returns the latest beats-per-minute. Type = int.
            • Then the BPM value is sent to the Serial Monitor in the beginning of every heart beat if the sawStartOfBeat() funtion returns TRUE.
            • Another task that this function does , is to Blink the Arduino Nano LED, to indicate the heartbeat.
              • if (pulseSensor.sawStartOfBeat()) {
                   Serial.println("♥  A HeartBeat Happened ! ");
                   Serial.print("BPM: ");
                   Serial.println(myBPM);
                }

          • CODE -- PulseSensor.ino

        • PulseSensor Library Function Descriptions

          • The following list contains the PulseSensor Library functions with a short description, that I used in the code
        • TEST RUN Video

          • Here is a Video of the test run. It shows my fit2 watch displaying the BPM and then the code and the monitor, showing the BPM reading.
          • The Pulsesensor seems to run at a different BPM then my Fit2 watch.
          • You don't have permission to edit metadata of this video.
            Edit media
            x
            image
            Upload Preview
            image
        • Electrical Conclusions and Findings

          • The test worked the first time. Which one would expect after the help of the experiment in my Research blog.
          • The new wiring with the WaginTop jumper wires worked great and cleans up the breadboard jumper wire clutter nicely.
        • Software Conclusions and Findings

          • The software library for the Arduino IDE is so much easier to use then the one that I used for the Rasberry PI and Azure Sphere projects.
          • The Timing is handled in the sawNewSample() function. which makes the code is tighter and more readable, This was very complicated to analyze and Debug in the other library.
          • The getBeatsPerMinute() function made it easier to work with and streamlined my implementation. For the other projects, the BPM logic had to be coded in the example. The folks at PulseSensor.com, did give examples, but this function is a black-box and just returns what I really nee, the BPM. They also have functions for other readings within the samples, but all I really need is the BPM.
          • In addition, this function also sends a blink signal to a defined Pin on every Heartbeat. Such a nice feature that the programmer does not need to worry about.
          • all in all, I found this library extremely easy to use.

 

      • OLED test

        • OLED_test.ino

        • I used the following sketch to test the wiring and the code for the OLED. You can paste it into the Arduino IDE and try it out, If you have wired the breadboard as specified in my Design Blog#3.
        • I took pieces of the code from Blog#2 An OLED Example Project  and created this test sketch
        • This is a very basic TEST, that will display a counter value that is incremented in the main loop of the sketch .
        • CODE -- OLED_test.ino

        • TEST RUN Video
          • Here is a video of the OLED test run. It is displaying an incremental counter.
          • You don't have permission to edit metadata of this video.
            Edit media
            x
            image
            Upload Preview
            image
        • Electrical Conclusions and Findings

          • Just as the previous test, this worked the first time.
          • At least I know that my wiring in working.
        • Software Conclusions and Findings

          • I learned some interesting use of the Adafruit OLED library,
          • Very similar to the library I used for the other projects.
          • This knowledge will be used for the main program to display the Beats Per Minutes.
    • Run Application

      • BPM_NANO.ino

        • This is the implementation of my design.
        • As designed, it displays the Beats per Minute on an OLED screen generated from a Pulse sensor connected to the Arduino Nano 22 IOT.
      • CODE -- BPM_NANO.ino

      • Run the application

        • Here is the video of the final sketch running.
        • It is displaying the Beats Per Minutes on the OLED screen.
        • I'm also displaying the BPM's on the IDE Serial Monitor.
        • I'm also displaying my BPM on my Fit2 Watch.
        • You don't have permission to edit metadata of this video.
          Edit media
          x
          image
          Upload Preview
          image

      • Conclusions
        • This was a very successful implementation of my design. There were no problems with running this sketch.
        • There seems to be a slight difference in the BPM's  when compared to my Samsung Fit2 watch which displays a BPM. I'm not sure whay but I might play with the Threshold values of the sketch to bring the value closer to the watch.
        • Now on to final blog.

 

 

 

<<< PREVIOUS BLOGNEXT BLOG  >>>
Blog# 3 Beats Per Minute Nano - System DesignBlog#5 Beats Per Minute Nano - Conclusions and Future Enhancements

 

  • Sign in to reply

Top Comments

  • DAB
    DAB over 4 years ago +1
    Nice update. DAB
  • skruglewicz
    skruglewicz over 4 years ago in reply to DAB

    thanks for reading DAB I appreciate it.

    Steve K

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB over 4 years ago

    Nice update.

     

    DAB

    • Cancel
    • Vote Up +1 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