PulseSensor Prep

PulseSensor is an open-source hardware and software heart rate monitor that plugs into myriad of hardware development boards such as those in the Arduino family. It can also be used stand-alone as a heart beat sensor in simple electronics projects. In this guide, we will tell the story of how PulseSensor works, what comes in the kit, and how to get setup for success with best practices. We’ll also cover the science behind how PulseSensor, and other Photoplethysmographs, work.

PulseSensor Anatomy

PulseSensor is designed to easily shine light from an LED into your skin and uses a light sensor to read the variation in brightness that is a PPG. The PulseSensor kit includes:

  • PulseSensor with 24 inch color coded cable and male headers
  • Clear stickers to protect the front
  • Velcro dots
  • A velcro strap
  • Costume jewelry ear-clip

The velcro strap and velcro dots to connect to your finger, and the costume jewelry ear-clip is for connecting to your earlobe or wherever you might clip it to. When you first get your PulseSensor, the circuit board is exposed and you will want to follow the next steps to set it up so that it will run faithfully. We use these techniques when we are working on projects or developing improvements.

The front of the sensor is the pretty side with the heart logo. This is the side that makes contact with your skin. On the front you see a small round hole in the middle, which is where the LED shines through from the back, and there is also a little square just under the LED. The square is a light sensor, exactly like the one used in cellphones, tablets, and laptops, to adjust the screen brightness in different lighting conditions. The LED shines light into the fingertip or earlobe, or other capillary tissue, and the sensor reads the amount of light that bounces back. The other side of the sensor is where the rest of the circuit parts are mounted. We put them there so they would not get in the way of the of the sensor on the front. Even the LED we are using is a reverse mount LED. The cable is a 24” flat color coded ribbon cable with 3 male header connectors. Red is +V, black is Ground, and purple is the PulseSensor signal wire. We put standard male headers on the other end to make it easy to plug and play with breadboards and Arduino.

Preparing Your PulseSensor

Before you really start using the sensor you want to insulate the board from your (naturally) sweaty and oily fingers. The PulseSensor is an exposed circuit board, and if you touch the solder points, you could short the board, or worse, introduce unwanted signal noise. We will use the thin vinyl round stickers to seal the front sensor side. Find the small card with four clear round stickers in your kit, and peel one off. Then center it on the PulseSensor. It should fit perfectly.

When you are happy with the way it’s lined up, squeeze it onto the face all at once between thumb and fingers. The sticker (made of vinyl) will kind of stretch over the sensor and give it a nice close fit. If you get a wrinkle, don’t worry, just press it down really hard with your thumbnail and it should stick. We gave you 4 stickers, so you can replace it if necessary. That takes care of the front side. The vinyl sticker offers very good protection for the underlying circuit, and we rate it as ‘water resistant’. meaning: it can withstand sweat and oil from your skin, but don’t wear it in the pool! If this is your first time working with Pulse Sensor, you’re probably eager to get started, and not sure if you want to use the ear-clip or finger-strap (or other thing of your design). The back of the PulseSensor shown above has even more exposed electric contacts than the front, so you need to make sure that you don’t let it touch anything conductive or wet.The easiest and quickest way to protect the back side from undesirable shorts or noise is to simply stick the velcro dot we gave you there for now. The dot will keep your parts away from the Pulse Sensor parts enough for you to get a good feel for the sensor and decide how you want to mount it. You’ll find that the velcro dot comes off easily, and stores back on the little strip of plastic next to the other one we gave you.

Notice that the electrical connections are still exposed! We only recommend this as a temporary setup so you can get started. Next we will show you how to better seal the PulseSensor.

Sealing the Back Side of PulseSensor

It’s really important to protect the exposed PulseSensor circuitry so the oils and sweat of your fingertips or earlobe (or wherever) doesn’t cause signal noise or a short circuit. We have tried many methods to do this with PulseSensor and this is the best by far. Some DIY circuit sealing techniques can cause the PulseSensor to fail. If you paint the back with clear nail polish, for example, the enamel will wick around the LED and through it’s hole in the middle which will refract the LED light in a bad way making the sensor useless. Silicone has some similar problems with destructive lensing of the LED. Our method here uses hot glue, which most folks have on hand, and can be removed by pealing easily when cold or re-worked while warm. if you want to change where you’ve stuck your PulseSensor and you are having trouble removing the hot glue, put the PulseSensor in the freezer for a bit. That will make it easier to remove. We love hot glue! Here are the things you’ll need:

  • Hot Glue Gun & Glue Stick
  • Tape (any tape should do ok, avoid tape with a very aggressive adhesive)
  • Flush-cut wire snips

First, attach the clear vinyl sticker to the front of your PulseSensor, as shown above. Then put a blob of hot glue on the back, right over the circuit. Size can be difficult to judge sometimes. What I meant was put a hot glue blob about the size of a kidney bean on the back side of the PulseSensor. Then, while the glue is still very hot, press the Pulse Sensor glue-side-down onto the sticky side of a piece of blue tape. We believe that blue tape has magical properties, but if you don’t have blue tape other kinds of tape will work just as well.

The tallest thing on the back of the Pulse Sensor is the green LED housing right in the middle. Press it gently against the blue tape on the table top to make the hot-glue seal thin and strong. When you press evenly until the back of the LED touches and the glue oozes out, all the conductive parts will be covered with hot glue. If the glue doesn’t ooze out all around, let it cool down, then peel if from the PulseSensor and try again. Once the glue has cooled down and has some body, you can peel it off easily if you need to. Here’s some pics of hot glue ‘impressions’ that I took during the making of this guide. Then, put a dab of hot glue on the front of the wires where they meet the PulseSensor. This will bond to the other glue that’s there and act as a strain-relief for the cable connection. This is important because the cable connection can wear out over time.

Once the hot glue has cooled (wait for it…) the blue tape will peel off very easily. Check your work to make sure that there are not exposed electrical connections! Next is trimming. I find the easiest way is to use flush cutting wire snips. Take care not to clip the wires!

This is the basic PulseSensor Hot Glue Seal, It’s also got the clear vinyl sticker on the front face. We’re calling this ‘Water Resistant’, ready to be handled and passed around from fingers to earlobes or whatever. It is not advised to submerge or soak the PulseSensor with this basic seal. Now you can stick on the velcro dot (included) and make a finger strap with the velcro tape!

Attaching the Ear Clip

The earlobe is a great place to get a clear PPG signal. There is less movement noise, and the capillary tissue is very dense. We looked all over, and were lucky enough to find an ear clip that fits the PulseSensor perfectly. When we mount PulseSensor to the ear-clip, it is important to apply some strain relief to the cable connection where it meets the PulseSensor PCB. The little wire connections can wear out and break (or short on something) over time. We can do this with hot glue, like we did in the previous example.

First, attach a clear vinyl sticker to the front of the PulseSensor if you have not already. Then, put a small dab of hot glue on the front of the cables right where they meet the PCB. Get some on the edge of the PCB too, that will help. Remember, if you don’t like the blob you’ve made for any reason, it’s easy to remove once it cools down.

Next place the PulseSensor face down, and put a dab of glue about the size of a kidney bean on the back as illustrated above. Center the round part of the ear clip on the sensor and press it into the hot glue. The tallest component on the back is the plastic body of the reverse mount LED, and if you press it evenly it will help keep the metal of the ear clip from contacting any of the component connections.

Allow the hot glue to ooze out around the ear clip. That will ensure good coverage. Take care not to let the hot glue cover around the ear clip hinge, as that could get in the way of it closing. Trimming is easy with flush wire cutters (as above) or your trimming tool of choice. Don’t trim the wires by mistake! Hot glue is also great because it is easy to remove or re-work if you need to, or if want to use your PulseSensor in a different setup.

How PulseSensor Works

Photoplethysmography was invented in 1937 by an American Physiologist named Alrick B. Hertzman. It has a long and difficult pronunciation, so it is normally shortened to PPG. PulseSensor works on the principal of Photoplethysmography. Most people are familiar with PPG through their encounter with Pulse Oximeters. Takuo Aoyagia, a Japanese Bioengineer, is credited with making the modern pulse oximeter in 1971. Oximeters work because hemoglobin in the blood absorbs red and infra-red light differently depending on how much attached oxygen it has. There are new developments in PPG research all the time. Recently, scientists are using it to measure blood pressure changes. Our PulseSensor is not a Pulse Oximeter, it measures heart rate only.

The simplest implementation of PPG is to shine a light into one side of your fingertip, and place a light sensor on the other side. Then, sample the sensor output at a regular rate and graph the pulse waveform. The image below shows a PPG that we made using Processing in 2011 (Processing is a creative coding language www.processing.org), before the Arduino Serial Plotter was available (Arduino v1.6.6, 2015). The vertical scale in the image is 0 to 1023, in order to match the Arduino analogRead range. In the waveform you can clearly see the pulse of a PPG. Every rising edge in the signal means a heart beat happened.

When the LED and sensor are opposed to each other, we are measuring the amount of LED light absorbed by tissues and fluids as it passes through you. When the LED and sensor are next to each other, we are measuring the amount of LED light reflected by tissues and fluids. In either case, every time your heart beats it generates a shockwave that travels throughout your body. When the wave passes by our LED/sensor setup, the density of your tissues becomes just a bit less for a brief moment. That change in density allows more or less LED light to be absorbed or reflected.

 NOTE: 

The pulse wave travels much faster than your blood does as it is pumped around your body. A blood cell's full circuit of your circulatory system takes about 45 seconds, while the heartbeat shockwave transit time from heart valve to toes and fingers is measured in milliseconds.

 

The best place on the body to measure this density change is where there are capillary tissues. It is possible to measure in other places, like the wrist, but signals from sites with less capillary tissue are more difficult to acquire with PPG. Earlobes and fingertips are popular capillary tissue sites for PPG sensors.

 

To get an accurate heart beat time, which translates to an accurate beats-per-minute, we need to make sure that we take samples of the PulseSensor signal on a regular basis, and very fast. It is always important to have a strict regularly timed sample rate, or else any information derived from the signal will be incorrect. We want to sample fast, so that we have a good resolution of the time between beats. Our PulseSensor Playground library uses a sample rate of 500Hz, or a 2 millisecond sample period. We decided on this rate because we found multiple published science papers that recommended and verified it. Our accuracy translates into better and more reliable projects, less headaches, and more fun!

The color, or wavelength of light used in PPG ranges from the visible spectrum to the infra-red, or IR. There are pros and cons to using different colored lights. Blood oxygen, as discussed, uses red and IR to measure blood gas absorption of hemoglobin with good accuracy, so that’s why they are used. Different colors are absorbed or reflected differently, for example, blue light does not penetrate human skin as deeply as green or red light. You would think that red light, since it penetrates more would be a good choice, but it is more susceptible to movement noise because it goes deeper. Also, red light can pick up ambient light noise. Additional factors effecting signal quality include the amount of melanin in your skin because melanin scatters light transmission in the cooler wavelengths. Our selection of green for the color of our LED is specifically chosen to match the peak sensitivity of our sensor. The sensor we are using is tuned to respond mostly to ambient light. This choice was made entirely for design simplicity. Back in 2011, when we started we were working on making a device cheap, easy and small. If you are using any device that reads PPG and you have dark skin, you will get the best signal where you have less melanin, like on your fingertips. Once you get setup with PulseSensor, you will find it easy to test different parts of your and your consenting friend’s body to see how easy or hard it is to measure PPG.

The last challenge in getting a good PPG is movement noise. We are all original organisms, but we are all also big skin bags of blood and bone that slosh around all the time. Imagine that you are trying to measure a teeny tiny pulse shockwave from your earlobe, and then to do a squat. In the squat, you will be pushing pulling fluid all around your body as it bends and muscles contract. The results of those movements make the density in your earlobe change in ways that can obliterate the PPG signal. The sensor wire movement is also a thing that can contribute to noise in the PPG signal. This is not to say that you should not be using PPG when you are exercising or moving around. It is possible to use PPG technology to monitor during a workout that has breaks, for example. Designing a project using PPG is challenging, but that is where creativity, innovation, and a good sense of user experience and user interaction become critical. 

Our original PulseSensor that we made to deliver to our Kickstarter backers in 2012 output the kind of small signal shown in the image above. This small pulse wave is not super easy to monitor with code and derive the heartbeat timing from. Our mission with the PulseSensor project is to make things easy and lickety-split, so we updated the hardware circuit design to incorporate amplification, making the pulse waveform more prominent. We also use a high-pass filter to keep the PulseSensor waveform centered in the middle of the analogRead range. After making those improvements, we got a nice bright pulse waveform that is easy to monitor and derive accurate heartbeat timing from. In the image below, the vertical scale is 0 to 1023. The green line is positioned at the middle of the analog range (V/2) to show how the PulseSesnor waveform is ‘anchored’ to it. When you take your finger off of the PulseSensor, the signal will saturate at either 0 or 1023, then after it has time to settle, it will hover around the value of 512, which is the midpoint of the analogRead range.