4
\$\begingroup\$

My lab partner and I are building a pulse oximeter for our capstone project and could use some help.

I have an ELM-4002 which is a bipolar LED with the following specifications. The two LEDs are labeled RD for 660nm and IR for 940nm. The two forward typical voltages V_RD = 1.85V and V_IR = 1.2V. The forward current is 20mA for both.

enter image description here

The ELM-4002 has two LEDs in anti-parallel. It has three pins, but both LEDs are only connected to the same two pins.

I am using an RP2040 microcontroller which on page 261 states the maximum current output is 12mA at 3.3V logic.

I have a couple of questions about the design.

The first is how to generate a bipolar signal that is not symmetric about the x-axis. Imagine a square wave going 1.85V to -1.2V.

The second is whether I should use some kind of driver to supply the necessary current.

The third is whether or not I should be pulsing a given LED during its on time which is a suggestion my professor made but I have not seen this used in other papers on the internet so far.

Has anyone else here made a pulse oximeter? If so, I need all the advice I can get, especialy about how to drive a bipolar LED. Does anyone know some good literature I can read on the topic?

https://datasheets.raspberrypi.org/rp2040/rp2040-datasheet.pdf

https://www.te.com/commerce/DocumentDelivery/DDEController?Action=srchrtrv&DocNm=ELM-4000-Series&DocType=DS&DocLang=English

\$\endgroup\$
14
  • 3
    \$\begingroup\$ The different voltages don't matter; drive it from a current source. (Either reversible, or via an H-bridge) \$\endgroup\$
    – user16324
    Commented Sep 20, 2021 at 20:34
  • 4
    \$\begingroup\$ Just so you know, a wether is a castrated goat or sheep. Weather is the local atmospheric conditions, such as rain and wind. Flocks everywhere may be more concerned about the distinction than you, but be assured that, in engineering, exactness is needed ;) \$\endgroup\$ Commented Sep 20, 2021 at 20:47
  • 1
    \$\begingroup\$ It sounds like you want someone to design your capstone project for you, or at least do all of the research for you. I suggest that you try to answer some of these questions yourself and only as a specific question. \$\endgroup\$ Commented Sep 20, 2021 at 20:51
  • 2
    \$\begingroup\$ PO machines need a fair bit of black magic to work well. Anything you can do to make the drive precise and consistent is liable to help. You could use simple resistor drive to limit current or two resistors and two diodes to get different drive for each. But the ability to control current well in each direction may prove useful. This would take a few cheap opamps. You could also consider PWM with RC filtering to allow variable drive but probably not needed. \$\endgroup\$
    – Russell McMahon
    Commented Sep 21, 2021 at 0:35
  • 1
    \$\begingroup\$ @jonk interest only. POx is an inexact science. HP journal long ago went into some detail. Results in eg US and Andes at altitude differ among vendors. Minimising magic by having stable and repeatable led currents is a good first step. Your bridge driver is a good idea. \$\endgroup\$
    – Russell McMahon
    Commented Sep 21, 2021 at 7:55

3 Answers 3

8
\$\begingroup\$

tl, dr: you either need a buffer that has really low Rds(on) to ensure that your series resistor is the only thing (or at least, the dominant thing) setting your current, or you need to sense the current and regulate it. That's easy enough, as you'll see below.

Also, to set the current in each direction you'll also need to steer the current so that each LED's forward drop is dealt with separately. That's not too hard either.

To address your second question about needing a buffer (yes, you need one), let's talk about the Rpi GPIO drive for a moment. Its datasheet specification only guarantees a max/min Voh/Vol at the rated current, not that it will deliver a specific current to a specific load.

What actually sets the Voh/Vol value is the internal resistance of the driver, Rds(on). Broadcom won't tell you that Rds(on) value, but you can figure it out by looking at Voh/Vol values at the rated current. Let's do that, using their '12mA' setting (3.3V I/O):

  • '12mA' drive @Voh 2.62V, Rds(on) max = (3.3 - 2.62V) / 12mA =< 56.7 ohms
  • '12mA' drive @Vol 0.5V, Rds(on) max = 0.5V / 12mA =< 41.7 ohms

Note that these are the maximum Rds(on) values. Rds(on) can be (and often is) much lower than that, to allow for process margin. Even with a lower Rds(on), its magnitude is comparable to the load resistance you're contemplating (60 ~ 100 ohms or so) for your LEDs. And it gets even worse if you want to use 'pulse overdrive' with higher current (more below.)

All that aside, because we want to steer the current and also to turn it on and off at each LED, we'll need at least 2 GPIOs for control, buffers or not.

So, what about those buffers then? FETs are available that have much stronger drive than the Rpi's GPIOs, with Rds(on) in the single digits range.

First idea: Cheap-and-cheerful, two FETs and two resistors. Easy to build, it'll be fairly accurate but somewhat inefficient (simulate it here):

enter image description here

Design Notes:

  • Use 1% resistors
  • Use BSS138 FETs or similar. BSS138 has Rds(on) about < 2.5 ohms or less at Vgs > 3V
  • You could also use 2N3904 or 2N2222 type NPN bipolar, if you compensate for Vce(sat) with the resistors.

This circuit gives reasonable accuracy by using 1% dropping resistors and FETs with Rds(on) low enough that they aren't a significant contributor to the load resistance. Nevertheless it is still sensitive to LED Vf variation and power supply fluctuation.

Second idea: If you want better repeatability you have to compensate for Vf variance and the power supply. Here's a design that can do that (simulate it here):

enter image description here

This would be a more production-worthy circuit. It senses the LED current and sets it precisely vs. a local reference. The switch is a dual analog type, the LVC2G66. The current sense feedback compensates for the switch 'on' resistance, up to 20 ohms for this switch.

Design Notes:

  • The op-amp type is a low-voltage, rail-to-rail version of the LM324 (LMV32xx). It has enough output current to do the job on its own.
  • More-common op-amps could be used if VDD were 5V or more.
  • The voltage divider at left can be adjusted to change the current.

A possible upgrade would be a precision reference instead of the voltage divider; it probably isn't needed if the static 3.3V can be calibrated out at start-up.

Third idea: A possible upgrade that your professor hinted at is to use a pulsed LED current. We can go a step further and use a higher 'pulsed overdrive' to get even better illumination and efficiency. LEDs can accommodate overdrive so long as the average power is within the datasheet spec. (example: 40mA at 50% duty, 60mA at 33% duty, etc.)

We start with the current-sensing design and beef it up with lower Rds(on) switches and an external pass transistor for the op-amp. Here's an example that's set up for about 60mA (simulate it here):

enter image description here

You'd run this at no more than a 33% duty cycle (I suggest 25% to reduce power) to keep the LED power within the 20mA steady-state spec. Caution: mind the default GPIO state to make sure you don't burn the LEDs. Bonus: the external pass transistor allows using the plain old LM324 op-amp, so it might be easier to build.

Fourth idea: Finally, this Maxim Integrated appnote may be of interest to you: https://www.maximintegrated.com/en/design/technical-documents/tutorials/4/4671.html

\$\endgroup\$
6
  • \$\begingroup\$ The RPi will easily support 20 mA according to the datasheet. There are other rules for the total current flow in I/O pins, but they are unlikely to be of concern in this application. \$\endgroup\$ Commented Sep 20, 2021 at 21:44
  • \$\begingroup\$ Not with a reliable Voh/ Vol. That's why I suggest using a buffers instead. \$\endgroup\$ Commented Sep 20, 2021 at 23:09
  • \$\begingroup\$ Having a huge MCU and then having to add buffers seems quite unnecessary. Your design also has no OFF state for both diodes, so won't work in this application. Your design always has one diode ON. I'm guessing you'd add more gates. \$\endgroup\$ Commented Sep 20, 2021 at 23:41
  • \$\begingroup\$ See “If you want on/off control, use 2 GPIOs, one for each side.” in the design notes. No gate needed. I wanted to illustrate the concept first. Really, I believe that they could do it without any steering and just use 1 resistor if they calibrate. \$\endgroup\$ Commented Sep 20, 2021 at 23:47
  • 2
    \$\begingroup\$ @jack creasey hugeness of CPU and hugeness if drive are often enough somewhat orthogonal . \$\endgroup\$
    – Russell McMahon
    Commented Sep 21, 2021 at 2:36
4
\$\begingroup\$

How to Drive a Bi-Polar LED Having 2 Different Forward Voltages

Given you are using an MCU with lots of I/O pins I'd suggest the following:

schematic

simulate this circuit – Schematic created using CircuitLab

  1. Set I/O strength to 12mA
  2. set the required current using 1:3 upper and lower drivers
  3. Set pins to low output or as inputs when LEDs are off

It's up to you to decide how much current you require in the LEDs and what their ON duty cycle is.

Although you did refer to the datasheets for the RP2040 you should also read around page 636. The RP2040 is capable of sourcing and sinking more than 20 mA, though it is complex rules. Look at the source/sink capability in Figure 169. When the output strength is set to 12mA, you can easily source/sink 20 mA. It's up to you to decide if you want to do that, but you can easily distribute the current over two or three outputs with more predictable results.

Here is the output capability of the RP2040 I/O pins:

enter image description here

This might help you understand the ratiometric sensing required in the application. The absolute current for each LED is not required to be very accurate, just relatively stable over several heartbeats.

\$\endgroup\$
10
  • 2
    \$\begingroup\$ An issue OP faces is having predictable intensity through each LED as they're differentially measuring IR vs. red absorption to calculate PO2. Using a strong external buffer with good Voh/Vol will help ensure consistent current through the dropping resistors. The LED currents don't actually have to be equal - that could be calibrated out - but they do have to be consistent. \$\endgroup\$ Commented Sep 20, 2021 at 22:52
  • \$\begingroup\$ @hacktastical If you look at the RP2040 datasheet they give the curves for the source/sink capability. If the OP sets 12 mA strength then output droop will be low ...if as I show they use more than one output to drive Hi and Lo, the output droop will be even less. Your drive (through yet another diode) shown in your answer would be very much more unpredictable given the Vf slope of the BAT 54. \$\endgroup\$ Commented Sep 20, 2021 at 23:22
  • 1
    \$\begingroup\$ Digital I/Os only guarantee the acceptable Voh/Vol for a given drive (that is, the implied Rds(on) is some max value.) Actual GPIO Rds(on) can vary quite a lot. Using a 'gorilla' external driver overcomes that as its Rds(on) is a much smaller percentage of the load. \$\endgroup\$ Commented Sep 20, 2021 at 23:30
  • \$\begingroup\$ @hacktastical as per the graphs, driving with 3 I/Os to allow control of the current means the I/O current is quite low. IMO a much better way to control the ELM=4002 .......but we can agree to disagree. Having to add a buffer seems like massive overkill for a device design that is probably very minimal. \$\endgroup\$ Commented Sep 20, 2021 at 23:39
  • \$\begingroup\$ Note the weasel-word 'typical' on those graphs. You cannot count on that, and there's no way you could get Broadcom (let alone TSMC, their fab) to guarantee it. In contrast, the SpO2 measurement technique senses absorption of IR vs. red and compares them: it's a type of spectrophotometer. So it's subject to the overall current transfer ratio from LED to pickup, which is why the LED drive needs to be repeatable, stable and known. \$\endgroup\$ Commented Sep 23, 2021 at 22:54
3
\$\begingroup\$

Maybe you're in a bit over your head with analog design. The PD transimpedance amplifier is also going to be a challenge.

You can buy an integrated pulse oximeter analog front end (AFE) from TI, for example. AFE4403.

The IC contains an H-bridge driver and 8-bit independent constant-current settings for each of the two LEDs.

enter image description here

The IC comes in a rather inconvenient package for prototyping- a tiny 3mm x 3mm 36-ball BGA, so you might want to look for a breakout or evaluation board.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.