1,200 millisecond and 300 millisecond
intervals, respectively, as represented by
maxInterval and minInterval.
A beat detected outside this window is
ignored. This is admittedly a generous window
— I’ve never met anyone with a heart rate of 50
beats/minutes while running or otherwise
The second filtering operation is performed
in the loop by averaging the current beat-to-beat interval measurement with the previous
interval, and using that average as the current
For example, if the current interval is
measured at 1,000 milliseconds and the second
is measured at 800 milliseconds, then the
average of 900 milliseconds is taken as the
value of the current interval.
This walking average approach to filtering
minimizes the LED display jumping from one
color to the next with every beat when the
user’s heart rate is at the fringes of the training zone.
In this example, the training zone assumes a 20 year
old user with a training target of between 70 and 100
beats/minutes, represented by a ZoneLow value of 860
and a ZoneHigh value of 600, respectively.
If you’re not 20, then you’ll have to modify the values
for ZoneLow and ZoneHigh to reflect 50%-85% of your
maximum heart rate, as described earlier.
Once you’ve entered the heart rate limits for your age
correctly in the software and uploaded the code to the
Arduino, simply clip on the sensor and start exercising.
Within a minute of maintaining a pace within your
exercising window, the green LED should be illuminated.
If, instead, the white LED is illuminated, you need to speed
things up. Conversely, if the red LED is illuminated, you’re
Once you’re happy with the basic setup, you can
extend the hardware and software in a variety of ways. An
easy add-on is to have the appropriate LED blink in synch
with the beat signal from the sensor. If you’re more
adventurous, add a color OLED display that shows the
numeric heart rate, in white, red, or green, with a blinking
heart icon to the side of the numeric display.
Although I find it a bit annoying, if you want to, you
could substitute a buzzer for the red and green LEDs. It
should be obvious to you whether you’re over- or under-exerting yourself.
The Translational Reality Twist
Okay. We’ve covered the basics of biological
monitoring, including the need to handle noise and
variability in the signal. Now, let’s do something a little out
of the ordinary.
If you’ve followed my recent translational reality
articles in SERVO and Nuts & Volts, you know that the
idea is to provide a real time closed-loop system in which
a user operates a familiar first device and — in so doing —
both monitors and controls a second device. The kicker is
that feedback is appropriate to the first device, but reflects
the operation of the second device.
In this article, I’m going to show you how to leverage
the innate pattern matching and self-regulatory skills of the
user to serve as a proportional integral differential (PID)
As you may know, a PID controller has myriad
application areas — from automotive cruise control to
maintaining constant robotic arm movement regardless of
load, and home temperature control. In short, although
the user thinks they’re modifying their pace to keep their
heart rate within the training zone (as indicated by the
green, red, and white LEDs), they’re actually controlling
and monitoring the pressure, temperature, level, etc., of an
external remote device.
December 2017 29
Translational reality is a real time closed-loop system in which a user operates a
familiar first device and — in so doing —
both monitors and controls a second
device. The kicker is that feedback is
appropriate to the first device, but reflects
the operation of the second device.
FIGURE 5. Schematic of the heart rate monitoring system.