Minimizing noise when using shunt to measure current - Page 1
Forum section: electronics / projects

author: Red Squirrel
author_rank: Super Contributor
timestamp: July 10, 2015, 02:29:59 am
content: Working on a small solar project and I want to output a display of the current usage using a shunt and op amp connected to the micro. I'm playing with it just with crocodile clips at the moment and the problem with trying to measure such small voltages is that the amount of noise it picks up is so high that it would be very difficult to get an actual value as the small difference in voltage is smaller than the noise peak to peak. Here's an example of such noise. The parts where it's more noisy is when a load is connected:Different zoom factor with load connected:I could do some averaging in the micro... but that will only really go so far. What can I do to eliminate this noise? I imagine this is just noise from the air, and the load or other factors. Even with nothing connected I will pickup lot of noise like that on the scope which is normal.

author: coppice
author_rank: Super Contributor
timestamp: July 10, 2015, 02:43:07 am
content: Without some idea of your schematic and your layout its hard to help.

author: Red Squirrel
author_rank: Super Contributor
timestamp: July 10, 2015, 02:52:54 am
content: Just testing at the moment, so just crocodile clips at the moment. (it's too big to fit in a breadboard)Did not bother to make a schematic, it's literally a standard circuit that would make a light bulb go on, except add a shunt on the negative side and then put scope probe on it. Ground to ground side of shunt and probe on other side.Plan is to use perfboard once it's done. Would I need to make this on it's dedicated board and completely shield it? I could probably recycle a pop can into some kind of shield or something if I need to.

author: coppice
author_rank: Super Contributor
timestamp: July 10, 2015, 02:56:26 am
content: So, you are just looking across the shunt itself with a scope probe? Try using two probes differentially. It should improve things a lot, even if the differential facilities in your scope are not that fantastic.

author: Red Squirrel
author_rank: Super Contributor
timestamp: July 10, 2015, 03:29:53 am
content: Still get lot of noise. Is this just superficial though, ex: will the op amp see that noise too and amplify it? I guess I will set it up and try it.Maybe I am running into one of those "traps for young players".I think I recall something on this topic now that I think about it...

author: T3sl4co1l
author_rank: Super Contributor
timestamp: July 10, 2015, 04:33:04 am
content: The measured signal is the sum of "imaginary" noise (radiated and conducted interference) and the actual signal.Ferrite beads strewn about can help, but really, they're a matter of dBs, when what you need is 10s of dB.The first thing you can, and should, do is, if you don't need the bandwidth, get rid of as much as possible! If you're measuring DC, low pass the fuck out of it! If you're measuring switching waveforms, this is harder to do, but you can at least knock it down to a few MHz without screwing up the underlying waveform too much.(You can try this on the scope itself, if it has a digital filtering or "High Res" option. But make sure the trigger isn't firing on the noise, too. Use an alternate trigger source if possible.)Beyond that, you need to ensure that:1. Exactly the load current you're interested in, flows in the current shunt; and2. The sense leads measure exactly the shunt voltage you're interested in, and nothing else.Studying the normal and common mode paths of your circuit can show where noise is getting into the shunt directly. It's a very special-case sort of thing, so unfortunately I can't really offer much for general advice here.The pickup needs to be made as close to the shunt as possible, with as little leakage inductance between voltage sense path and current flow path. If you have a "C" shaped shunt resistor, return one wire along the curve, then have both exit as twisted pair; if you have a flat bar, chip or blocks-and-sheets type, run the wires tightly along the middle of the widest side, and again exit perpendicular with twisted pair; or if you have a wirewound type (even if it says "noninductive"), lord help you.Coax is better than twisted pair, since you'll probably be reading it as a single-ended signal (you can run it straight up to the scope, but don't forget to terminate it, since the length of cable is shorted on one end and will resonate at characteristic frequencies -- the terminator will very slightly reduce measured signal, so you might calibrate gain for best results). After that, ferrite beads on the sense cable may help, since you'll have relatively low impedances (grounds?) on either end, which will circulate ground loop currents.Also, if you're measuring a pulsed or AC waveform, consider using a current transformer instead. These can be made relatively easily (or bought, but commercial ones stink, and instrument-grade ones can be purchased for, well, nevermind..), and can be made to work in the presence of DC.Tim

author: Red Squirrel
author_rank: Super Contributor
timestamp: July 10, 2015, 08:47:07 am
content: Been playing around with this, I think I semi got it working, turns out when I add the op amp the noise is not THAT bad. Though, one flaw with this design... not ALL current goes through the shunt, I put a 10a load on it, poof. Just blew the op amp.. While most of the current is going to go through the shunt as it's a very low resistance path, some will go through op amp too. At least that's why I'm guessing it blew.I just need to figure out how to stop current from going to the op amp too, because essentially by measuring the shunt I'm also making it part of the circuit. Do I just use two very high value resistors like 100k as the leads going to v- and v+?This is sorta what I'm working with, but ignore the fact that it says LM358, I just wanted to make a sketch real quick and worry about adding components later.Also in my test scenario the op amp is fed with 5 volts at v+ and ground at V-. I just realized that now actually I'll want to change that in my design and add a pin on that board for 5v.

author: mikerj
author_rank: Super Contributor
timestamp: July 10, 2015, 09:15:04 am
content: If you are using an ATX power supply it's hardly surprising that you are getting loads of switching noise. Have you actually tried this with the battery or solar panel that you are going to use?

author: T3sl4co1l
author_rank: Super Contributor
timestamp: July 10, 2015, 05:29:02 pm
content: Your circuit also claims to be a temperature-sensitive current and pressure sensor... that is, the inputs of the op-amp are shorted together, and there's no feedback path. Except they're not precisely shorted together, it'll switch when current is present (a few mV worth). Around zero, the op-amp output will be defined by Vos and anything that causes variation in it (such as temperature or bending the IC).Tim

author: Red Squirrel
author_rank: Super Contributor
timestamp: July 10, 2015, 05:49:38 pm
content: I'm not sure what you mean by that, there is no temp sensor or pressure sensor involved in this circuit, or are you saying op amps are affected by those things by nature? I forgot to mention the op amp I'm using is a ALD1722.It seems to still work after my incident... but now I'm less worried about the noise and more worried about why it's taking in so much current when I put a big load on the shunt. I even added a 1k resistor at the + input but it still got very hot when I past 10 amps through the shunt. (max current my system will be rated for). It's like if some of the current is leaking and passing through op amp too. I can't see why a significant amount would do that when shunt is 0.03. Oh and shunt is a C metal style shunt.

author: Red Squirrel
author_rank: Super Contributor
timestamp: July 10, 2015, 09:52:56 pm
content: Oh ok, I made that change. For now I decided I will skip the current sensing if I can't get it working as I need this to work by end of weekend as it's a system I'll be bringing on a camping trip, so I need to start soldering it all together.This is what I'm thinking I will do for current sensing if I have the chance: (voltage is included there too)Can I tie in the solar negative to battery negative like I'm doing? Or is that going to cause problems? Basically the way this circuit works is it will connect to the MCU board to provide the 4 analog values for battery voltage, battery load, solar panel voltage, solar panel load, in order. the PC pin will also provide the 5 volts from the main board which has a basic linear regulator to step down from 12v.I can't seem to find a way to generate a PDF of a circuit schematic as it wont let me change my printer to the PDF writer one, so screenshot seems to be the only way to get a circuit out into a portable format. For now this board is the most important though, the other is just to tie in the MCU and I already did it on a breadboard.Oh and all the current carrying stuff would be 10 gauge wire, the ground basically acts as a big bus and everything ties in, not sure if this is right.

author: sarepairman2
author_rank: Frequent Contributor
timestamp: July 10, 2015, 10:46:25 pm
content: the op amp should not draw a significant amount of current, its input impedance should be high. use a differential or better yet an instrumentation amplifier for this purpose. or use matched resistors to turn the op amp into a differential amplifier.https://en.wikipedia.org/wiki/Instrumentation_amplifier

author: T3sl4co1l
author_rank: Super Contributor
timestamp: July 10, 2015, 11:36:50 pm
content: You've still got schematic dyslexia. ...Dysgraphia? Whatever, it should look like this.http://www.electronics-tutorials.ws/opamp/opamp_3.html

author: MarkF
author_rank: Super Contributor
timestamp: July 11, 2015, 03:19:22 am
content: Quote from: Red Squirrel on July 10, 2015, 09:52:56 pmYour feedback loop is not. I think more like this.

author: Red Squirrel
author_rank: Super Contributor
timestamp: July 12, 2015, 10:01:02 pm
content: Not what? But I see the change you did there... From all the playing around I totally missed that I had 2 resistors doing the same thing just in series there. One is suppose to go to ground.I'll have to play with this later on, but I'm still concerned as to why I blew that op amp but maybe with the proper circuit I'll have better luck. But even my old circuit does not really have any path that would cause a dead short or anything unless my theory that some of the current was travelling through the op amp is really the case. But even when I added resistors it still got very hot and smelled. It seems to still work, but probably wont trust it for a project. I only have 2 more to play with so don't want to blow another lol. From a quick google search I found that it may also have been oscillating, could that be? What would be best way to prevent that?