| FORUM

FEDEVEL
Platform forum

Current Flow in RC Low Pass Filter

SockThief , 04-28-2022, 08:55 AM
Hi!

I have been looking into RC Low Pass filters a wee bit more than I possibly should. whilst I'm ok with the math to get to the cutoff frequency, and build up an RC filter that performs as I need it to, I am somewhat confused as to how the current flows in a filter.

I simulated the filter as per the attached image.

As Vin increases, current flows through the resistor and the capacitor. As the voltage increases, more current is pushed into the capacitor and the voltage across the capacitor increases. As long as Vin > Vc, the capacitor will continue to charge. At some point, Vin < Vc, and the capacitor will discharge. This will produce a negative current, which has no where to go but back into the source - this appears to be correct according to my simulation. This is what I am not quite grasping - Vin is still positive and trying to push current into the circuit, but the higher voltage capacitor is pushing current back into the source - is this correct? what are the real world implications of this?

i have looked into this for a few days, read all my text books, but I have yet to find any great discussion on this - most texts jump straight to the equations. I have discussed this with a few people but have yet to find a good answer. Hoping someone can clear my misunderstanding!

To be clear, I get how a filter works, and why it works. The math makes sense - the response over a full cycle; but this detail is messing with me for some reason.

qdrives , 04-29-2022, 05:50 PM
The current flowing through R1 is linear compared to the voltage difference between V1 (Vin) and Vcap.
V1 may be positive, but when the voltage across the capacitor is higher, it will drive the current through the R1 into V1.
Perhaps your 'problem' is that you were told that when voltage is positive, the current is too. That assumption is only true in single source and (static) DC.
SockThief , 05-02-2022, 03:10 AM
hi @qdrives thanks for the reply -

The current flowing through R1 is linear compared to the voltage difference between V1 (Vin) and Vcap. - yep, get this; though when you say "linear" i assume you mean "in phase"? as a resistor will not introduce a phase difference the current through a resistive load will always be in phase with that voltage drop. And you can see this in the simulation; in the top of trace, the blue is Vin; the Orange is Vout (Vcap) and the brown is Vin - Vout. Vcap is delayed relative to Vin due to the charging nature of the capacitor which is in turn due to the current flow and is influenced by the value of the resistance. If we lower either R1 or C2, we will get a faster rise time and at some point Vcap will just about mirror Vin. Vin - Vout is the voltage across the R1 (and of course Vout - Vin would be the same waveform reflected about the x axis). Thus when Vcap = Vin, (Vin - Vout) = 0. In the lower traces, blue is current through R1, and orange is the current through the load R4. So we can see that I(R1) is in phase with Vin-Vout, and that I(R4) is in phase with Vout.

V1 may be positive, but when the voltage across the capacitor is higher, it will drive the current through the R1 into V1. - yep. intuitively this is what I thought, and this is confirmed by the simulation. This is where my question comes in, and it might be more a question on how voltage sources work. if we think about charge flow here - the source is pushing charge through R1, and onto the top plate of C2, this then pushes charge out from the bottom plate back to the source - thus we see current flowing. As Vin increases, we push more charge, the charges accumulate further on the capacitors plates, the rate at which the charges are being pushed into the capacitor increases to some max value and then slows down, but as the voltage across the capacitor is still less than Vin, it will continue to accumulate charges. Somewhere around 6.4mS, the charges stored on the capacitor produces a voltage that matches Vin. We now have the maximum amount of charge stored on the top plate, and maximum deficit of charge on the bottom plate, meaning the electric field is at it's maximum. Once Vin drops below Vcap, we then have charges that need to go somewhere.

If we consider the charge carriers as electrons, the top plate contains a lot of electrons, it's going to want to lose those electrons to return to neutral, and the bottom plate will have a deficit of electrons, so it will want to consume electrons to return to being electrically neutral. Thus, when the capacitor discharges, it will be forcing carrier charges (electrons) into the source, which is actively trying to push electrons into the system. At the bottom plate, the capacitor will be pulling electrons from the source. This is what i am not yet coming to grips with.

if you consider a classic RC circuit powered from a battery with a switch. When you throw the switch, the capacitor charges to Vin over 4-5 Time Constants, and sits there; if you open the switch, the capacitor will happily sit there charged. If you add a load, it will discharge through the load. excess electrons from one plate will flow through the load and into the other plate to fill the neutralise the net positive charge the other plate had accumulated during charging. This make complete sense. In this circuit, if you pulled the resistor out exactly when Vin = Vcap, I suspect you would see the same effect, the capacitor would discharge through the load. But that's not what happens here. This also then leads to the question, we have a voltage Vout across a load R4, and so we have a current flowing (which we see in the orange lower trace) - i.e.: we have charges flowing;

During the window ~6.4mS -> ~8mS; Vin is positive, Vcap is positive, Vcap > Vin, I(R1) is negative and I(R4) is positive. Considering the node joining R1, C2 and R4 - current enters this node from the capacitor, and leaves towards R1, and R4. For this window of time my conclusions then is that the discharge current from C2 provides the current through the load R4; Again, this is fine. As for the source, I guess it depends on what the source is as to what would happen? for example, an alkaline battery probably would not like this situation (and to be clear, an alkaline battery would be impossible in this situation as we are talking about an AC source) however imagine we create the AC source by a rotating coil generator. the coil rotating in a magnetic field induces an AC EMF, now in this case, as it spins instead of pushing current out, its receiving current - what implications does this have? I guess we have the same question, if we had a transformer as the source - there is an induced EMF is the secondary that is trying to push current, but it's sinking current instead.. Consider an audio amplifier, or an op-amp.. how would they handle such a situation?

The genesis of this question is actually this portion of the MIxed Signal HW Design with Kicad Course
the purpose of the RC filter formed by R100 and C102 on the input to U100 (3v3 LDO regulator) is to filter out noise from the buck converter U101, and I guess any noise from the USB source VBUS. Considering the node directly before R100; we have 5v from VBUS + noise which will appear as ripple on the power rail. But in the window we are looking at - what are the implications here? we will be pushing a negative current *somewhere* in the circuit, either down to U101 or back towards the USB port?

Perhaps your 'problem' is that you were told that when voltage is positive, the current is too. That assumption is only true in single source and (static) DC. Hrmm... I want to be fair to any of my teachers in the past and say, no; i've come across this; im familiar with leading and lagging currents etc; And to be fair, I'm comfortable with the math to derive the formula's, work with phasors etc; but I have just never, until now stopped to consider what is happening at the charge level, and what the real world implications of that might be.

cheers!
qdrives , 05-05-2022, 02:05 PM
A very theoretical approach to something I think is much simpler.
Perhaps it starts with the name "voltage source". However, the voltage source in the simulation is just as easily a sink as a source. It just make the output voltage to the level it should (AC sine in this case).If that means that it has to sink current to do so, it will.
SockThief , 05-12-2022, 10:34 AM
Hey @qdrives - sorry for the late reply, we got some illness at home and my attention has been taken elsewhere! In the meantime this was what I came up with; see what you think

- as is always the case with voltage, it's the difference in potential between two points that matters; if there is a potential difference, there will be an electric field and thus current (opposite the direction of electric field of course).

- an electron doesn't care what else is around, all it knows is "there is an electric field, i'd better move!", and since Vcap > Vin, there will be a potential difference and the source just has to suck it up and deal with it!

- if we remove the load from the circuit (for example we could be feeding an (ideal) op-amp), then there is only one way for the current to go, back through R1 an into the source. Anything else is impossible

1. let's consider an AC power source from a coil rotating in a magnetic field with slip rings

- the rotating ring generates an EMF proportional to the number of turns, the magnetic field strength and the speed of rotation.

- the generated EMF will exist across the coil, when connected to a load a current will be produced which is proportional to the circuit impedance as a function of time. The current that flows is only due to the fact that there is a potential difference across the coils and thus a field is generated in the wire that causes current to flow.

- when Vcap > Vin, that current reverses due to the reversed potential difference, the fact that Vin is positive is actually irrelevant. the relative voltage is lower than Vcap.. the fact that Vin is positive just means the relative potential difference is smaller.

- being a simple coil of wire, the reversed current will just cause electrons to flow from the capacitor through the resistor, through the coil and into other side of the capacitor resulting in, over a few time constants, the capacitor returning to electrically neutral on both plates. this would be consistent with KCL


- if we add a load, then we have have two loops for the capacitor to discharge through, back through R1 as above but also through the load. The discharge current will flow proportionally to the impedance of each loop. But I(R1) + I(R4) = I(cap) during the discharge part of the cycle. And the result is the same. And indeed if I look at the absolute value of the currents, I(cap) = I(R1) + I(R4)

2. I looked at when the input is a square wave, i.e.: this circuit

for this we get waveforms as below (the current being I(R5) - and we clearly see the negative current spike when the 555 switches off; again, this has no where to go but back through the output pin


looking at the circuit internals for a 555,



we can see that when the output is 0v, any reverse current will be passed through to circuit ground harmlessly.


assuming I am right in my analysis (which I think I am! and feel free to correct me if i'm not) - my intuition was right all along. And you do need to consider what you are connecting capacitors to, they will generate negative currents and you have to deal with that. And in fact, this is exactly the same with inductors - we are used to putting flyback diodes in to snub the reverse voltage generated with the electric field collapses!
qdrives , 05-13-2022, 03:59 PM
From the amount of theoretic detail you are able to write, it amazes me that you had that question (or I misunderstood the question).

"...you do need to consider what you are connecting capacitors to, they will generate negative currents and you have to deal with that." - well, in my opinion it is not so much the negative current.
1) Connecting capacitors, especially ceramic ones, can cause high peak currents.
2) If you only have a high side drive, the current (charge) has nowhere to go, so the square wave in your 555 example would almost be flat with a single rise and leakage (or load) to lower it.
Both of these issues have caused products to fail and requiring redesign.

"an electron doesn't care what else is around, all it knows is "there is an electric field, i'd better move!", and since Vcap > Vin, there will be a potential difference and the source just has to suck it up and deal with it!" - perhaps this video https://www.youtube.com/watch?v=Lp_b8gQpxW8 and the many others on this topic can make you question even more.
SockThief , 05-16-2022, 01:06 AM
hej qdrives - thanks so much for your insights; i have spent the weekend considering everything you have said, and to be honest I am very much enjoying this conversation. I have a follow up but I am taking a bit of time to make sure I have everything clear in my mind.

Thanks, talk to you soon!
SockThief , 06-28-2022, 07:04 AM
Hi @qdrives - unfortunately what happens so much of the time is that I start with a question, and then that leads to 200 more and I quickly fall down the rabbit hole - I wanted to get through the research and reading I was doing before replying back. (I try to make sure that I have put in sufficient effort before reaching out)


"From the amount of theoretic detail you are able to write, it amazes me that you had that question (or I misunderstood the question)." - no im sure you didn't misunderstand; what is sad (I guess) is that I have a degree in EE; its just it was 15+ years ago and I have spent all that time in software professionally and my EE knowledge has severely dropped. I also question whether, as an immature student i was focusing on passing rather than understanding. In addition to this, of course the more you know, the less you know (or the more you know, the more you know you don't know..!). Additionally I have found that electronics is full of terminology that gives a false meaning - for example "bypass capacitor" is often mixed up with "decoupling capacitor" and then you have "series decoupling". Bulk Capacitors vs Bypass Capacitors is another example - we also have analogies to make life easier, but they can give a false impression as well. For example, i can't tell you how long i thought of Voltage as a "force" rather than a difference in energy, and how often you hear the term "voltage pushes electrons to cause current which transfers energy". When i learned a volt (as opposed to voltage!) is a measure of energy / unit charge, i was blown away and it took me time to change my view, and see the water/gravity analogy as a simple abstraction. But the way I was taught electronics allowed me to anchor these ideas and now I am determined to fix those.

it's funny you mention Veritasium as that was what kick started this process. I watched the video and immediately went back to the books, took physics classes to rectify my knowledge. Now, off topic, but I think the veritasium video was poorly done. His intention, as he has made clear since was to basically say that fields can transfer energy, which is fine; but the thought experiment he came up with was flawed, as the effects of transients, capacitive and inductive coupling and steady state was not discussed. He mixed many aspects to cause a confusing video (though to be fair, the notion of energy transfer through EM fields is something I, at this stage, just accept; I may have to dig into this later!) but if you think about this in too much detail, then i can't imagine you would ever achieve much more, and you may as well turn your attention to theoretical physics, as analysing a circuit from this perspective would be impossible!

However, reading your reply - it seems that I am basically correct "Both of these issues have caused products to fail and requiring redesign." - you want to consider where current might flow unexpectedly;

I have asked this question in another forum post (https://designhelp.fedevel.com/forum...-what-is-noise) as this post is specifically about RC filters, i made another to delve into the noise to better understand this circuit. In going down this rabbit hole I can recognise that sometimes it's best to look at blocks in the circuit and think about what function they solve - rather than getting caught up in the details; my fear though is that if I don't think about the reality, i might do something stupid! (not that I would be the first, i guess)

so, long story short - i think i asked the right questions about RC filters; my conclusions were reasonable and there are potential issues to be aware of. I will dig into the specific circuit issues in the new post I made re: "what is noise"

thanks for your time and input!
qdrives , 06-28-2022, 02:37 PM
I love this conversation. However, I am going to keep it short today, otherwise I would not be able to sleep before needing to go to work again tomorrow.

To begin with, I do NOT have a degree in EE. A bit like you, a lot of software. I am an automation engineer by education. Spend more time writing software than designing electronics. However, electronics started with a hobby over 30 years ago. The last couple of years I am much more busy with the theoretical part of electronics as it is required to design better products, especially for EMC. And yes, the more the learn on the subject the more you know that you do not know.

However, reading your reply - it seems that I am basically correct "Both of these issues have caused products to fail and requiring redesign." - you want to consider where current might flow unexpectedly;
Well, I don't recall you were incorrect - just questioning. But was this a question or a statement?

i might do something stupid! (not that I would be the first, i guess
Yes you are the first .
For a design it is often best to start with a block diagram. Then you fill in the details of each block.

For the new RC filter question I will put some remarks there.
SockThief , 06-29-2022, 06:21 AM
I love this conversation.
rest assured the feeling is more than mutual!
SockThief , 06-29-2022, 10:17 AM
funnily enough, i was doing some reading - Clean Power for Every IC, with regards to looking at noise, ferrite beads etc - this page specifically: https://www.allaboutcircuits.com/tec...ss-capacitors/

and low and behold we get this:

"Note that the current is positive (i.e., flowing from the source through R1 to C1) when the capacitor is charging and negative (i.e., flowing from C1 through R1 to the source) when the capacitor is discharging."

and that was it! they could have said so much more! but nope - stopped there
SockThief , 12-06-2022, 07:27 AM
@qdrives - wow, time flies when you get busy ​

I feel there is a paradox, if i ask "what is the voltage at point A" -> if the capacitor is discharged (an initial condition) then the voltage across the capacitor is 0v; yet Vcc is also making that point 9v... the only solution I can see to that is that I have neglected the parasitic resistance (and inductance, but let's simplify and just add resistance) - so if i have this circuit (not using a 7805 is easier to simulate!)


the simulation looks like this:
​.. which is exactly what I expect to see.

if i set the parasitic resistance in the capacitor to 0, then i see

​now. maybe that is accurate - but i can imagine 500A going through the system at power on is not going to be a good thing; so It seems to be, that in this use-case, the ESR is a good thing, and without it, we could have issues?

is this somewhat ballpark correct?
Use our interactive Discord forum to reply or ask new questions.
Discord invite
Discord forum link (after invitation)

Didn't find what you were looking for?