Filtering noise from fluorescent light fixture?

Hi All,

Ahhh, back with another PSU filtering question.

I'm having good success testing a battery monitor application for my camper trailer (schematic attached). Under most of the load conditions I've tried so far (incandescent lights, fan motor), I'm getting the precision/stability I want from my measurements (stable to the 0.1A and maybe 10ish mV of drift for voltage)

However, I'm noticing a substantial degradation in precision for both voltage and current measurements when I switch on a small fluorescent fixture in the camper. I guess noise from a fluorescent fixture should not be too surprising.

I assume this fixture uses an electronic ballast—from some quick research, seems like these operate in the 20-30 kHz range... So before I got to thinking too hard, I experimented with adding various capacitors to the +12V input rail. I tried 100uF, 0.1uF, and 33pF with no noticeable improvements. (Note: this is all on a breadboard right now and yes, there are long leads a-plenty, so I realize this could be problematic)

So, next I thought about a low-pass RC filter. I have never designed one of these (likely obvious by now), nonetheless, a quick calculation using
cutoff freq (Hz) = 1 / [2(pi)(R)(C)]
would suggest that a 10 ohm resistor and a 100uF cap should give me a fc of about 160Hz, far below the (ostensibly) offending noise. I didn't have these exact components, but had a 40 ohm resistor and a 68uF low ESR cap. I tried this setup and again, no real improvement. For lack of any better ideas, I threw out the series resistor and left the 68uF cap (in parallel) on the 12V rail, and got a moderate improvement in stability.

Any thoughts? I have seen some mention about using ferrite cores at the source and/or at the input. However, from what I can tell these are most effective when you're dealing with higher frequency noise, into the RF spectrum. Thanks much in advance to anyone who comments!

Mike

Intuitively, I really don't like seeing a 10 ohm resistor in series with the voltage regulator, even with all that capacitance in parallel downstream. What's its purpose?

Your fluctuating readings for battery voltage and current might be accurate. A fluorescent ballast on a low-voltage DC circuit may draw current in short, deep pulses. If that's the case, then you'll see the current hop up and down, as the actual current does the same thing; you'll also see the battery voltage wobble, due to voltage drop across the battery's internal impedance and the impedance of whatever portion of the 12V conductors your sensing circuit shares with the light fixture. The reason that you see some improvement with a big capacitor in parallel may be that the capacitor is decoupling for the light, rather than for your Arduino circuit. With the 10 ohm resistor in there too, the effectiveness of the capacitor, in terms of supporting the battery, would be much reduced.

As a test, you could move your 68 uF capacitor to the terminals of the lamp itself, and see if your jitter improves. Of course, an oscilloscope would tell the story unambiguously, but, if you had a scope handy, I figure you'd have already told us what it showed.

If it turns out that your readings are instantaneously accurate, you'll want to think a bit about about exactly what you're trying to measure. You could filter the analog input to remove fluctuations, but you'd then be looking at the time-average value of the voltage as it rapidly switches between light and heavy load. I think that you wouldn't have an accurate picture of the battery's condition. A fully charged battery driving a fluorescent lamp, observed through the time-averaging effect of a low-pass filter, wouldn't look as healthy as the same battery driving an equivalent load in incandescent lamps, when it would actually be in the same condition.

Thanks for your thoughts and comments tmd3.

I am intrigued by your idea that those fluctuating measurements may actually be correct. I was thinking about that last night and came up with two bits of evidence...

(1) I had checked the shunt voltage where it feeds into my circuit with a digital voltmeter with the fluorescent fixture on, and it always remains a rock solid 1.5 mV. Same when I double-check the input voltage that I am reading with the DVM...rock solid. This would seem to suggest that it is a noise problem in my circuit. However, I realize that there could be some fast sample averaging and/or smoothing going on with the DVM that could(?) mask such a change. (FYI the analogRead algorithm in my sketch for current and voltage is to average 5 samples taken over 50 ms, and repeat that every second).

(2) Qualitatively speaking, when I turn the fluorescent fixture on and watch the readings on my monitor over say 3 or 5 minutes, the magnitude of the drift does appear to decrease (but is still present) after that period of time. I have no idea, but it seems plausible that perhaps a physical change occurs as the fluorescent tubes warm up thus causing the electronic ballast to behave a little differently...and I could actually be correctly observing that with my battery monitor.

And you guessed it, no I don't have an oscilloscope, but I will store this away in my list of reasons I would like to have one someday! It would be a little difficult, but I may try the cap across the fixture leads to investigate as you suggested.

Finally, as far as the 10 ohm resistor...I will probably expose my ignorance here, but when I read about an "RC" circuit, they all seem to have a series resistor followed by a capacitor in parallel. I was just trying to emulate this. Perhaps I have misunderstood badly! Could you elaborate on why that resistor intuitively seems bad to you? I agree it seems a little weird and I never had it in the circuit until I started trying to figure out this RC-filtering.

Thanks much!

Mike

An "RC circuit" is often just what you show on your schematic: a resistor in series with the input, and a capacitor in parallel with the output. But, I don't think that you want to put it where you have it. In series with a power supply, the series resistor will cause the regulator's input voltage to drop whenever the current gets high. To say it another way: the resistor will consume power when your system needs power most.

You're seeing jitter on your signal lines, and you're addressing it by filtering the input power. I'd suggest, instead, that you filter the signal lines: apply the same sort of "RC circuit," with a bigger R and smaller C, to the output of your differential amplifier. Your voltage sensing circuit already has an effective resistance of 2.2k in parallel with 10k, so it only needs a well-selected capacitor between the junction of those two resistors and ground. Certainly, filtering at 160Hz won't interfere with your readings, and its a couple of decades below the suspected frequency of the ballast noise at about 20kHz or so.

Yesterday, I thought that time-averaging the signals would interfere with your measurements. After a little reflection, I realize that I was incorrect. Filtered values for current and voltage should be pretty close to what you'd get with an equivalent resistive load on the battery.

Your DVM very likely has some internal filtering of its own. If you have the manual, check for the frequency range. You might also want to switch the input to AC voltage, and see what you get. I suspect that the noise frequency is above the DVM's accuracy limits, but you might be able to see that something is happening with AC voltage that isn't happening when the fluorescent fixture is off.

Why not fix it at the source? While alot of the noise is probably the bulb itself, so perhaps adding a ground plane along the length of the bulb would help immediately absorb the rf
I've seen my work area's 120v feed while my fluorescents are on and you can actually see the mains power having small fluctuations each half cycle, and that's just two t8 4ft bulbs, so perhaps those reading may be accurate too
in that case try like someone said and add a nice fat cap right at the fluorescent fixture or even try powering it separately

Hi Again...

So tmd3, I must thank you very much for all your insight--I greatly appreciate it. With RC filters in the signal lines as you described, I see a dramatic improvement in stability of readings when the fluorescent light is on. I got rid of the power rail RC filter and I added a 0.1uF cap on the voltage divider for fc = 1 / 2(pi)(10,000)(0.1x10-6) = 159 Hz, and a 100 ohm resistor and a 10uF cap on the output of the differential amp for fc = 1 / 2(pi)(100)(10x10-6) = 159 Hz.

I had initially thought I'd use a 1k resistor on that diff amp output until I got to thinking that I really would prefer to minimize voltage drop so as not to have to compensate my current readings which are calculated from that voltage...so I dropped R down to 100 and went with a larger cap. My instincts tell me there is more to selecting that resistor than I am aware of now, but this seems to work so I think I will go with it and read up more for next time. I imagine that the current between that op amp and the ADC is minimal, so I could get away with a larger resistor (and smaller cap) and still not drop a very noticeable amount of voltage.

And winner10920, your point (and tmd3's earlier) about attempting to eliminate the noise at the source certainly sounds like the best design practice...and I will look into that. For now, I'm content to have learned a little about the practical application of simple RC filters!

Thanks again!

Mike

Mike_MT:
I'm content to have learned a little ...

I'm not done with you yet. You're gonna learn more and better, if you can get all the way to the end of this post.

a 0.1uF cap on the voltage divider for fc = 1 / 2(pi)(10,000)(0.1x10-6) = 159 Hz

That will probably work just fine. But, the appropriate calculation for the rolloff frequency is f[sub]c[/sub] = 1/(2*pi*0.1x10[sup]-6[/sup]*1800) = 883 HzThe effective impedance of the voltage sensing circuit is not 10k - it's the parallel combination of the 10k and 2.2k resistors, and that comes to about 1.8k, calculated to a reasonable precision. If you want a corner frequency at about 160Hz, you'll want to recalculate that capacitor.

One way to calculate the effective impedance is to consider the circuit with all the voltage sources replaced with short-circuits, and figure out what the resistance is looking into the circuit from its output. For this circuit, that's a 10k and a 2.2k in parallel, about 1800 ohms.

The other way to find the equivalent impedance of the voltage divider is to develop the Thévenin equivalent circuit. Here's how:

  • Calculate the output voltage when the output is an open circuit - for this circuit, that's 12V*2.2k/(10k + 2.2k) = 2.16V.
  • Calculate the current that the circuit would deliver to a short circuit at it's output - in this case, across the 2.2k resistor - for this circuit, that's just 12V/10k = 1.2mA.
  • Divide the open-circuit voltage by the short-circuit current to get an effective impedance - in this case, 2.16V/1.2mA = 1803.28 ohms, to a ridiculous precision.
    Thévenin's theorem says that a network of voltage sources, current sources, and impedances can be modeled as a single voltage source in series with a single impedance. The only difference between an actual network and its Thévenin equvalent is the amount of power that's consumed in the internal impedance. Otherwise, from the outside of the network, we can't tell the difference.

I bring all this up for two reasons: because it's extraordinarily useful and you don't seem to know it; and, because Thévenin's name is invoked only rarely in this forum - I find eleven references total, only five in English, and only a couple of those offering any real information. Without an understanding of Thevenin's theorem, it's hard to do much of anything other than guesswork in analog electronics. The Wikipedia article is here: Thévenin's theorem - Wikipedia

... output of the differential amp ... prefer to minimize voltage drop ... I imagine that the current between that op amp and the ADC is minimal ...

When you say that the ADC current is minimal, you minimalize its minimalness. It's really small. The ATmega328 datasheet says that the ADC is optimised for an input impedance of 10k or less. You've got about 9.9k to go. With a resistor 100 times as big, the capacitor could be 100 times as small, or, 0.1 uF. It'll be cheaper, take up less space, and be more reliable in the long run.

Okay...this is great. Thanks--learning more and better is my objective here (well and hopefully building a workable circuit in the end too).

Last thing first: I think I see the error in my way of looking at the RC filter between the diff amp output / ADC segment of the circuit. I was thinking about it as if there were a small but significant amount of current flowing from the output into the ADC when in fact as you point out, there is hardly any. Thus, even with a relatively large series resistor, there is essentially no noticeable voltage drop across it. Check on that one...I'll go with 1k and 0.1uF for that RC filter. Out of curiosity, is there any reason not to shoot for an even lower cutoff/rolloff frequency?

Also, if the ADC is drawing a miniscule current, are we implying that it has a very high input impedance--much higher than the circuit being measured--I am thinking like the "ideal" voltmeter, such that it does not affect the circuit it is trying to measure by drawing any current? I looked at the ATmega328 data sheet to check on this but couldn't find anything specifically detailing the input impedance of the ADC.

But to the next element of this--as you and the datasheet say, the ADC here is optimized for source impedances of less than 10k. From what I can tell, this is strictly because at source impedances of greater than 10k, this "sample-hold" capacitor charges more slowly than is ideal, slowing down the sampling time. I don't think this is directly related to the input impedance of the ADC...or is it?

And first thing last. Thévenin's theorem. I can see this is important and something I should understand. I have questions still on this, starting with why we are looking at the voltage divider as a parallel and not a series resistance. BUT, I need to read over the post and do some more reading on Thevenin's theorem, maybe try to work an example or three...and then perhaps I can ask a few more intelligent questions on this topic. So thanks again for this last installment!

Mike

Mike_MT:
... any reason not to shoot for an even lower cutoff/rolloff frequency?

A starting rule of thumb might be to pick a corner frequency that's ten times the frequency of the fastest changes you want to monitor. You're the expert: how fast do you need the circuit to respond to changes? In a millisecond, one second, ten seconds?

ATmega328 data sheet ... couldn't find anything specifically detailing the input impedance of the ADC.

In the 05-11 version, retrieved from atmel.com tonight, see page 329.

I don't think this is directly related to the input impedance of the ADC...or is it?

No. The ADC connects the capacitor to the input signal for a short time, to charge the cap. Then it disconnects the cap from the input signal, and reads the voltage off the cap. It's called, "sample and hold," or "sample-hold." It's done to avoid a quirk of successive-approximation ADC's that can lead to big errors if the input changes while a conversion is in progress. When the capacitor is connected to the input, it presents a very high impedance to reasonable frequencies, in view of the ADC's conversion rate, and when it's disconnected, the leakage current of the input pin is all the signal sees. And that's low, by design.

Thévenin's theorem

It's not particularly intuitive. Carb up.

The other thing that isn't taught on the sites that do the math for you or from the book either... is That the reactive part must equal the A/D input impedance for best rejection slope Ideally the best it can be is 3 DB/Decade but it could be a lot worse if the filter didn't match the Port as the port is the load on the reactive components causing them to act differently,I've seen and measured 1 db/decade when a filter is terminated well below calculated load impedance there is the secondary consideration that the output level will be lower that expected. impedance matching filters is true from dc too daylight, the reasons it is missed it that power transfer isn't usually a term unless the filter is purposely mismatched. But max power exchange occurs with equal source and load impedance's.

Doc

Allright. So I did a bit more reading and Thevenin's theorem is making pretty good sense to me (at least at the basic level). I sketched out some crude schematics to illustrate the process for myself. I have found sometimes that re-drawing the circuits helps me to visualize what is going on better. So thanks again tmd3. This has been a great lesson and I would have gone on without learning as much had you not kept me on the hook! One last thing I might ask--what are some other basic situations one might commonly encounter where Thevenin's theorem is the tool to use?

Finally, thanks for the comment Docedison. Along the lines of what you brought up--the ATmega datasheet indicates an ADC input impedance of 100M, but of course we have gone over the fact that for practical purposes of charging the S/H cap, the source impedance shouldn't exceed 10K. Thus as a practical matter, one couldn't come close to matching the filter and ADC impedance and still have a reasonably brief sampling time for this ADC? So one must accept less than optimal performance from an RC filter in this situation?

Thanks again all, this has been great--I'm glad I posted on the forum.

Mike

In your drawing, item (4), labeled "Thevenin Equivalent Circuit," you show a 12V DC source in series with a 1.8k resistor. The resistor is right, but the voltage source isn't. The voltage source in a Thevenin equivalent circuit is the voltage that appears at the terminals of the actual network when there's no load - also called the "open-circuit voltage." For this circuit, the open circuit voltage is 12V *2.2k / (10k + 2.2k) = about 2.16V. Your calculations suggest that you were using the Thevenin equivalent voltage - it appears that the 12V source just didn't get relabeled on the diagram.

The canonical method for deriving the Thevenin equivalent is this:

  • Figure out the open-circuit voltage, Voc
  • Figure out the short-circuit current, Isc
  • The equivalent voltage source is equal to the open-circuit voltage, Voc
  • The series impedance is the open-circuit voltage divided by the short-circuit current: RTh = Voc / Isc

In practice, for simple networks, the equivalent impedance is often developed by inspection. It's equal to the impedance of the network with all the voltage sources treated as short circuits, viewed from the network's output terminals. In this case, the network is the 12V source, 10k resistor, and 2.2k resistor, and the output terminals are the terminals of the 2.2k resistor. If the 12V DC source were instead a short circuit, then the impedance seen looking into the network from the terminals of the 2.2k resistor would simply be the 2.2k in parallel with the 10k. To completely develop the Thevenin equivalent, we'd have to calculate the open-circuit voltage, but we didn't need to know that to figure out the filter capacitor

... other basic situations one might commonly encounter where Thevenin's theorem is the tool to use?

Whenever you want a simpler way to describe how a circuit behaves. I don't have a list of applications in my head. But, with this tool in your belt, you'll recognize them when you see them.

Thanks once again tmd3. Yes, the 12V labels in my Thevenin equivalent circuits should have been 2.16V--that was indeed a typo. Well, I will have to keep my eye out for opportunities to apply the theorem. Far more satisfying (and works better) than guessing, no doubt about that!
Mike

I will have to keep my eye out for opportunities to apply the theorem

No need to look. Those opportunities will be thick on the ground. It's a very useful tool.

Just for fun, look up the "Norton equivalent."