# A problem for people who love math \[calculating component values in an electrical circuit\]

**URL:** <https://boards.straightdope.com/t/a-problem-for-people-who-love-math-calculating-component-values-in-an-electrical-circuit/1011766>\
**Category:** Factual Questions\
**Created:** [December 17, 2024, 7:40pm UTC](https://boards.straightdope.com/t/a-problem-for-people-who-love-math-calculating-component-values-in-an-electrical-circuit/1011766 "2024-12-17T19:40:23Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![beowulff](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/beowulff/32/542_2.png) [@beowulff](https://boards.straightdope.com/u/beowulff)\
**Post date:** [December 17, 2024, 7:40pm UTC](https://boards.straightdope.com/t/a-problem-for-people-who-love-math-calculating-component-values-in-an-electrical-circuit/1011766/1 "2024-12-17T19:40:23Z")

</div>

I am designing a circuit that requires a resistance value to be calculated (or measured).  
Measuring it would be pretty simple, but I would like to know if the value can be calculated.

Given an 60Hz AC input at 480v, charging a capacitor of value C, through resistance R, how long does it take to develop voltage V across the capacitor, starting at 0 volts (for both the initial voltage across the capacitor, and the AC supply voltage.

If this was DC, it would be simple:  
VC= Vs (1 -e(t/RC))

But - this is not DC - it’s an AC sinusoidal waveform, so the voltage across the RC circuit is always changing. My math skills were never that great, and this looks like a job for an Integral, which is more than I have in me right now.

Anyone want to give it a shot?

---

<div class="post-metadata">

**Author:** ![Crafter\_Man](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/crafter_man/32/458_2.png) [@Crafter\_Man](https://boards.straightdope.com/u/Crafter_Man)\
**Post date:** [December 17, 2024, 7:43pm UTC](https://boards.straightdope.com/t/a-problem-for-people-who-love-math-calculating-component-values-in-an-electrical-circuit/1011766/2 "2024-12-17T19:43:00Z")

</div>

My first thought is to measure the phase angle between the voltage and current, or the power factor. From this, and knowing the value of the capacitor, you should be able to back-calculate the value of the resistor.

---

<div class="post-metadata">

**Author:** ![Seanette](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/seanette/32/9139_2.png) [@Seanette](https://boards.straightdope.com/u/Seanette)\
**Post date:** [December 17, 2024, 7:44pm UTC](https://boards.straightdope.com/t/a-problem-for-people-who-love-math-calculating-component-values-in-an-electrical-circuit/1011766/3 "2024-12-17T19:44:08Z")

</div>

Hey, @Bob_Blaylock, this one should be easy for you, being an electrician with an associate’s in electronics. 🙂

---

<div class="post-metadata">

**Author:** ![beowulff](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/beowulff/32/542_2.png) [@beowulff](https://boards.straightdope.com/u/beowulff)\
**Post date:** [December 17, 2024, 7:45pm UTC](https://boards.straightdope.com/t/a-problem-for-people-who-love-math-calculating-component-values-in-an-electrical-circuit/1011766/4 "2024-12-17T19:45:58Z")

</div>

One thing that might not be clear:  
I’m only interested in 1/2 of the wave. Let’s just consider the positive half for now.  
The circuit will use both polarities, but they should be symmetrical, so it can be assumed that the capacitor always starts at 0 volts when the input voltage is also 0.

---

<div class="post-metadata">

**Author:** ![Dr.Strangelove](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/dr.strangelove/32/6613_2.png) [@Dr.Strangelove](https://boards.straightdope.com/u/Dr.Strangelove)\
**Post date:** [December 17, 2024, 7:54pm UTC](https://boards.straightdope.com/t/a-problem-for-people-who-love-math-calculating-component-values-in-an-electrical-circuit/1011766/5 "2024-12-17T19:54:24Z")

</div>

Seems like a pretty tricky differential equation to me. There’s no guarantee the capacitor will reach any particular state of charge at all, since it will discharge when the voltage starts going down and then into the negative.

Also, I don’t think it’s true that the capacitor will be at zero when the voltage is zero. There will be a phase shift on the capacitor voltage.

---

<div class="post-metadata">

**Author:** ![Pleonast](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/pleonast/32/1183_2.png) [@Pleonast](https://boards.straightdope.com/u/Pleonast)\
**Post date:** [December 17, 2024, 7:57pm UTC](https://boards.straightdope.com/t/a-problem-for-people-who-love-math-calculating-component-values-in-an-electrical-circuit/1011766/6 "2024-12-17T19:57:53Z")

</div>

> [@beowulff](#):
>
> The circuit will use both polarities, but they should be symmetrical, so it can be assumed that the capacitor always starts at 0 volts when the input voltage is also 0.

It’s not clear to me that this is true. I’d expect there to be a phase difference, which means they cross zero at different times.

I’d used to be able to solve this sort of equation in my sleep. It’s basically “guess” a sine wave and check that it satisfies the differential equation.

(Ninja’d.)

---

<div class="post-metadata">

**Author:** ![beowulff](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/beowulff/32/542_2.png) [@beowulff](https://boards.straightdope.com/u/beowulff)\
**Post date:** [December 17, 2024, 7:57pm UTC](https://boards.straightdope.com/t/a-problem-for-people-who-love-math-calculating-component-values-in-an-electrical-circuit/1011766/7 "2024-12-17T19:57:58Z")

</div>

The capacitor gets discharged when it reaches voltage V, and stays shorted until the input voltage goes to 0 (or close to it). For this application, a few volts (instead of 0) on the capacitor are OK.

---

<div class="post-metadata">

**Author:** ![engineer\_comp\_geek](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/engineer_comp_geek/32/504_2.png) [@engineer\_comp\_geek](https://boards.straightdope.com/u/engineer_comp_geek)\
**Post date:** [December 17, 2024, 7:58pm UTC](https://boards.straightdope.com/t/a-problem-for-people-who-love-math-calculating-component-values-in-an-electrical-circuit/1011766/8 "2024-12-17T19:58:49Z")

</div>

**Moderator Note**

I have updated the title to more clearly indicate the topic. Please use descriptive titles.

---

<div class="post-metadata">

**Author:** ![Pleonast](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/pleonast/32/1183_2.png) [@Pleonast](https://boards.straightdope.com/u/Pleonast)\
**Post date:** [December 17, 2024, 8:00pm UTC](https://boards.straightdope.com/t/a-problem-for-people-who-love-math-calculating-component-values-in-an-electrical-circuit/1011766/9 "2024-12-17T20:00:23Z")

</div>

> [@beowulff](#):
>
> The capacitor gets discharged when it reaches voltage V, and stays shorted until the input voltage goes to 0 (or close to it)

I’m now at a loss of what your circuit actually is. What’s shorting the capacitor?

---

<div class="post-metadata">

**Author:** ![Crafter\_Man](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/crafter_man/32/458_2.png) [@Crafter\_Man](https://boards.straightdope.com/u/Crafter_Man)\
**Post date:** [December 17, 2024, 8:09pm UTC](https://boards.straightdope.com/t/a-problem-for-people-who-love-math-calculating-component-values-in-an-electrical-circuit/1011766/10 "2024-12-17T20:09:47Z")

</div>

Well, if my math is correct, then

R = -1/(2 π f C tan(φ)), where

φ = phase angle of voltage - phase angle of current  
C = capacitance of capacitor (F)  
f = frequency (Hz)

---

<div class="post-metadata">

**Author:** ![beowulff](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/beowulff/32/542_2.png) [@beowulff](https://boards.straightdope.com/u/beowulff)\
**Post date:** [December 17, 2024, 8:18pm UTC](https://boards.straightdope.com/t/a-problem-for-people-who-love-math-calculating-component-values-in-an-electrical-circuit/1011766/11 "2024-12-17T20:18:06Z")

</div>

A DIAC or SIDAC.

---

<div class="post-metadata">

**Author:** ![N9IWP](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/n9iwp/32/3154_2.png) [@N9IWP](https://boards.straightdope.com/u/N9IWP)\
**Post date:** [December 17, 2024, 9:26pm UTC](https://boards.straightdope.com/t/a-problem-for-people-who-love-math-calculating-component-values-in-an-electrical-circuit/1011766/12 "2024-12-17T21:26:12Z")

</div>

I don’t think we need the instantaneous voltage across the cap.  
The impedance is 1\over j \omega C where \omega = 2\pi f  
So given a known f (60 Hz), and a known C, the impedance is known.  
Then (guessing the cap and resistor are in series) measure the RMS voltage across one and from there you can calculate R.

> **[Voltage Divider Resistor Calculator](https://www.learningaboutelectronics.com/Articles/Voltage-divider-resistor-calculator.php)**
>
> This is an online calculator which calculates
> the resistor value, R2, of a voltage divider circuit.

Brian

---

<div class="post-metadata">

**Author:** ![beowulff](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/beowulff/32/542_2.png) [@beowulff](https://boards.straightdope.com/u/beowulff)\
**Post date:** [December 17, 2024, 9:53pm UTC](https://boards.straightdope.com/t/a-problem-for-people-who-love-math-calculating-component-values-in-an-electrical-circuit/1011766/13 "2024-12-17T21:53:57Z")

</div>

No, that won’t work.  
This is not a classic phase-shift circuit.  
The easiest way to think about this is a half-sinusoid charging a capacitor C through resistance R.  
The voltage across the RC starts at 0 at t = 0, and then sinusoidally rises to 340V at t = 4.17mS, then starts to fall, reaching 0 at t = 8.33mS. Note that the capacitor might continue to charge even as the voltage is falling, if the resistance is large enough.

I’m interested in calculating the voltage across the capacitor for any time t ( 0 \< t \< 8.33mS), or, even better, the time t when the voltage across the capacitor is V.

Those who are familiar with electronics might recognize this circuit as a classic TRIAC light dimmer, although I am not using it for this purpose. I need to chop 480V to something more reasonable to feed to another device

---

<div class="post-metadata">

**Author:** ![N9IWP](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/n9iwp/32/3154_2.png) [@N9IWP](https://boards.straightdope.com/u/N9IWP)\
**Post date:** [December 17, 2024, 10:02pm UTC](https://boards.straightdope.com/t/a-problem-for-people-who-love-math-calculating-component-values-in-an-electrical-circuit/1011766/14 "2024-12-17T22:02:38Z")

</div>

Ah, I misunderstood. Is this of any help?

[https://www.electronics-tutorials.ws/accircuits/series-circuit.html](https://www.electronics-tutorials.ws/accircuits/series-circuit.html)

Brian

---

<div class="post-metadata">

**Author:** ![Crafter\_Man](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/crafter_man/32/458_2.png) [@Crafter\_Man](https://boards.straightdope.com/u/Crafter_Man)\
**Post date:** [December 17, 2024, 10:21pm UTC](https://boards.straightdope.com/t/a-problem-for-people-who-love-math-calculating-component-values-in-an-electrical-circuit/1011766/15 "2024-12-17T22:21:05Z")

</div>

Oops, hold on…

---

<div class="post-metadata">

**Author:** ![Crafter\_Man](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/crafter_man/32/458_2.png) [@Crafter\_Man](https://boards.straightdope.com/u/Crafter_Man)\
**Post date:** [December 17, 2024, 10:42pm UTC](https://boards.straightdope.com/t/a-problem-for-people-who-love-math-calculating-component-values-in-an-electrical-circuit/1011766/16 "2024-12-17T22:42:32Z")

</div>

As the voltage is increasing at t = 0, start a timer. Sample the current using an ADC. Keep sampling the current as the voltage goes up, then down. When the current goes to zero, stop the timer.

Let’s say the current goes to zero at t = 0.005 seconds. In seconds, the phase difference is 0.008333 s - 0.005 s = 0.003333 s. In degrees, the phase difference is φ = -(0.003333)(360)/0.016667 = -72 degrees = -1.257 radians.

Let’s say the capacitor has a capacitance of 10 μF. The resistance of the series resistor would be:

R = -1/(2 π f C tan(φ)).

R = -1/( 2 π (60) (10E-6) tan(-1.257) )

R = 86.2 Ω

That’s back-of-the-napkin, and I can’t guarantee there’s not a math mistake. Hopefully someone can check my math.

---

<div class="post-metadata">

**Author:** ![beowulff](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/beowulff/32/542_2.png) [@beowulff](https://boards.straightdope.com/u/beowulff)\
**Post date:** [December 17, 2024, 11:01pm UTC](https://boards.straightdope.com/t/a-problem-for-people-who-love-math-calculating-component-values-in-an-electrical-circuit/1011766/17 "2024-12-17T23:01:11Z")

</div>

I don’t think this is correct.  
Think of it this way:  
With R = 0, the capacitor voltage will track the input voltage essentially perfectly.  
With R = infinity, the capacitor voltage will always stay at zero.  
With R = some large value, the capacitor voltage will rise during the entire half-cycle, reaching its maximum just before the input voltage goes to zero, at t = 8.33mS. In this case, the maximum voltage the capacitor reaches is very low.

---

<div class="post-metadata">

**Author:** ![Marvin\_the\_Martian](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/marvin_the_martian/32/2898_2.png) [@Marvin\_the\_Martian](https://boards.straightdope.com/u/Marvin_the_Martian)\
**Post date:** [December 17, 2024, 11:13pm UTC](https://boards.straightdope.com/t/a-problem-for-people-who-love-math-calculating-component-values-in-an-electrical-circuit/1011766/18 "2024-12-17T23:13:43Z")

</div>

It is fairly complicated, and it does involve differential equations. The solution (the voltage across the capacitor as a function of time) has two parts, a transient response (due to the turn-on of the un-energized circuit) and a steady-state response (the sinusiodal output after the transient has died off). Here is a good step-by-step derivation of the solution using Laplace transforms to solve the differential equation:

[![](https://img.youtube.com/vi/fsntT_pd_xI/maxresdefault.jpg "21 Transient Response of RC Circuit with Sinusoidal Excitation") ](https://www.youtube.com/watch?v=fsntT_pd_xI)

---

<div class="post-metadata">

**Author:** ![beowulff](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/beowulff/32/542_2.png) [@beowulff](https://boards.straightdope.com/u/beowulff)\
**Post date:** [December 17, 2024, 11:30pm UTC](https://boards.straightdope.com/t/a-problem-for-people-who-love-math-calculating-component-values-in-an-electrical-circuit/1011766/19 "2024-12-17T23:30:00Z")

</div>

Thanks for that.  
I suspect that I could prototype my circuit with a potentiometer and use an oscilloscope to measure the voltage much easier than attempt to understand all that math…

---

<div class="post-metadata">

**Author:** ![Dr.Strangelove](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/dr.strangelove/32/6613_2.png) [@Dr.Strangelove](https://boards.straightdope.com/u/Dr.Strangelove)\
**Post date:** [December 17, 2024, 11:57pm UTC](https://boards.straightdope.com/t/a-problem-for-people-who-love-math-calculating-component-values-in-an-electrical-circuit/1011766/20 "2024-12-17T23:57:37Z")

</div>

Without watching the video:  
Current through a capacitor is I=C\frac{dV}{dt}. And through a resistor is I=\frac{V}{R}. So we can formulate the diffeq (with y as the cap voltage) as:  
 Cy' = (V sin(t) - y) / R  
(V is peak voltage here, not RMS)

My diffeq abilities were pretty bad even in college, and are worse now. But I plugged it into a solver and got:  
y=\dfrac{v\,\sin\left(x\right)}{{c}^{2}\,{r}^{2}+1}-\dfrac{c\,r\,v\,\cos\left(x\right)}{{c}^{2}\,{r}^{2}+1}+\dfrac{C}{{e}^{\frac{x}{c\,r}}}  
(big-C is the constant of integration here, not capacitance)

Looks basically reasonable on Desmos:

> **[Desmos | Graphing Calculator](https://www.desmos.com/calculator/andatngggh)**
>
> Explore math with our beautiful, free online graphing calculator. Graph functions, plot points, visualize algebraic equations, add sliders, animate graphs, and more.

You’ll have to tweak the sliders to compute C such that y(0)=0.

[Next page](https://boards.straightdope.com/t/a-problem-for-people-who-love-math-calculating-component-values-in-an-electrical-circuit/1011766.md?page=2)
