EEVblog Electronics Community Forum
Electronics => Beginners => Topic started by: HwAoRrDk on March 10, 2016, 12:12:04 am
-
I have a circuit where I'm attempting to amplify voltage in the tens of millivolts range (current-sensing from a motor driver IC) into 0-5V range so as to make better use of my MCU's ADC range. But, I'm not getting the results I am expecting, and I'm stumped as to why. :-//
I'm using a Microchip MCP604 (http://ww1.microchip.com/downloads/en/DeviceDoc/21314g.pdf) op-amp with two resistors of 1K and 33K in a non-inverting configuration to make a gain of approximately 34x. So, if I input 50mV, I should get about 1.7V output, right?
However, I'm only getting about 500-700mV output on an input of around 40-50mV. ???
I've checked and re-checked my circuit to make sure I have everything hooked up correctly. I've rigged up a voltage divider (100K & 1K resistors) to give me a fixed 50mV, and when I feed that as the input instead, I get the correct 1.7V out. So I know in principal I have things right. But simply swapping to my current-sense wire instead, it doesn't give the right amplification. I've even tried swapping in a crusty old LM324 (date code of 1982! ;D), and it gives the same strange results as the MCP604.
What could be going wrong here? Might there be something else in my circuit causing some kind of side-effect?
-
Hi
Since you have swapped out the op amp and the result is identical:
1) The 1K is not really 1K
2) The 33K is not really 33K
3) The 40 mV is not really 40 mV
4) The 500 mv is not really 500 mv
Those seem to have been eliminated by your testing.
The gotcha is number 3. The op-amp's input voltage range (relative to the supply) may not have allowed it to properly work (and "see") your 40 mv.
Simple questions:
Where are the terminals of the shunt relative to the ground of the op-amp?
Is the op amp properly hooked up to work relative to those voltages?
Put another way:
Is one side of the shunt tied to supply ground and the other side of the shunt positive relative to that terminal?
Bob
-
Might there be something else in my circuit causing some kind of side-effect?
Might be ;)
Where exactly, have you referenced amplifier to? Is it part of the circuit that carries current to the motor?
I assume we are talking about sensing the current in the ground/return path - the common mode range includes ground, but not Vdd. A schematic would help.
-
Attached is my circuit.
Yes, I've checked that my resistor values are what I think they are. ;) First thing I did! Also checked the VCC of the op-amp to make sure it was the proper +5V.
I think maybe you're right in that my meter reading of the input is not what it actually is. I was probing with the meter on the '+' input pin of the op-amp and ground.
Hopefully the circuit schematic answers the other questions.
-
I have a circuit where I'm attempting to amplify voltage in the tens of millivolts range (current-sensing from a motor driver IC) into 0-5V range so as to make better use of my MCU's ADC range. But, I'm not getting the results I am expecting, and I'm stumped as to why. :-//
I'm using a Microchip MCP604 (http://ww1.microchip.com/downloads/en/DeviceDoc/21314g.pdf) op-amp with two resistors of 1K and 33K in a non-inverting configuration to make a gain of approximately 34x. So, if I input 50mV, I should get about 1.7V output, right?
However, I'm only getting about 500-700mV output on an input of around 40-50mV. ???
I've checked and re-checked my circuit to make sure I have everything hooked up correctly. I've rigged up a voltage divider (100K & 1K resistors) to give me a fixed 50mV, and when I feed that as the input instead, I get the correct 1.7V out. So I know in principal I have things right. But simply swapping to my current-sense wire instead, it doesn't give the right amplification. I've even tried swapping in a crusty old LM324 (date code of 1982! ;D), and it gives the same strange results as the MCP604.
What could be going wrong here? Might there be something else in my circuit causing some kind of side-effect?
The results you are getting, sound ENTIRELY correct to me. That is EXACTLY what I would expect, from what you have described.
Without a schematic, I could easily be wrong though.
You have created the voltage reference (for your test), using a 1K resistor. (1K, 100K).
You are trying to measure it with a 1K input resistance (1K, 33K).
So the actual ratio (once the op-amp stabilizes), is really a pair of parallel 1K resistors = 500 ohms.
So the ratio is 100K to 500 Ohms.
Not 100K to 1000 Ohms.
Hence your (weird to yourself), result, of VERY APPROXIMATELY half the expected value.
EDIT: Now that you have suddenly posted the schematic. I'm NOT sure what the issue is. You wired the op-amps differently (but correctly), to what I thought the problem was. I should have waited till the schematic was posted by yourself. Sorry.
-
Attached is my circuit.
Yes, I've checked that my resistor values are what I think they are. ;) First thing I did! Also checked the VCC of the op-amp to make sure it was the proper +5V.
I think maybe you're right in that my meter reading of the input is not what it actually is. I was probing with the meter on the '+' input pin of the op-amp and ground.
Hopefully the circuit schematic answers the other questions.
Hi
If you have a bunch of current running around that board ... do you have a proper solid ground or do you have 20 to 100 mv drops here and there between various points that should be ground?
Bob
-
Well, this is all just prototyped on breadboard at the moment, so I highly doubt I can guarantee the integrity of the ground everywhere. I assume a big mess o' wires isn't ideal for integrity. :P
I did some more experimentation, and I'm still a bit puzzled. I measured with the meter directly across the current sense resistors, and was getting an average of about 12mV during motor operation. So, maybe my earlier reading taken by using a different ground elsewhere was way off. And, 34x gain applied to 12mV is 408mV, so almost in the ballpark of my original output readings.
I then modified my test voltage-divider setup to give me 12.5mV (with resistors at hand: 100K and 330+1K=248), but I'm getting 665mV output there, which is a 53x gain! So that's not expected behaviour either. |O But, at least that's even more in-line with my original measurements.
So, what would make the op-amp over-amplify the input when given such a small input voltage? :-//
I have some 0.22Ohm resistors to hand, so I might try those instead for the current sensing, to give me a little more voltage.
-
Breadboards have intermittent connections. Solder the circuit together compactly on a pcb or on stripboard instead.
-
It might be oscillating, especially on a breadboard. I'd add 100pF ceramic across input and output on both op amps.
-
It might be oscillating, especially on a breadboard. I'd add 100pF ceramic across input and output on both op amps.
Cap on output is a capacitive load, so it may cause or worthen oscillation. If there's a suspence, that op amp is oscillating, it's better to add smal value (about 10 Ohm) resistor directly from the output to the breadboard (e.g. in series).
It's easy to check if there's any oscillation. Switch your multimeter in AC mode. When the op amp is hooked to your test divider, it should show about 0V on the output of the op amp . If it shows some voltage, so there's oscillation.
I did some more experimentation, and I'm still a bit puzzled. I measured with the meter directly across the current sense resistors, and was getting an average of about 12mV during motor operation. So, maybe my earlier reading taken by using a different ground elsewhere was way off. And, 34x gain applied to 12mV is 408mV, so almost in the ballpark of my original output readings.
I'm a bit confused with the term "average", that you used. Did you take average measurement of the other voltages? I mean, than doesn't sound proper to me, so there may hide the problem) Maybe I just didn't get it right.
I would also try to connect pin 2 of R17 directly to pin 1 of R9 and use this point as your measurement 0V reference for U11.1.
I also checked Bias Current and Offset voltages specs of MCP604. It have maximum of 2mV offset voltage at room temperature and it's about 20% from 12 mV, so your measurement may be 20% off. But still it's not that much that you see. Bias Current is bugger all, so it's OK.
-
Speaking of caps, I realise I don't have a bypass cap on the VCC to the op-amp. I will try with a 0.1uF like the datasheet recommends and see if that makes any difference. The sheet also says "It also needs a bulk capacitor (i.e., 1 uF or larger) within 100 mm to provide large, slow currents". What do they mean by "bulk"? The only >1uF caps I have to hand are 22uF and 47uF electrolytic - will one of these do?
I'm a bit confused with the term "average", that you used. Did you take average measurement of the other voltages? I mean, than doesn't sound proper to me, so there may hide the problem) Maybe I just didn't get it right.
The meter reading was fluctuating a couple of mV up and down during motor running; 12mV was the 'middle' value seen most often. And, of course, not including the spikes at motor start-up. That's what I meant by "average".
I would also try to connect pin 2 of R17 directly to pin 1 of R9 and use this point as your measurement 0V reference for U11.1.
By that do you mean without any length of wire (or breadboard strip) between the two pins, so both legs of each resistor go to ground at the exact same point? I think I could do that with a bit of re-arrangement. It would mean moving the 0.15 Ohm current-sense resistors to sit right next to the op-amp, rather than the motor driver (i.e. putting a long length of wire between the sense resistor and the motor driver).
-
It's easy to check if there's any oscillation. Switch your multimeter in AC mode. When the op amp is hooked to your test divider, it should show about 0V on the output of the op amp . If it shows some voltage, so there's oscillation.
My meter only has ranges in the hundreds of volts for AC, so after rooting around a bit I found another PSU and hooked up my toy scope (DSO138, so shoot me ::)) in AC coupling mode. Voltage level is right on zero, bar some very minute random noise, which according to the scope measurements, is 2mV p-p at most - ambient noise, I guess? This is with no caps or anything like that on the op-amp. So... I can dismiss oscillation problems?
The only odd thing I noticed is (with DC coupling) when the motors are operating, I got occasional random very short spikes (<50uS) dropping about 400-500mV (from 660mv).
EDIT:
Moved the current-sense resistors as suggested so they connect to ground at the exact same spot as the 1K resistor off the op-amp. Did some more measurements:
- 12mV when measured directly across the current-sense resistor
- 12mV when measured at the input (+) pin of the op-amp (so the op-amp is at least seeing what it should)
- Approx. 650mV output from the op-amp (about 54x gain, so still wrong >:()
Here's an odd thing I didn't notice before: when the motors are not being operated, I am getting a constant flat-line 200mV on the output of the op-amp. What's that about? ???
FURTHER EDIT:
Swapped the 0.15 current sense resistors for 0.33 Ohm. Also swapped the op-amp resistors for 47K and 3K, making 16.7x gain (trying to keep some headroom for peak current draw). Readings were as follows:
- 30mV across the current sense resistor
- 30mV at op-amp input (+) pin
- 600mV output from the op-amp (20x gain >:()
Again, still getting a constant non-zero output from the op-amp when motors not running, but this time 100mV.
-
It's easy to check if there's any oscillation. Switch your multimeter in AC mode. When the op amp is hooked to your test divider, it should show about 0V on the output of the op amp . If it shows some voltage, so there's oscillation.
My meter only has ranges in the hundreds of volts for AC, so after rooting around a bit I found another PSU and hooked up my toy scope (DSO138, so shoot me ::)) in AC coupling mode. Voltage level is right on zero, bar some very minute random noise, which according to the scope measurements, is 2mV p-p at most - ambient noise, I guess? This is with no caps or anything like that on the op-amp. So... I can dismiss oscillation problems?
The only odd thing I noticed is (with DC coupling) when the motors are operating, I got occasional random very short spikes (<50uS) dropping about 400-500mV (from 660mv).
EDIT:
Moved the current-sense resistors as suggested so they connect to ground at the exact same spot as the 1K resistor off the op-amp. Did some more measurements:
- 12mV when measured directly across the current-sense resistor
- 12mV when measured at the input (+) pin of the op-amp (so the op-amp is at least seeing what it should)
- Approx. 650mV output from the op-amp (about 54x gain, so still wrong >:()
Here's an odd thing I didn't notice before: when the motors are not being operated, I am getting a constant flat-line 200mV on the output of the op-amp. What's that about? ???
FURTHER EDIT:
Swapped the 0.15 current sense resistors for 0.33 Ohm. Also swapped the op-amp resistors for 47K and 3K, making 16.7x gain (trying to keep some headroom for peak current draw). Readings were as follows:
- 30mV across the current sense resistor
- 30mV at op-amp input (+) pin
- 600mV output from the op-amp (20x gain >:()
Again, still getting a constant non-zero output from the op-amp when motors not running, but this time 100mV.
Hi
Your op amp *does* have an input offset voltage. You will get Vout = gain * Vos as your idle output. We dropped that off the list back when you got identical results with two op amps.
If you now are running a 10mv or so "signal" and an op amp with a couple of mv of offset .... yup that's an issue.
Bob
-
Be careful of OA's that advertise themselves as R-R, look at specs
carefully.
Attached extraction from datasheet may explain what you are seeing when Vin =0.
Regards, Dana.
-
Hi
One might observe that Microchip is famous for their MCU's and not so much for their op-amps.
Bob
-
Your op amp *does* have an input offset voltage. You will get Vout = gain * Vos as your idle output. We dropped that off the list back when you got identical results with two op amps.
If you now are running a 10mv or so "signal" and an op amp with a couple of mv of offset .... yup that's an issue.
Ah, I didn't know about that - still learning. :-[ Thanks. Given that, it makes sense that the idle output voltage would be lower with a smaller gain, and that my output is larger than expected.
So, the datasheet gives a range of input offset voltages, depending on which part grade you have. As I read things, given the graphs further on in the sheet, your VOS is likely be anything within that range depending on luck of the draw, plus slight variation due to temperature and VDD. But, they're talking +2/3/4.5mV. Say I got really unlucky with my current part and the input offset is +4.5mV; for 34x gain, that's only 153mV output offset, but I was seeing 200mV. Do I just have a crap part that's out of spec? ??? It would have to have a VOS of +5.9mV to give what I was seeing. Unless there's some other factors at play. EDIT: Oh, wait! I think I see what danadak was saying; that's maybe where the extra 40-50mV is coming from.
I have a second MCP604 here. Maybe I should swap that in and see if the output voltage is offset by a different amount, given the same inputs.
At the end of the day, I can live with an idle offset on the output. It doesn't matter because I won't be looking at that when the motors aren't being driven, and I'm primarily interested in looking for relative rises of motor current compared to the steady state, not absolute values. :)
-
Your op amp *does* have an input offset voltage. You will get Vout = gain * Vos as your idle output. We dropped that off the list back when you got identical results with two op amps.
If you now are running a 10mv or so "signal" and an op amp with a couple of mv of offset .... yup that's an issue.
Ah, I didn't know about that - still learning. :-[ Thanks. Given that, it makes sense that the idle output voltage would be lower with a smaller gain, and that my output is larger than expected.
So, the datasheet gives a range of input offset voltages, depending on which part grade you have. As I read things, given the graphs further on in the sheet, your VOS is likely be anything within that range depending on luck of the draw, plus slight variation due to temperature and VDD. But, they're talking +2/3/4.5mV. Say I got really unlucky with my current part and the input offset is +4.5mV; for 34x gain, that's only 153mV output offset, but I was seeing 200mV. Do I just have a crap part that's out of spec? ??? It would have to have a VOS of +5.9mV to give what I was seeing. Unless there's some other factors at play.
I have a second MCP604 here. Maybe I should swap that in and see if the output voltage is offset by a different amount, given the same inputs.
At the end of the day, I can live with an idle offset on the output. It doesn't matter because I won't be looking at that when the motors aren't being driven, and I'm primarily interested in looking for relative rises of motor current compared to the steady state, not absolute values. :)
Hi
Ok, let's measure:
the ground offset on your board: 2.378 mv between here and there
the AC noise on your signal 57.972 mv peak
the saturation voltage (offset from rail) on your op-amp 63.295 mv
the accuracy of your DVM ... hmmm ... not so much .xxx mv
Sum all that up and who knows what you will get.
====
Solder everything down on a nice big sheet of copper. Bypass all the supplies with a few hundred uf of caps to the ground sheet. Solder the ground pins of all the parts straight to the sheet. Pick a single point on the sheet to measure *everything* to. You are worried about mv so use a DVM that is good to at least 0.1 mv *accuracy*. Start out checking ground voltages on the sheet. If you get > 0.5 mv, you need a thicker sheet.
===
That sounds like a lot, but, how long have we been chasing a phantom millivolt here or there? It should take no more than a couple of hours to do this all on a sheet. That's *way* less time than this has already taken. You will learn far more from a well done setup than from chasing down each of the 10,000 possible issues on a lash up. We haven't even begun to dig into some of the things that *might* be going on..
Bob