Introduction: LED Pulse Sensor (PPG) for Arduino
Within this Instructable i will show you, how to implement a simple PPG (photoplethysmogram) sensor for arduino. This device uses infrared light to measure you pulse. You may know this technique from the fingertip pulse sensors in hospitals.
This techniques gets more and more important again in wearables like the apple watch theses days.
The board i developed uses one wavelenghts to measure the pulse and within this, the measurement is used to control the LED brightness (which is important vor varying skin colors). The board can be powered by arduino or by its own voltage source. Three LEDs are controllable by the Arduinos digital outputs, for instance to show the pulse waves signal amplitude by software.
Step 1: Theoretics in PPG Technology
When the blood is pumped through the body the pressure and consequentially the diameters of the vessels change. If the emitter and detector, both working by a wavelengths which can pass the skin, are placed at a pulsating vessel, the path length of the light will periodically increase and decrease. This has the effect that also the absorption alternates. Due to simplification the emitter and detector are placed at the same side. Therefore, this method is based on reflection of the emitted light.
Next to the absorption of the blood cells, their flow behavior has an important role. The shown image indicates, that the blood cells move in a direction which are aligned orthogonal to the flow direction, when high flows are appearing. This is the case for the systolic phase. With this behavior, the reflective area of the blood cells de- and increase during the systolic and diastolic phase, which leads to an changing intensity of the reflected light.
The second image indicates that hemoglobin has different absorptions for infrared light, dependend on its oxygen load. This effects summed up are used to get a different signal amplitude of the reflected light if a pulse is measured. Welcome to the world of photoplethysmograms!
The Signal one can get from such a device consists out of a DC part (skin/bone reflection, venous blood absorption, constant arterial blood absorption) and the wanted AC part (variable arterial bloor absorption).
The second image is taken from this side:
Step 2: Basic Circuit
I think is is clear that the circuit consists out of the following things:
LED + driver circuit
Photodiode, to catch and measure the reflected light
something to filter and amplify the measured signals
In this case is is smart to control the circuit by varying the LED brightness. Imagine you measure on a very bright skin, so the LED doesnt need to shine as bright as it can, because that would add DC signals to our wanted one. Therefore the LED has to be driven by a current X. Now one wants to measure on Person B with a darker skin color, the LED has to be brighter, because its harder to get deep enough into the skin. The LED has to be driven by current B. The current must be controlled in a smart way.
The LED driver + controller are therefore the hardest thing to get in this instructable - basic knowledge in electronics are preferable from now on.
The since the controller circuit will output a voltage level and the LED is driven with current we need a converter:
the so called voltage driven current source, shown in the second picture. This one should be well known and is shown in image 2. In this case, the current through the LED is defined by the OpAmps input voltage divided by the 10 OHMs resistor.
The setpoint for my controller is an output from my measured signal. The signal is measured by a photodiode, which is from an electrical point of view a current source. The voltage will be converted to a voltage by a current driven voltage source - or transimpedance amplifier - which should also be well known. The output voltage is defined by the resistor times the imput current.
The DC part of this signal is the setpoint for the controller, because it represents the reflexion of the skin and therefore the skin color. The DC part is cleared from its AC part by a capacitor and is fed into the controller circuit.
If there is a need of controlling something, there are several ways to implement a controller.
Those depend always on the kind of circuit and the kind and speed of the signals. In a circuit like this, where no deviation after controlling is allowed and the controlling must be very quick, a controller consisting of P-, I- and D-parts is common. One can very roughly say, that the D part serves the speed for hard changes, then the P part serves big changes for large deviations as well and the I part will lead to a perfect fitting onto the wanted value. The step response of a controller like this will look like shown below.
The build up of this circuit with discrete analog electronics parts is illustrated in the 4. picture. Its
aim is to control between the measured values and the set values and thus hold the wanted signals always on the same level independent from the different patients. The control sequence is defined to be a PID-control circuit.
The last part of the electronics is to amplify the signal by a high factor like 100 and filter it. The filtering is necessary, because especially with this type of measurement one can have several noises like gas-discharge lamps, which send noises of 100Hz to the photodiode, This is done by a standard opamp circuit of two resistors and a capacitor. Since is sources everything with my arduino, the circuit works with 5Vs single supply. The baseline is at 2.5 volts and i create this with a simple Z diode (2.3V) in a voltage divider configuration. This is also a standard ciruit for creating a proper reference (look for stabilize voltages with zener diodes --> http://www.elektronik-kompendium.de/sites/slt/1012151.htm, german).
The simulation of this developed circuit is shown in the last pic.
The pulsed ”DC” signal, which represents abrupt varying skin colors, has to be adjusted by the controller. This circuit simply measures the varying DC current as a DC voltage and feeds that voltage in a proper size (made by amplification) into the voltage driven current source. The varying DC current from the photo diode is shown as current I(I3) in the first graph. This current is translated to a voltage signal by the circuitry (second graph). The pulse signal is slightly visible on the varying DC part. The output of the controller is shown as V(n001). After giving this voltage onto the LED driver, the current through the LED changes (I(D1)). One can see, that there is no big time difference between the change of DC current and the change of LED current, which is obviously really good for controlling purpose
Because current and brightness behave nearly linear at LEDs, like it is shown in annex A,
the LED will in- and decrease its brightness. The last graph shows the output signal before decoupling from the DC part. One can see, that the controller still needs some time to handle the DC variations. This can be seen by the high peaks the decreasing amplitude onto the base line. The pulse signal is clearly visible.
Step 3: PCB Development
For this purpose i ordered my PCB in china. They do really good work in manufacturing pcbs for a good price.
One has to pay attention that the PCB will fit onto the arduino and to connect the right pins. I also implemented an ADC with 22bit, controllable by TWI (I2C) to measure the signal with a high accuray by my arduino. Additionally i implemented 2 buttons and 3 LEDs, which are all connected to the digitals IO pins.
This will be helpfull if i write a code and want the device to do someting, like showing the amplitude or frequency by a blinking LED.
Step 4: Finished Device
The finished device looks like its shown above. The LED and the diode for emitting the light and measuring the reflected signal are placed on a small perfboard to hold it easier in the hand (or where-ever you want to measure the pulse).
Step 5: Test in Hard- and Software With Arduino
The images show what happens internally in the device. The controller starts to control the voltage level, if a finger is placed on the actual sensor element. This is done by reaching a stable voltage level. One can see this on the second picture. The pulse is also clearly visible!
What happens inside:
The signal is measured by the analog pins from the arduino. The voltage level is transferred into a 10bit value. I set a threshold for the three LEDs, to show the amplitude of the actual signal. Therefore a small signal causes one LED to blink, while a strong one will cause all three LEDs to blink with each pulse.
One can now play with the high resolution ADC, or the buttons. There is a plenty of stuff one can do with this board and an arduino and it is so much fun to play with his own biosignals!
hope you liked my short instructable. I did not implement the actual circuit, but it will follow maybe in the next few days. Please give me feedback if you liked/disliked this instructable!