10
\$\begingroup\$

Given the following DC circuit with a fully discharged capacitor (\$V_c(0) = 0 V\$):

capacitor + LED + resistor

How can I calculate for how long the LED emits light until it "turns off"?

The LED is a red one with a forward voltage of 2.0 V and a forward current of 20 mA. It stops emitting light at 1.6 V. (When powered with my lab power supply directly, the LED conducts a current of 7.5 uA at 1.6 V)

The question leading to an answer might be: How long does it take until the voltage of \$V_c = 7.4 V\$ is dropped by the capacitor (KVL: 9 V - 1.6 V = 7.4 V). $$ t = -RC \ln(1 - V_c/V) $$ ...but R depends also on the resistance of the LED which depends on the changing voltage of the capacitor while that one charges...

Is a (first-order nonlinear?) differential equation needed to calculate this and which equation is it? (As a plus, a derivation of that equation would be very appreciated to be able to understand how to solve these kinds of questions.)


edit -- Here are measurements I have taken to create an I-V curve of the LED if that helps:

V_led   I_led (A)   R_led
1.480   0.0000007   2,114,285.7142857
1.560   0.0000031   503,225.8064516
1.600   0.0000076   210,526.3157895
1.700   0.0000372   45,698.9247312
1.790   0.0010000   1,790.0000000
1.830   0.0020000   915.0000000
1.850   0.0030000   616.6666667
1.870   0.0040000   467.5000000
1.880   0.0050000   376.0000000
1.890   0.0060000   315.0000000
1.895   0.0070000   270.7142857
1.900   0.0080000   237.5000000
1.910   0.0090000   212.2222222
1.920   0.0100000   192.0000000
1.930   0.0110000   175.4545455
1.940   0.0120000   161.6666667
1.945   0.0130000   149.6153846
1.950   0.0140000   139.2857143
1.955   0.0150000   130.3333333
1.960   0.0160000   122.5000000
1.965   0.0170000   115.5882353
1.970   0.0180000   109.4444444
1.980   0.0190000   104.2105263
1.990   0.0200000   99.5000000

edit 2 -- Answers/comments below; answer accepted

I want to thank everyone very much for his/her contribution(s) and invested time! There are very help- and useful, practical, and excellent answers and comments below, especially those by @Transistor, @mkeith, and @rainer-p.

Together, you all have filled up a treasure chest of knowledge here. So my recommendation is that you (who is seeking an answer) take a look at all given answers and comments, read through them, and - if you lack knowledge like me - learn from it!

I was fortunate to be spoilt for choice... As only one answer can be accepted, I have selected @jonk's as it solves my question for equations the most.

\$\endgroup\$
10
  • 3
    \$\begingroup\$ The first order approximation would be to convert the LED to a voltage source of 1.8V and then analyze the circuit to see how long it takes for the current to drop below some threshold. A second way would be to use a more accurate model for the LED that captures it's I/V characteristic. But realistically, the best way will be to simply build and test. Because this type of thing is subject to a lot of fringe effects. \$\endgroup\$
    – user57037
    Commented May 15, 2021 at 18:12
  • 1
    \$\begingroup\$ When I mentioned the I/V curve, I meant to use a diode equation. But you can use the empirical data also. However, a closed form solution will be difficult to produce from the empirical data. A stepwise simulation would be better. I would probably try to do it in an excel spreadsheet. But you can also try using a circuit simulator. The key would be to make sure the LED model is reasonably accurate (by comparing it with your empirical data). \$\endgroup\$
    – user57037
    Commented May 15, 2021 at 18:43
  • 1
    \$\begingroup\$ related questions (not exactly duplicates necessarily) electronics.stackexchange.com/questions/14140/… electronics.stackexchange.com/questions/9510/… \$\endgroup\$
    – user57037
    Commented May 15, 2021 at 18:51
  • 1
    \$\begingroup\$ A 9 V source and 450 ohm resistor imply that the peak current is supposed to be 20 mA. However, the peak current through the LED never will reach 20 mA, because the LED's forward voltage (Vf) is part is the series circuit. Thus, the peak voltage across the resistor is 7 V, not 9 V. This lops off the last five lines of your I-V table. \$\endgroup\$
    – AnalogKid
    Commented May 15, 2021 at 18:54
  • 2
    \$\begingroup\$ This comment section is getting long and will probably get moved to chat. What I would do is read the two questions previously and the wikipedia entry on the shockley diode equation. Download free windows program LTSpice. Learn how to use it to simulate your circuit (transient analysis where you turn on the voltage shortly after simulation starts). Then tweak the diode parameters to make sure the diode behaves very similar to the one you measured. You seem to have a great attitude and philosophy and I salute you for that. \$\endgroup\$
    – user57037
    Commented May 15, 2021 at 18:55

4 Answers 4

7
\$\begingroup\$

You could solve this circuit using KVL or a combination of simultaneous KCL equations. But @Transistor already showed you a better way to visualize the problem: by instead looking at it with the capacitor already charged and then watching it discharge into the remaining circuit rather than watching a discharged capacitor charging up. This does replace your question with a simpler but equivalent one.

I'm going to stick with that approach below.

There are three important model parameters for a forward-biased diode: its series Ohmic resistance \$R_\text{ON}\$, its saturation current \$I_\text{SAT}\$, and its ideality factor \$\eta\$. The Shockley diode equation (which every time I write his name makes me want to add some history because others deserve much they didn't receive), is:

$$I_\text{D}=I_\text{SAT}\cdot\left(\exp\left[\frac{V_\text{D}}{\eta\,V_T}\right]-1\right)$$

(Where \$V_T=\frac{k\,T}{q}\$ and is about 25-26 millivolts at room temperature and where you must keep always in mind also that \$I_\text{SAT}\$ itself is a strong function of temperature -- so strong and so opposed to the direction of \$V_T\$ that its temperature-dependent effects completely reverse what you might imagine from the above equation.)

To include the effects of \$R_\text{ON}\$, we need to add the voltage drop across it, so that:

$$V_\text{D}^{'}=V_\text{D}+I_\text{D}\cdot R_\text{ON}$$

\$V_\text{D}^{'}\$ would be the voltage across the diode that we'd measure with a voltmeter.

Of course, we may as well now add the additional voltage drop caused by your external series resistance, \$R\$, since it's about the same thing. In this case, this voltage will be the capacitor voltage (taking @Transistor's concept to heart):

$$V_\text{C}=V_\text{D}+I_\text{D}\cdot R_\text{ON}+I_\text{D}\cdot R$$

All we've done now is to add in two Ohmic voltage drops, one internal to the diode and one external to it, in order to get the voltage across the capacitor. Let's solve the above for \$V_\text{D}\$ and plug that result back into the Shockley diode equation:

$$I_\text{D}=I_\text{SAT}\cdot\left(\exp\left[\frac{V_\text{C}-I_\text{D}\cdot R_\text{ON}-I_\text{D}\cdot R}{\eta\,V_T}\right]-1\right)$$

There's still a problem with this equation. The diode current, \$I_\text{D}\$, appears in two places. Let's solve it so that it only appears once.

But first, I'd like to define a special variable to represent the effects of the Ohmic parts and the thermal voltage, \$V_T\$, into one place. Doing so will reduce the equation clutter. I'm going to call it the Ohmic thermal current, \$I_{\Omega_T}=\frac{\eta\,V_T}{R_\text{ON}+R}\$. Given that, we have:

$$ \begin{align*} I_\text{D} &= I_{\text{SAT}}\cdot \left(e^{^{\left[\frac{V_\text{C}}{\eta\:V_T}-\frac{I_\text{D}}{I_{\Omega_T}}\right]}}-1\right)\\\\ I_\text{D}+I_{\text{SAT}} &= I_{\text{SAT}}\cdot e^{^{\left[\frac{V_\text{C}}{\eta\:V_T}-\frac{I_\text{D}}{I_{\Omega_T}}\right]}}\\\\ \left(I_\text{D}+I_{\text{SAT}}\right)\cdot e^{^\frac{I_\text{D}}{I_{\Omega_T}}} &= I_{\text{SAT}}\cdot e^{^\frac{V_\text{C}}{\eta\:V_T}}\\\\ \frac{I_\text{D}+I_{\text{SAT}}}{I_{\Omega_T}}\cdot e^{^\frac{I_\text{D}}{I_{\Omega_T}}} &= \frac{I_{\text{SAT}}}{I_{\Omega_T}}\cdot e^{^\frac{V_\text{C}}{\eta\:V_T}}\\\\ \frac{I_\text{D}+I_{\text{SAT}}}{I_{\Omega_T}}\cdot e^{^\frac{I_\text{D}}{I_{\Omega_T}}}\cdot e^{^\frac{I_{\text{SAT}}}{I_{\Omega_T}}} &= \frac{I_{\text{SAT}}}{I_{\Omega_T}}\cdot e^{^\frac{V_\text{C}}{\eta\:V_T}}\cdot e^{^\frac{I_{\text{SAT}}}{I_{\Omega_T}}}\\\\ \frac{I_\text{D}+I_{\text{SAT}}}{I_{\Omega_T}}\cdot e^{^\frac{I_\text{D}+I_{\text{SAT}}}{I_{\Omega_T}}} &= \frac{I_{\text{SAT}}}{I_{\Omega_T}}\cdot e^{^{\left[\frac{V_\text{C}}{\eta\:V_T}-\frac{I_{\text{SAT}}}{I_{\Omega_T}}\right]}}\\\\ \operatorname{LambertW}\left(\frac{I_\text{D}+I_{\text{SAT}}}{I_{\Omega_T}}\cdot e^{^\frac{I_\text{D}+I_{\text{SAT}}}{I_{\Omega_T}}}\right) &= \operatorname{LambertW}\left(\frac{I_{\text{SAT}}}{I_{\Omega_T}}\cdot e^{^{\left[\frac{V_\text{C}}{\eta\:V_T}-\frac{I_{\text{SAT}}}{I_{\Omega_T}}\right]}}\right)\\\\ \frac{I_\text{D}+I_{\text{SAT}}}{I_{\Omega_T}} &= \operatorname{LambertW}\left(\frac{I_{\text{SAT}}}{I_{\Omega_T}}\cdot e^{^{\left[\frac{V_\text{C}}{\eta\:V_T}-\frac{I_{\text{SAT}}}{I_{\Omega_T}}\right]}}\right)\\\\ I_\text{D} &= I_{\Omega_T}\cdot \operatorname{LambertW}\left(\frac{I_{\text{SAT}}}{I_{\Omega_T}}\cdot e^{^{\left[\frac{V_\text{C}}{\eta\:V_T}-\frac{I_{\text{SAT}}}{I_{\Omega_T}}\right]}}\right)-I_{\text{SAT}}\tag{1} \end{align*} $$

Now you have a "simple" equation relating the capacitor voltage to the diode current (which is the same as the series loop current for all devices.)

Since \$I_\text{C}=I_\text{D}=C\cdot\frac{\text{d}\,V_\text{C}}{\text{d}t}\$

You can now rewrite things (keeping in mind the fact the rate of change in capacitor voltage will be negative for positive currents) as:

$$ \begin{align*} -C\cdot\frac{\text{d}\,V_\text{C}}{\text{d}t} &= I_{\Omega_T}\cdot \operatorname{LambertW}\left(\frac{I_{\text{SAT}}}{I_{\Omega_T}}\cdot e^{^{\left[\frac{V_\text{C}}{\eta\:V_T}-\frac{I_{\text{SAT}}}{I_{\Omega_T}}\right]}}\right)-I_{\text{SAT}}\\\\ -\frac{\text{d}\,V_\text{C}}{\text{d}t} &= \frac{I_{\Omega_T}}{C}\cdot \operatorname{LambertW}\left(\frac{I_{\text{SAT}}}{I_{\Omega_T}}\cdot e^{^{\left[\frac{V_\text{C}}{\eta\:V_T}-\frac{I_{\text{SAT}}}{I_{\Omega_T}}\right]}}\right)-\frac{I_{\text{SAT}}}{C}\\\\ \frac{\text{d}\,V_\text{C}}{\text{d}t} &= \frac{I_{\text{SAT}}}{C}-\frac{I_{\Omega_T}}{C}\cdot \operatorname{LambertW}\left(\frac{I_{\text{SAT}}}{I_{\Omega_T}}\cdot e^{^{\left[\frac{V_\text{C}}{\eta\:V_T}-\frac{I_{\text{SAT}}}{I_{\Omega_T}}\right]}}\right)\tag{2} \end{align*} $$

Now you have an equation that tells you the rate of change in the capacitor voltage as a function of the capacitor voltage (eq. 2) and also the circuit current (eq. 1) at that moment! Between the two, you can iterate using tiny time steps to realize the diode current as a function of time. Or you could work on performing the integral indicated in eq. 2 to see if you could work out a closed function of time for the current.

But that's about as far as I want to go. Hopefully, it shows you both the complexity of the question as well as introducing the concept of the LambertW function in providing closed equation forms.

And now you know why engineers use reasoned methods for approximation. (Of course, that's the exact opposite of what a pure mathematician would do! They'd go for the solution and see if it lights up some new area of math for others! And they would not care in the least if any of it had practical significance. There's a big difference between the two types, in that regard.) For me, I just enjoy introducing the LambertW function to people. I think it doesn't get enough press.

\$\endgroup\$
10
\$\begingroup\$

I think simulation is going to be the best approach here. Please read these questions which have information about simulating LED's using the Schockley diode equation.

LED modeling with Shockley diode equation

How do I model an LED with SPICE?

The circuit editor on this website also has a simulator. I have added below a schematic that can be a starting point for the simulation you want to do. You will want to do a time domain or transient analysis. There are other free simulators (such as LTSpice).

I have used the default LED component. But if you open the circuit up in the circuit editor, you can change the LED parameters and then run the simulation. You seem pretty smart and I am hoping this is enough information for you. To go much farther I would have to just about take on the problem 100 percent myself and I hesitate to do that because of the time investment.

schematic

simulate this circuit – Schematic created using CircuitLab

V1 is a step voltage. I edited it to set the step to 9V. This means that at time of 0 seconds, the voltage transitions from 0 to 9V. This is akin to your circuit where you said that the capacitor was initially discharged.

\$\endgroup\$
5
  • \$\begingroup\$ Thank you for accepting my answer. Usually it is a good idea to wait for a bit to accept an answer. You may want to unaccept it to see if anything better comes along. You can also change the accepted answer. \$\endgroup\$
    – user57037
    Commented May 15, 2021 at 19:15
  • 1
    \$\begingroup\$ Ok, than I will follow your advice again, unaccept it, and wait a bit. Sorry. \$\endgroup\$
    – seven
    Commented May 15, 2021 at 19:35
  • 1
    \$\begingroup\$ @seven If you wanted, I could write up a closed equation. But do you really want the math for that? The simplest 1st order equation for an LED has a forward voltage (for example 1.6 V) and a resistance (say 20 Ohms) as a model. At 20 mA, that yields an LED voltage of 2 V, for example. That model can be easily used with algebra to work out the details without iteration. But then it is way too simple, really. But a closed equation would involve LambertW() function. Not sure you care to go there. \$\endgroup\$
    – jonk
    Commented May 15, 2021 at 23:17
  • \$\begingroup\$ Thank you very much for your offer, @jonk. I am still curious how to do such a precise calculation and to discover what math I have to learn for that ;). So if it is not too much of a time investment for you, I really would be happy to get to know the closed equation or further hints to it (like the - for me new - LambertW() function). I have also just found the paper Verifying the diode–capacitor circuit voltage decay by Edward H. Hellen which might lead me to a next step... \$\endgroup\$
    – seven
    Commented May 16, 2021 at 16:44
  • \$\begingroup\$ @seven Done. I used @ Transistor's approach. Hopefully, it is at least 'fun' to read through. Best wishes! \$\endgroup\$
    – jonk
    Commented May 16, 2021 at 18:26
5
\$\begingroup\$

If it's any help you can use the CircuitLab simulator.

schematic

simulate this circuit – Schematic created using CircuitLab

Figure 1. A simulation circuit using a time-delay switch for initiation.

enter image description here

Figure 2. Simulation results.

You have to decide at what current the LED is "off".

\$\endgroup\$
5
  • \$\begingroup\$ C1 should be in series with R1 and D1 to match the OP's circuit. \$\endgroup\$
    – user57037
    Commented May 15, 2021 at 19:23
  • \$\begingroup\$ @mkeith: It's the same thing. When the OP connects the battery s/he'll give the capacitor a kick to +9 V. \$\endgroup\$
    – Transistor
    Commented May 15, 2021 at 19:27
  • \$\begingroup\$ Thank you very much for your answer and invested time! As a beginner I guess this is meant to give an example of a capacitor-LED-simulation, correct? Because in my case the capacitor is (unusually) in series with the LED and resistor, not in parallel. But I will take a look on that also :). \$\endgroup\$
    – seven
    Commented May 15, 2021 at 19:28
  • 2
    \$\begingroup\$ Your circuit will charge both sides of the capacitor to +9 V when you connect the battery and then the bottom plate will discharge through the R-LED circuit leaving the capacitor charged to 9 V. My circuit starts with the capacitor charged and when the battery is disconnected the capacitor discharges. The result is the same except that mine starts with the LED on until the switch opens. \$\endgroup\$
    – Transistor
    Commented May 15, 2021 at 19:31
  • \$\begingroup\$ I see it now. The DC operating point at time less than T=0 doesn't match with what I was envisioning. But for T>0 it is the same as what I had in mind. Another way to say it is that for T>0, the capacitor is actually in series with the LED and resistor. The fact that it is discharging rather than charging doesn't affect the diode current and forward voltage. \$\endgroup\$
    – user57037
    Commented May 15, 2021 at 19:44
5
\$\begingroup\$

You can easily analyse this circuit by hand, no need to simulate anything.

  1. The battery has 9V and the LED has a forward voltage of 2V, which leaves 7V to charge the capacitor through the 450Ω resistor.

  2. The capacitor is initially empty, so the entire 7V drop across the resistor. This results in a current of 15mA according to Ohm's law.

  3. The time constant of the resistor and capacitor is 0.45 seconds (=1mF*450Ω). After one time constant, the current has dropped to 1/e (=37%) of the initial current. After two time contants, the current has dropped to 1/e² (=14%). After three time constants, the current has dropped to 1/e³ (=5%).

With a LED that stops emitting useful light when the current drops below 7.5μA, this point will be reached after 7.6 time constants or 3.4 seconds.

The key simplification that makes such a simple calculation possible is to treat the diode forward voltage as constant, so that it drops the effective capacitor charge voltage from 9V to 7V but has otherwise no effect on charge current. The calculations presented in this answers (15mA at start, 5.5mA after 0.45s, 2mA after 0.9s, 7.5μA after 3.4s) show good agreement with the simulation results provided in other answers.

You can make the calculation even more accurate if you model the diode with a 1.6V forward voltage and a 20Ω series resistance. This takes care of the effect that forward voltage rises from 1.6V with no current to 2V at 20mA. For analysis, you then have a 1.6V diode and 470Ω resistor instead of a 2V diode and 450Ω resistor, but otherwise the calculation is the same.

\$\endgroup\$
2
  • \$\begingroup\$ Thank you also very much, @rainer-p! Before posting my question, I was considering this way of solution, too. I thought it would be wrong to consider the current drop in this case because the voltage on the capacitor drops first to a value that prevents the LED from conducting any further: I have assumed that my LED stops conducting current at 1.45 V. Hence, I thought at 5 tau, \$V_c\$ is almost 7.55 V. So a \$V_c\$ of 7.4 V (98.013 %) is reached at less than 4 tau (98.126 %). 4 tau would be 1.8 s, meaning that the LED does not emit "visible" light after 1.8 s. But I might be wrong... \$\endgroup\$
    – seven
    Commented May 16, 2021 at 21:31
  • \$\begingroup\$ Voltage across the capacitor stops rising the moment the diode stops conducting, so we never reach the point where the current stops entirely. Forward voltage drops from 1.95V at 15mA to 1.6V at 7.5μA and we don't care what happens afterwards. The drop from 1.95V to 1.8V happens early, while the voltage across the resistor is still high, so it's only the drop from 1.8V to 1.6V that matters. Effectively, the charge voltage receives a "boost" of 0.2V late in the game, which increases charge current and keeps the diode lit for somewhat longer than calculated. (@seven) \$\endgroup\$
    – Rainer P.
    Commented May 17, 2021 at 6:53

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.