Changing signal levels with op amp - Page 1
Forum section: electronics / beginners

author: G-son
author_rank: Regular Contributor
timestamp: March 01, 2023, 05:29:13 pm
content: HelloI've got a hall effect sensor running off 5V, with an output signal centered around half the feed voltage, i.e. 2.5V, going up or down a little over 2V max depending in magnetic field polarity and strength. I intend to use a 7805 regulator and a 9V battery to power the sensor.I want to send that signal to a NE5532 low noise op amp, fed from the same 9V battery, have an adjustable gain from 1x up to something like 100x (maybe higher depending on signal quality).I've made a breadboard test using a LM358 dual op amp, I worked with the +2.5V signal level straight away as that op amp works fine down to the negative rail, and used the other op amp as a voltage follower adjusted to around 2.5V to take the output signal between the two amp outputs, giving 0V output with zero magnetic field (adjustable to account for minor variations), and positive or negative voltage depending on magnetic polarity when a magnetic field is there. (Does any of that make sense?) This works, but it "bottoms out" earlier with a negative signal, and there is more noise than I'd like.Now, the NE5532 doesn't work all the way down to negative rail voltage, if I remember it right it does not work within 2V of negative or positive rail, meaning I want it to be working with an output signal around half battery voltage = 4.5V to allow maximum output signal swing.How do I best get the op amp to raise the signal by 2V, from 2.5V to centering around 4.5V, without causing any problems? A summing amplifier perhaps, with another DC signal to add on until the output is right?

author: shapirus
author_rank: Super Contributor
timestamp: March 01, 2023, 05:49:33 pm
content: You can create a virtual ground point with a resistor divider to shift the signal level away from the rails. If necessary, buffer it with the second, unused, op amp.

author: ledtester
author_rank: Super Contributor
timestamp: March 01, 2023, 06:03:24 pm
content: QuoteWith a linear hall effect sensor you might be more interested in how the output changes, i.e you might want to configure the NE5532 as a differentiator. Then you will automatically account for the ambient magnetic field.

author: G-son
author_rank: Regular Contributor
timestamp: March 01, 2023, 07:46:14 pm
content: Quote from: ledtester on March 01, 2023, 06:03:24 pmRight now the goal is (mostly) a current probe for the oscilloscope to see current changes through things like relay/solenoid coils to detect movement or partially shorted windings, so in a way you are absolutely right that the changes are what's interesting, but not quite in that way. I don't think a differentiator has a place in this case, but I can see that being useful other times.Quote from: shapirus on March 01, 2023, 05:49:33 pmI'm with you for making & buffering a virtual ground. Unfortunately my brain goes for a break when I get to the point of connecting that virtual ground to the op amp to shift the signal level, and preferably doing that on a single op amp with a potentiometer to adjust gain ~1-100x as required when in use.Breaking it up into separate jobs for separate op amps would make it simpler, one amp to change the signal level, one to amplify the signal, plenty of example circuits online so I'd just have to paint by numbers, but ideally I'd like to do both jobs using only one op amp, leaving the other in the NE5532 for buffer duty - going to need it @ 4.5V for the output signal ground.

author: shapirus
author_rank: Super Contributor
timestamp: March 01, 2023, 07:50:54 pm
content: Quote from: G-son on March 01, 2023, 07:46:14 pmIt pays off to go through the pain of understanding it.What is your sensor (part number), exactly? And how are you going to use your amplified signal?

author: G-son
author_rank: Regular Contributor
timestamp: March 01, 2023, 08:52:01 pm
content: Oh yes, understanding circuits is important. I tend to have my aha-moments over the breadboard, poking around with the meter or scope.The sensor is a Allegro A1326.https://www.electrokit.com/uploads/productfile/41017/A132x-2.pdfThe amplified signal will go to the oscilloscope, a Picoscope 2203 USB scope. A bit noisy on the lowest voltage ranges, especially if the laptop charger is on, which is why I'd like to have the option to amplify the signal "as much as possible", assuming it can be done without getting too much noise there instead.

author: shapirus
author_rank: Super Contributor
timestamp: March 01, 2023, 09:51:28 pm
content: Well now that I read everything carefully, I see what your problem is. Unless we bring in the isolated DC-DC converters, which can be used to create dual supply for the op amp, but aren't very battery-friendly, it becomes tricky.I'd maybe look for a low-noise op amp that can do input/output at ground level, "a better LM358".But it should be possible. I'm now playing around with this to satisfy my own curiosity.Also, remember that NE5532 is rated to (worst case) within 3 V from each rail which isn't exactly good for low-voltage circuits. It leaves only a 3 V swing when working from a fresh 9 V battery.

author: Zero999
author_rank: Super Contributor
timestamp: March 01, 2023, 10:43:10 pm
content: It's theoretically possible to do this with two op-amps, but not accurately.I had a play with LTSpice. This circuit is a differential amplifier, followed by a non-inverting amplifier.U1 is the differential amplifier with a gain of 1. The negative input is V2. It's divided by 2, by a potential divider, consisting of R4 and R6, which have an output impedance of 10k, the same as R6. The positive input is the input voltage from the vibration sensor. This is modelled by putting the signal in series with 2.5V. This swept from -1V to +V, so the input ranges from 1.5V to 3.5V. The reference for the differential amplifier is half the 9V supply, again using a potential divider, with an output impedance of 10k.U2 is the non-inverting amplifier. The usual 0V node is connected to 9V via a potential divider consisting of R7 and R8, setting the bias point to 4.5V. R9 sets the gain, which is 3 in this case. R1 could be a 1M potentiometer to set the gain from 1 to 101.This all works very in theory, but in practise the mismatch in resistor values messes it up.You could use an instrumentation amplifier and an op-amp for the reference, but what's the point? How accurately does your transducer centre the signal around 2.5V?

author: shapirus
author_rank: Super Contributor
timestamp: March 01, 2023, 10:46:41 pm
content: So I managed to create (simulate) an almost working circuit with only two op amps where one is used to buffer the zero level. This zero level is set by a potentiometer placed between two equal resistors coming from the output of a 5V reference (TL431 set for 5V). It can of course be taken from the output of your linear regulator that you power the sensor with.This zero level is fine-tuned with a potentiometer to match the zero-current output of the sensor, because the latter doesn't have a zero reference output.The second op amp is wired as an amplifier with the zero level that we set with the pot used as ground reference.Why is it "almost working"? Well, because 2.5V input is still too close to the negative rail for NE5532. Will it work in real life? Quite likely, because the typical swing value is 2V from the rails. Can we cheat to make it work in simulation without having true dual-rail supply (and quite possible in real life too, this time within the specs)? Yes we can. Use a Zener diode (rated suitably in terms of current): its anode connects to battery negative and cathode is used as ground reference for everything but the op amp, whose ground goes to battery negative. This will mimic having a real negative rail.I can share the schematics if you want me to spoil the fun of making your own.p.s. and yes, of course the error of the mismatched zero level will be amplified along with the useful signal by the same ratio. Zero setting will have to be performed before each measurement, which is actually the case with taking measurements with DC current clamps, where, however, it's done digitally. But since you seem to be more after educational purposes rather than practical application, at least it seems so to me, it should be fine.

author: G-son
author_rank: Regular Contributor
timestamp: March 02, 2023, 12:25:42 am
content: Quote from: shapirus on March 01, 2023, 09:51:28 pmIcouldgo to two 9V batteries. I prefer not to, but the benefits may be well worth it.Quote from: Zero999 on March 01, 2023, 10:43:10 pmInteresting circuit, I'll take a good look and try to understand how it all works together. Even if it only works in theory there can be some good inspiration in there.Not transducer, magnetic hall sensor. In reality the signal does not center very well around 2.5V - the sensor itself is probably fine but rotate it 180 degrees and magnetic north & south shifts position, move it anywhere around steel objects and you'll get a output variation. I found out the hard way how bad idea it is to adjust the zero level potentiometer using a regular steel screwdriver, the oscilloscope trace vanished off the screen as the screwdriver came close, and came back down as I removed it.Quote from: shapirus on March 01, 2023, 10:46:41 pmI'd think using a voltage divider working off the linear regulator would be a better choice than a separate voltage reference. As the sensor output is supposed to be centered around half the 5V it runs off any variation of the 5V would change the sensor output slightly, and a resistor divider connected to a separate reference would also have it's separate life. If they both come from the same source at least they'll drift together, if at all.I have thought about using a zener (or perhaps a red 2V LED if the current is small enough, or a couple of rectifier diodes in series, tests would be required to see if any of it is stable enough) to lift the 7805 ground from battery negative, but I have hesitated because of the regulators drop out voltage. 5V + about 2V extra + drop out voltage and we're uncomfortably close to the voltage when the regulator is unable to maintain 5V when running off just 9V. Running it off 18V with two batteries instead, that would change completely and open up such possibilities.I'd love to look at the schematics. Makes it easier to understand the way it works.The goal is partially educational, and partially that I want a current probe for the scope, but I don't have enough use for one to spend up towards $100 for what's on the market. So, here we are, with closer to $10 in components and an excellent learning opportunity on the table instead. I'm not worried about what the actual current is with any significant accuracy, most of the time accurate zero isn't important either, I'm interested in seeing how the current changes, as in the red trace here where a hump shows the physical movement in an automotive fuel injector as it opens (and a similar hump in the voltage shows the closing movement). The same principle can be used to show the movement in other hard to access solenoids, relays and so on, and worn brushes/commutators in electric motors will also be seen as changes in the current, confirming that the fuel pump you suspect to be causing your car to not start some mornings is actually worn out - or ruling it out, letting you look for the problem elsewhere.Even the ~$100 clamp I've seen has a poor zeroing function (push a button to charge a capacitor to a voltage that cancels out any offset voltage), as the capacitor then discharges slowly the voltage drifts. So it's fine for the quick tests, but I rather have a potentiometer anyway. Those don't drift by themselves, unlike discharging caps, so one less problem.

author: shapirus
author_rank: Super Contributor
timestamp: March 02, 2023, 11:20:16 am
content: Quote from: G-son on March 02, 2023, 12:25:42 amYou are right. I think I used reference only for the simulation purposes. I have replaced it with a linear regulator since.Quote from: G-son on March 02, 2023, 12:25:42 amTrue. There are options, however, which can be used separately or all at the same time (to extend the usable voltage range of the battery). The zener can be replaced by one or more regular diodes (for a n*0.6V total bias), the lower their number, the better, until the output signal gets clipped. The regulator can be replaced by an LDO regulator.Then, the 9V battery can be replaced by a single rechargeable lithium 18650 cell followed by a boost converter.Quote from: G-son on March 02, 2023, 12:25:42 amHere you go. This is my last revision so far. The output signal is measured between the terminal named Zero and the op amp output.The VSINE element represents the hall sensor sensing an AC current.C1 and C2 are optional, the former is to form an RC filter and reduce the reference input noise, the latter is to prevent the possible oscillation, however in this basic scenario when there is no load on the output it shouldn't occur.Bypass caps at the op amp and 7805 supply pins aren't shown.

author: Zero999
author_rank: Super Contributor
timestamp: March 02, 2023, 12:04:17 pm
content: Quote from: shapirus on March 02, 2023, 11:20:16 amYes a virtual 0V will work. Note that the 100µF on the output of the op-amp is a bad idea. Putting a large capacitor on the output of an op-amp is asking for trouble with oscillation. The easiest way to get round this is to add a series resistor: try 100R.Quote from: G-son on March 02, 2023, 12:25:42 amA Hall effect sensor is a type of transducer.To understand my circuit, you'll need to understand the non-inverting and difference amplifier op-amp configurations. There are some links.https://www.electronics-tutorials.ws/opamp/opamp_3.htmlhttps://www.eeeguide.com/subtractor-using-op-amp-or-difference-amplifier-circuit/https://www.ti.com/lit/an/sboa274a/sboa274a.pdfhttps://www.electronics-tutorial.net/analog-integrated-circuits/subtractordifference-amplifier/You'll also need to understand how voltage dividers work. Note the output impedance of a divider is equal to the resistor values in parallel.https://www.eevblog.com/forum/beginners/voltage-divider-doesnt-power-fan/msg4607761/#msg4607761

author: G-son
author_rank: Regular Contributor
timestamp: March 02, 2023, 12:18:59 pm
content: Excellent, thanks! This should keep me busy for a while.

author: shapirus
author_rank: Super Contributor
timestamp: March 02, 2023, 01:08:04 pm
content: Quote from: Zero999 on March 02, 2023, 12:04:17 pmNope, it's not that trivial, oscillation doesn't start when simply a large capacitor is present. It may occur when the capacitance is larger than the op amp can drive without oscillating, but smaller than the value that's going to suppress any oscillation. I believe it's like what's described in the TL431 datasheet, where it shows that a particular range of output capacitance may cause oscillation, but any capacitance outside that range is fine.I had a circuit once where I needed to create a virtual ground rail capable of sourcing and sinking several amps. A non-inverting voltage-follower op amp would drive a push-pull pair of PNP and NPN Darlingtons, being basically an AB-class amplifier (there also was a bias current source to make it AB). It was used as a ground reference point for a DC-coupled amplifier, built by the same scheme.Guess what, without any extra added capacitance, it oscillated. Trying to suppress the oscillation with op amp output series resistors did not help. Neither did my attempts to add compensation capacitors. But once I added a 100uF cap across the virtual ground output (after the transistors, not on the op amp output), it became stable as a rock.Since the zero level is not supposed to change, once it is adjusted, a large capacitor on the output should not be a problem and may actually be useful to suppress transients (if any are expected). But it may as well be not needed at all, I guess it depends on the board layout and other factors.I did mention that it is optional. It is generally a good idea to start with a minimum required set of components and then, seeing how the circuit behaves, add or not add more as may be required.

author: Terry Bites
author_rank: Super Contributor
timestamp: March 02, 2023, 01:58:21 pm
content: You're going to need an opamp with rail to rail output capabilities if you want the fullest swing on 9V.eg the affordable LT1677Recommended reading on single supply scaling and offset techniques attached.

author: G-son
author_rank: Regular Contributor
timestamp: March 03, 2023, 01:59:09 am
content: I'll read that document, looks like a lot of good info there!The LT1677 loks like a neat op amp when you need rail to rail. However, at about $6 a piece (and that's only one amplifier) plus probably international shipping it may be affordable compared to other op amps with similar capabilities, but not really budget friendly for my purposes. I'm leaning even more towards going with two 9V batteries, it's not the ideal solution but it's very simple. Simple solutions tend to work well enough.It's in the middle of the night here now so I may be overlooking something important, but here's the current idea:2*9V battery, for a total 18VBatteries feed two things:one NE5532one 7805 regulator, with a circa 6.5V zener on the ground lifting the regulated "2.5V signal level" to right about 9V, i.e. right in the middle of the op amps voltage range.The 5V regulator drives two items:The hall sensorA voltage divider = two resistors and a potentiometer to adjust to the same voltage as the sensors "zero signal" voltage½ NE5532 is used as a voltage follower for the voltage divider½ NE5532 is used to amplify the signal, with a potentiometer for gain adjustDepending on the presence of high frequency noise a low pass filter may be added - the sensor only has a 17kHz bandwidth (if I remember the data correctly now) so anything above that frequency shouldn't be of interest anyway.The current running through the zener should be rather small, a quick google search implies the 7805 should have a quiescent current well below 10mA, the sensor consumes below 10mA too, and the voltage divider won't use much either. Perhaps 15-30mA in total, making just over 0.2W at 6.5V worst case. Not sure how much current the NE5532 will use but I assume it will be relatively little, so battery life should be okay.As I said, it's in the middle of the night so I may be missing something that should be obvious, but right now it seems fine.

author: Brianf
author_rank: Regular Contributor
timestamp: March 03, 2023, 09:52:38 am
content: Forget the 5532, it is completely the wrong part to use in this application.The world is full of cheap rail-to-rail op-amps. Something like the MCP6002, run on your 5V rail, will work perfectly.

author: shapirus
author_rank: Super Contributor
timestamp: March 03, 2023, 10:09:16 am
content: Quote from: G-son on March 03, 2023, 01:59:09 amThere are two problems. First is that you won't get even a remotely precise level of 6.5V with a Zener. It will wildly depend on current, not good at all for this use. Can be solved with an "ideal zener" reference such as TL431, or, better, a micropower alternative, if you can obtain any.Second is that as your batteries are drained, the sensor's output middle point will drift away from the ground.What you need is to create two new power rails centered around your batteries middle point (aka ground): +2.5 V and -2.5 V. You cannot use the battery positive and negative rail as references for this, because they are not stable relative to ground, so you need to use ground as your reference. This can be done with another dual op amp, e.g. LM358, and a 2.5V reference, e.g. the micropower LM285-2.5 (or LM385-2.5), or, yet again, TL431, which you should have a hundred of in your parts bin. Or even your 7805, powered between +9V and ground, with a divider on the output.The op amps will be powered from your batteries as dual supply with their common point being the ground reference and wired as unity-gain amps: one non-inverting, one inverting. The sensor can then be powered by their respective outputs. Its output middle point will then be centered very near the ground point, deviating a little only because of the op amps and the resistors around the inverting amp not being ideal.

author: shapirus
author_rank: Super Contributor
timestamp: March 03, 2023, 10:10:46 am
content: Quote from: Brianf on March 03, 2023, 09:52:38 amSometimes you just have to invent something around what you have on hand. Ordering new parts may be not viable because of logistics.But ideally yes, this is where a RRIO op amp would be a proper solution.

author: Brianf
author_rank: Regular Contributor
timestamp: March 03, 2023, 10:50:13 am
content: Quote from: shapirus on March 03, 2023, 10:10:46 amIndeed, but on this occasion the OP is in Sweden, and Elfa has the part in stock at 0.5 euro.

author: Zero999
author_rank: Super Contributor
timestamp: March 03, 2023, 12:39:21 pm
content: The NE5532 is not suitable to this application. The fact it's not rail-to-rail is no big deal. Referencing the output to half of the 9V rail is a perfectly sensible solution. The high input bias currents, offset voltages and drift are more of a problem. I would recommend an instrumentation amplifier. It may cost a little more, but is certainly worth it and will greatly simplify the design. It's probably a good idea to have trimmer on the 2.5V side, as the Hall effect sensor's output won't be perfectly centred around 2.5V.

author: G-son
author_rank: Regular Contributor
timestamp: March 03, 2023, 12:48:07 pm
content: Quote from: shapirus on March 03, 2023, 10:09:16 amI am aware the voltage would not be precisely "in the middle" and that it would vary somewhat depending on current through the zener. My thinking is that, within limits, that doesn't have to be a problem - perhaps using a capacitor parallell with the zener to reduce the fluctuations due to varying current somewhat.The signal and 2.5V reference will move with each other equally, as they both come from the 5V regulator. Both the amplified signal and buffered 2.5V (output signal ground) will move up somewhat and down relative to battery voltage, but not relative to each other.Op amp output swing should be about 14V at 18V, and for the small signal, high gain situations I'm happy with an output signal of a few hundred mV - enough to stay away from the lower voltage ranges on the oscilloscope. For the large signals, a little more than 4V swing is enough to handle the maximum sensor output at 1x gain, and I've only maxed out the sensor using a harddrive magnet in direct contact so i don't expect to get close to that in actual use.About the TL431, I don't have hundreds of them on the shelf, but I do have something like five of them. Should be enough to get me through the week.Quote from: Brianf on March 03, 2023, 10:50:13 amUnfortunately, Elfa also has a shipping fee of ~9€ minimum for orders below ~25€, and a smaller fee for orders up to ~60€. I don't have 9€ to waste on shipping, and while I really would like to fill the parts bins with a bunch of jellybean components so the price goes high enough to make shipping free I don't have the money to spare for that either now. So I'm working with what I have on the shelf, it may be far from ideal but I believe it can get the job done. I'm not going for the perfect circuit design, I just want it to do the job.

author: shapirus
author_rank: Super Contributor
timestamp: March 03, 2023, 02:35:52 pm
content: At this point you really want to simulate it to play around and find how various combinations work.I find that software that can do realtimeinteractivesimulation is very convenient (Proteus, Multisim -- is there anything else, btw?).It will save time and unnecessary expense on components (well the software, theoretically, costs money, but you know there are ways).I know that many people are happy with the regular non-interactive spice simulators, but I personally fail to understand how to use them for my needs. Maybe they can work for you. The interactive ones however have a much lower entry threshold and very often can replace building a prototype on a breadboard.

author: Zero999
author_rank: Super Contributor
timestamp: March 03, 2023, 06:29:12 pm
content: Why do you want to use the TL431? The A1326 has a ratiometric output. This means the output voltage is proportional to the supply voltage. When there's no magnetic field and a supply voltage of 5V, the output voltage is 2.485V, so slightly less than 2.5V.You need an amplifier which shifts the zero point from 2.485V (trimmable to ±2%, so 2.43V to 2.54V), to half the 9V supply, or 0V, depending on whether you're content with a single supply circuit or not.Can you get the OP07 That's much more suited to this application, than the NE5532.How do you intend to alter the gain? Switches, to give discrete steps, or a potentiometer?

author: shapirus
author_rank: Super Contributor
timestamp: March 03, 2023, 07:09:29 pm
content: Quote from: Zero999 on March 03, 2023, 06:29:12 pmThe datasheet says it can be anywhere between 2.425V and 2.575V. It's not guaranteed that it will be precisely at Vcc/2, unless I missed this part in the datasheet. Any difference between the actual zero output and Vcc/2 will be amplified, and even if it happens to be precisely Vcc/2, it won't help much, because any ambient magnetic field present before measurement will need to be compensated for, which is also the purpose of the zero setting circuitry.Quote from: Zero999 on March 03, 2023, 06:29:12 pm...for which you still need to have a reference, but it doesn't have to be an additional component. The 7805 from which the sensor is powered can be used for it, and it's probably the best idea actually, since this reference will follow the same ripple and voltage instability that the middle point of the sensor will have, following what the 7805 outputs, thus reducing the chances of the zero setting to drift away.

author: G-son
author_rank: Regular Contributor
timestamp: March 03, 2023, 08:06:46 pm
content: Quote from: Zero999 on March 03, 2023, 06:29:12 pmI can get them, but again, shipping costs makes me really want to avoid that now.Also, the OP07 has a 600kHz unity gain bandwidth, if I'm not mistaken that would become a bottleneck at gain above about 30. (17kHz sensor bandwidth.)I intend to adjust gain with a potentiometer. Switches would be better if I wanted to get some sort of calibration of output voltage vs. measured current, but as I am mostly interested in how the waveform looks on the oscilloscope as current changes I'm aiming more for the ability to adjust gain to make the waveform fit the screen well. (Future versions, if there are any, may have different priorities.)

author: Zero999
author_rank: Super Contributor
timestamp: March 03, 2023, 08:19:08 pm
content: Quote from: shapirus on March 03, 2023, 07:09:29 pmThat's odd. The graphs at the top of page 8 data sheet, it implies 2.485V is typical. Anyway, just make it adjustable from 2.425V to 2.575V and it'll be fine.QuoteYes, just derive the centre point from the same 5V supply powering the Hall effect sensor.Quote from: G-son on March 03, 2023, 08:06:46 pmThe question is what bandwidth do you require?There are faster op-amps which also perform well at DC, such as the OP27, but they cost more. I'm also sure it's possible to use the OP07 to correct the ?E5532'a poor DC performance, but it's not something I've ever done before. No doubt there's an application note somewhere and someone else here, who's done it before can help.What's more important: DC or AC performance? If you're not bothered about DC, then you might as well use an AC coupled amplifier, or replace your Hall effect sensor with a current transformer.

author: G-son
author_rank: Regular Contributor
timestamp: March 03, 2023, 09:06:48 pm
content: I'd like to get use of the full 17khz bandwidth of the sensor, or as close as possible to that.I need DC performance.

author: shapirus
author_rank: Super Contributor
timestamp: March 03, 2023, 09:10:02 pm
content: Quote from: ledtester on March 01, 2023, 06:03:24 pmNow, let's get back to this point. @ledtester, can you please elaborate on this? How exactly would the automatic accounting for the ambient magnetic field work? This essentially means auto-zeroing, correct?p.s. I think I get what you mean. Differentiating as in math? Then it will only work for alternating (or, more broadly, changing) current and not for DC. Still makes sense depending on the planned application.

author: G-son
author_rank: Regular Contributor
timestamp: March 03, 2023, 10:21:10 pm
content: A differentiator will indeed react to changeonly, if i remember it right they're inverting so when the input signal goes up output goes negative, and when the signal goes down the output goes positive. A stable input signal, regardless of how high or low, gives zero output.A cool circuit that has a lot of uses, I'm sure. One is the deriving stage in a PID controller, another project for the future when I've figured out what to use it for. (The other stages being proportional and integral, so all possible to handle using basic op amp circuits.)

author: Zero999
author_rank: Super Contributor
timestamp: March 03, 2023, 10:31:02 pm
content: Quote from: G-son on March 03, 2023, 09:06:48 pmYou won't get a cheap op-amp which will give good AC and DC performance. The NE5532 will work at DC, as long as you're happy with poor accuracy.

author: shapirus
author_rank: Super Contributor
timestamp: March 03, 2023, 11:02:48 pm
content: Quote from: Zero999 on March 03, 2023, 10:31:02 pmWhat exactly makes its accuracy poor?

author: G-son
author_rank: Regular Contributor
timestamp: March 03, 2023, 11:19:01 pm
content: I'm happy with a fairly poor accuracy, slowly drifting zero level and such, as long as the output signal change is fairly proportional to the current change.I showed this earlier, and the red trace is a good example of what I need to see. The current through a fuel injector coil as it ramps up, the bump because of the movement in the magnetic field and so on - the bump is the most important detail in this. Doesn't matter if the signal zero level has drifted, the shape of the curve says enough to know if the current is zero or not in such an on/off circuit, as long as the trace stays within the screen of the oscilloscope drift is acceptable.Another thing can be the current through an electric motor, as the segments of the commutator passes the brushes. In a healthy motor it's fairly even and repetitive, all commutator segments give good contact to the brushes, in a bad motor there will be large variations, possibly even going down to no current at all for short moments as the brushes loose contact.

author: Zero999
author_rank: Super Contributor
timestamp: March 05, 2023, 06:38:14 pm
content: Quote from: shapirus on March 03, 2023, 11:02:48 pmIt has high input currents. In a DC application, care needs to be given to balancing the DC resistance seen at both inputs and it has a relatively high input offset current, so the resistance can't be too high. The input currents flow through all resistances connected to the inputs, which generates a voltage. If the voltages at the inputs differ, then it's equivalent to having an additional offset voltage.Take thecircuitI posted previously. The original poster wants a gain of between 1 and 100, so lets say R9 is a 1M variable resistor and it's set to 1M, for full gain, which I'll round to 100 for the purposes of this post.U1 is a differential amplifier with a gain of 1. Each input has 5k of resistance to 0V (R1 to R3 and R4 to R6 in parallel), also note V2, Vin, V3 and the op-amp's output have a fairly low resistance to 0V. The input offset current of the NE5532 is 100nA and the offset voltage is 0.5mV. 100nA*5k = 0.5mV, add that to the offset voltage and you get 1mV. This might not sound like much, but it adds up as you'll see.The problem is, U2 has a gain of 100 and the input resistances are unmatched, so there's 10k between one input and 0V close to zero on the other. The input bias current of the NE5532 is 300nA, which will generate a voltage of 300n*10k = 3mV. This offset, in addition to the 1mV from the previous stage and 0.5mV voltage offset from U2, will be multiplied by the gain of 100, giving (3m+1m+0.5m)*100 = 0.45V, which I doubt is acceptable. Adding 10k in series with the non-inverting input would improve it slightly as the resistances would be balanced, so you then have 100nA*10k = 1mV, (so 1m+1m+0.5m)*100 = 0.25V but that's still pretty poor and the resistances will no longer be balanced, when the resistance is altered to change the gain.

author: shapirus
author_rank: Super Contributor
timestamp: March 05, 2023, 06:57:35 pm
content: Yeah true. Also, datasheet says that input impedance is 300 kOhm typ., 30 kOhm min., which is too low for reading from sensors like this. I guess a FET-input amplifier has to be used here.

author: Zero999
author_rank: Super Contributor
timestamp: March 05, 2023, 09:50:51 pm
content: I didn't think about the input impedance. If the resistance between the inputs, then it won't make much difference, but if it's from the inputs and the power supply rails, it's a problem, but only for the differential and non-inverting configurations.I had a play with LTSpice. The impedance setting for the op-amp model is from the inputs to supply rails. The effect can be mitigated for the non-inverting configuration, by making the impedance at both inputs equal. I've also shown the effect of the resistance being between the inputs, Rin1 and Rin2, for inverting and non-inverting configurations.

author: G-son
author_rank: Regular Contributor
timestamp: March 06, 2023, 01:50:17 am
content: Hmm. Turns out there's a lot you have to think about. Who would have thought?

author: EPAIII
author_rank: Super Contributor
timestamp: March 06, 2023, 06:35:59 am
content: Op amps can perform many different OPERATIONS. So,Why not a single op amp as a summing circuit. One input is from your sensor and a second input is a DC Voltage from a pot. You should be able to adjust the offset just by adjusting the pot.https://www.electronics-tutorials.ws/opamp/opamp_4.htmlYou can use normal op amp gain control methods and the added pot is the DC offset.I have used this idea in more complicated op amp circuits and it worked well.