€5 PPG – photoplethysmogram amplifier / Arduino circuit

The photoplethysmogram (PPG) is a signal that measures changes in blood volume in some part of the body (e.g. the fingertip) by shining light into the skin and detecting small changes in the level of light absorption that occur due to the blood vessels enlarging and contracting. One common application is heart rate measurement. When the heart beats, blood vessels around the body swell slightly due to the increased blood pressure. This results is variable light absorption over the course of each cardiac cycle.

This circuit is a €5 PPG system that uses a TCRT5000 reflective infrared sensor, an LM358 opamp and an Arduino Nano.

The following Arduino code samples the analog voltage on pin A7 (the sample rate is approximately 100 Hz) and prints the values via the serial connection. The signal can therefore be plotted using the Arduino development environment’s Serial Plotter tool (located under the Tools menu). Normally, the Serial Plotter dynamically scales the vertical axis to fit the displayed signal. To prevent this (and maintain constant scaling), this program actually outputs two additional dummy signals – one which is always 0 and another which is always 1023. These hold the vertical axis limits at constant values.

//
// Photoplethysmogram (PPG) example
// Written by Ted Burke, 3-4-2019
//

void setup()
{
  pinMode(2, OUTPUT);
  Serial.begin(9600);
}

void loop()
{
  int du;

  du = analogRead(7);

  Serial.print("0 1023 ");
  Serial.println(du);

  delay(10);
}

This is an example PPG signal recorded using the above circuit (I rested my fingertip directly on top of the TCRT5000) and displayed in the Serial Plotter:

Since the PPG is a very low frequency signal, you may wish to reduce the gain of the amplifier at higher frequencies, which will tend to reduce the visible interference and smooth out the signal. This can be achieved by placing a 100nF capacitor in parallel with the 100kΩ resistor. The following signal was recorded with that capacitor in the circuit.

This entry was posted in Uncategorized and tagged , , , , , , , , , , . Bookmark the permalink.

13 Responses to €5 PPG – photoplethysmogram amplifier / Arduino circuit

  1. chiath1 says:

    Hi Ted,
    I am trying this set up for a project in school. However when I replicate this I was unable to get the same graph of the pulse as you. For my set up it only showed a one-off reading when i placed my hand on the sensor. It peaked as the IR was reflected then it went to 0 again.
    Do you have any tips/advice as to how I can improve it?
    Thanks!

    • batchloaf says:

      Hi chiath1,

      Sorry for the delay responding.

      This circuit is designed to amplify very small changes in the amount of infrared light reflected by the finger. Any sudden large changes will “saturate” the amplifier, meaning that its output will go all the way to the maximum (or minimum) level. This should happen when you first place your finger on the sensor because the change in reflected light is very large (between no finger on the sensor and a finger directly on the sensor). It takes the amplifier a while (about 20-30 seconds maybe) to settle back down when it saturates and return to amplifying the very small changes that occur when the heart beats.

      What I suggest you do is place your finger on the sensor (pressing lightly on it) and hold it very still for about a minute (or until you see the signal on the screen come out of saturation). What it looks like when it’s saturated is the signal is just dead flat, either at the top or the bottom of the graph. When it comes out of saturation, the signal will more like wander around a bit. Hopefully, it will wander to a resting level somewhere in the middle of the graph and you’ll then see the little pulses that occur each time the heart beats.

      If that doesn’t work, maybe I could get you to send me a clear photo of your circuit and I’ll check that everything’s where it should be?

      Ted

  2. Davin says:

    Dear Ted,

    I am very fascinated with your circuit for this PPG, and am currently doing a project in school for constructing a similar form of PPG device. May I ask what is this component in your circuit that has the operational amplifier and what does it do? Is it a differentiator op amp?

    Thank you and I really look forward to your reply. Your posts have been highly educational and I appreciate your feedback!

    Best regards,
    Davin

    • batchloaf says:

      Hi Davin,

      Sorry for the delay in responding. The chip I’m using here is an LM358, which is a dual opamp (i.e. two opamps in one 8-pin chip). I’m only using one of the two opamps here.
      The opamp is basically working as a normal inverting amplifier. The gain is set to 1000 by the ratio of the 100 Ω and 100 kΩ resistors. I can understand why you might think it looks like a differentiator (and in some sense I suppose it is one) because of the 220 μF capacitor between the TCRT5000 and the 100 Ω resistor. Really though, I think of that more as a d.c. blocking capacitor. You want the amplifier to amplify variations in the sensor voltage, but not the d.c. component which is relatively very large. If the amplifier amplified the d.c. part of the sensor signal, it would immediately saturate and stay in saturation constantly. So actually, I suppose it is a differentiator, but that’s not really how I was picturing it!

      Hopefully that kind of answers your question! If not, let me know and I’ll try to explain more.

      Ted

      • Davin says:

        Hi Ted,

        No worries and thank you so much for getting back to me! Your reply has been a great help in my better understanding of the amplifier’s functionality. Just a one more question: the circuit that runs from 5V source –> 10k ohms –> splits into parallel circuit to 10k ohms and 220 uF –> ground and also 10k ohms before going to the positive terminal of the op amp, what does this circuit do?
        Thank you and I look forward to your update!

        Best regards,
        Davin

      • batchloaf says:

        Hi Davin,

        That part of the circuit is used to generate a clean 1.66 V reference voltage in the circuit. I’ve uploaded a short video explanation here:

        https://youtu.be/bIeBIVDoga8

        Hopefully that answers your question, but if not let me know.

        Ted

  3. Davin Hong says:

    Dear Ted,

    I am very fascinated with your circuit for this PPG, and am currently doing a project in school for constructing a similar form of PPG device. May I ask what is this component in your circuit that has the operational amplifier and what does it do? Is it a differentiator op amp?

    Thank you and I really look forward to your reply. Your posts have been highly educational and I appreciate your feedback!

    Best regards,
    Davin

  4. Mouhamed Zorkot says:

    Hi TEd, do you have the algorithm that allows you to view this data in digital form (example: oximetry (88%, etc.) and heart rate (60bpm)? About blood pressure, transfer or did you use this sensor for capture?

  5. sebastien says:

    Hello Ted, I’m a student and i’m working on your PPG. Your explanation of capacitor and resistors on youtube was a big help; nevertheless I have a problem in reading data from the serial plotter, as you can see on the attached screenshot, I have a sinusoid which does not really look like yours… i has a longer value in abscissa with many parasites, even with the extra 100nf capacitor. I searched for info on the configuration of the serial plotter in vain; should I try with different capacitors? Maybe i could send you a screenshot?
    Thanks for your help, I can’t wait to complete this project!

    • batchloaf says:

      Hi Sebastien,

      I’m not sure what’s wrong with your circuit. You might like to try this alternative (but similar) circuit that I’ve been using more recently:

      BioSlam PPG

      If you want to send screenshots of your serial monitor / serial plotter output, put them online and then post the links here – no guarantee I’ll be able to find the problem, but I’ll take a look. A photo of your circuit would be helpful too.

      Ted

      • berruyer says:

        Ted, your tuto on roboslam is so complete i would be ashamed to make you loose your time. I’ll build it and let you know when i’m done. Bye!
        Sebastien

  6. Rhazouane says:

    hello Ted ,I hope this message finds you well. I wanted to reach out to you as I am currently working as a student on the PPG circuit. I have been trying to replicate the same signal that you obtained in your research, but unfortunately, I haven’t been successful in achieving similar results.
    I followed the circuit design that you had previously used, but despite my efforts, I have not been able to generate the desired signal. I have double-checked the connections and components, but it seems that something is still not quite right.
    I was wondering if you could offer any guidance or suggestions to help me troubleshoot this problem. If there are any specific steps or considerations that I may have overlooked, I would greatly appreciate your insights. Your expertise and experience in this field would be invaluable in helping me overcome this challenge.
    Thank you very much for your time and assistance. I am eager to learn from your expertise and hopeful that together we can identify the issue and find a solution.

  7. batchloaf says:

    Hi Rhazouane.

    I’m using an updated version of the PPG circuit for workshops now. Maybe you could try the updated circuit?

    BioSlam PPG

    It seems to work more consistently and it has an extra feature to automatically charge the large capacitor, which brings the signal into range faster.

    If the new circuit doesn’t work for you, then maybe you could post a clear photograph of your breadboard circuit and I’ll see if I can spot anything out of place?

    Ted

Leave a comment