Analog resistance mirror - Page 1
Forum section: electronics / beginners

author: back.to.battery
author_rank: Contributor
timestamp: December 23, 2013, 01:40:06 am
content: I'm trying to design a simple circuit to effectively 'mirror' the current (DC) through a variable resistor. I know "current mirrors" exist, but every example I've found seems rather nonviable for my purpose (mainly due to its required position in the circuit path). I've included a very basic schematic, to better illustrate what I'm looking to accomplish. Simply, I would like to connect something between pointsAandB(between two loads, one being an inductive load like a motor, illustrated by L1 in the schematic) that will measure the current and effectively mirror the load (create precisely the same current flow) between pointsCandD. The current isn't expected to exceed 500mA, and voltages no higher than 16 volts. My instincts tell me this would be relatively simply accomplished with opamps and transistors, but I'm at a bit of a loss, and it seems something like this probably has existed for a long time, and I need not reinvent the wheel. I would like to keep this as simple as possible, as well as completely analog. Also, I'd prefer to not add any additional resistance to the 'native load', so shunt resistors are undesirable (though permissible if simplicity demands them). Can anyone recommend an existing circuit or an approach that lends itself to these criterion?Edit: The schematic has been corrected to include the same inductive load on the 'high side' of both circuit paths. The original schematic is left in place so earlier replies and criticisms aren't undermined.

author: mrkev
author_rank: Regular Contributor
timestamp: December 23, 2013, 02:48:20 am
content: Few things that could make it easier. What is the puprouse of R1? Does it have to be trimmer, or is that just because you didn't know exact value? If it is trimmer, could you make it as tandem pot? Do you really need it to be between A-B (it's always easier when one poit is at GND or VCC). How precise should be the solution?

author: back.to.battery
author_rank: Contributor
timestamp: December 23, 2013, 03:22:45 am
content: Quote from: mrkev on December 23, 2013, 02:48:20 amThanks for the response! Unfortunately, R1 is used to represent any of a varied number of 'condition-to-resistance' transducers of the automotive type (coolant temp, oil pressure, fuel level, etc) which can all be effectively treated as potentiometers with a range of 33 ohms to 240 ohms. Because the nature of these sending units involves grounding via their mounting arrangement, there is no way to put something 'low side' of the circuit. Conversely, a 'high side' solution is also not viable, due to the nature of the project and the driving of the inductive load. Accuracy is more important than precision, but with the full sweep limited to a difference of 207 ohms, I would like to keep the precision at-or-finer than 1 ohm.

author: Rerouter
author_rank: Super Contributor
timestamp: December 23, 2013, 05:45:37 am
content: you could stagger 2 op amps, one measuring the current flow over some small resistance then outputting it as a voltage to a mosfet based constant current sinkif you do this though, please please please! read around the forum on some of the threads about fixing the stability, a number of people copy the dave cad without looking at how to stabalise it,then if you want true resistance, add in a third op amp driving a mosfet in-front of the constant current sink, with non-inverting terminal to the high side of the current shunt and its inverting input to the top of its mosfet,with this one you will want a few hundred nF of capacitance between the inverting pin and output on the voltage loop to really slow it down, otherwise the 2 loops could self oscillate

author: Rerouter
author_rank: Super Contributor
timestamp: December 23, 2013, 06:17:40 am
content: sorry i got the voltage op amp reversed...heres a link to the circuit so you can have a playhttp://tinyurl.com/lu2mwfqits a java application that shows you the circuit in a way you can play with it

author: Marco
author_rank: Super Contributor
timestamp: December 23, 2013, 02:15:38 pm
content: Quote from: back.to.battery on December 23, 2013, 01:40:06 amIt doesn't really matter how you do it, you will add resistance. Even non invasive current sensors which appear not to add resistance do. If you could move VCC or ground you could reduce it's effect to as close to zero that it doesn't matter, but you say you can't so that's that.Why do you keep saying ohms when you want to mirror the current BTW? You can only determine ohms from the current if you know L1 ... and only through differential equations and time series measurement. If you want to know R1 from a single point in time measurement you need the voltage and current and use Ohms law.

author: back.to.battery
author_rank: Contributor
timestamp: December 23, 2013, 04:40:27 pm
content: Quote from: Marco on December 23, 2013, 02:15:38 pmThis isn't necessarily true (there are certain Hall effect and other devices designed for this), but generally necessary for simplicity, which is why I specified I would use a shunt resistor if it couldn't be avoided. I couldn't think of a way to not use one, but I'm not so arrogant to claim that someone else wouldn't know of a way.Quote from: Marco on December 23, 2013, 02:15:38 pmI'm saying ohms in my second response because what I'm actually trying to mirror is the value of a variable resistor - which is something I did not mention in the first post. This *affects* the current, of course, but I could also say "I'm trying to mirror the voltage drop across a potentiometer" - it's all saying the same thing. I'm trying to duplicate a current flow, yes, and I'm trying to do this by duplicating the series resistance of what has been simplified to a potentiometer.I can see where my original post and schematic lead to confusion, as in my haste I neglected to mention that the same inductive load - with the same DC resistance - would be placed in the 'high side' of the second current path. No differential equations are necessary, saturation time for L1 is very short, and I'm only interested in steady-state characteristics. As long as whatever I put in the second path behaves like the series resistance of R1, everything else will 'sort itself out' - whether it's some sort of voltage-controlled-resistor or a current mirror. At any rate, I will rectify the schematic. Thanks for your response, and for pointing that out.Quote from: Rerouter on December 23, 2013, 05:45:37 amI played around with the idea of trying to directly drive a FET using an op amp as a voltage follower across a small shunt resistor, but I was too stupid to think of using it to drive something like a Wilson current mirror. Your 3 op amp solution sounds intriguing as well, though I'm not sure I fully understand the implementation. Time to get out the paper and pencil, I suppose. Thanks for your help!

author: Neverther
author_rank: Regular Contributor
timestamp: December 23, 2013, 06:13:05 pm
content: I assume you are working with analog meter such as oil pressure sensor with needle gauge.Have you considered cheating the original gauge?Story time:I relocated my oil filter as the original was tiny and in stupid place. I also added analog oil pressure sensor to the line as it was easy to do then. The engine has alway had problem with the top end losing oil during even four days of not driving it (takes time for the oil pump to deliver oil to the head during start, not good).So little pump was attached to the line before the filter with 12v solenoid valve.I could have used the idiotlight for driving the pump but that is in the wrong direcition from the feed and would go out before the top end would stop making horrible noises, the analog sensor after the filter was used to trigger it (only during starup, starter circuit was modified etc, irrelevant as is this story).I used the sensor as simple voltage divider with offset amplifier connected to it, and this was fed to micro which monitored the voltage, starter and alternator (kinda overkill but I saw it simpler than using analog parts).The micro drives the original instrument needle with PWM DAC and transistor.Best of all, this was one of those "this should work, just slap it together" builds.This was old car with no canbus or other stupid stuff, so I can't say if modern stuff would throw errors when checking the sensors.EDIT:Forgot to ask what you are trying to use the infomation for.I think you if you could use the offset amplifier above just to create current sink with the output voltage and same for the original gauge, you wouldn't need a micro then.

author: mrkev
author_rank: Regular Contributor
timestamp: December 23, 2013, 08:16:16 pm
content: Well I was gonna make schematic very simmilar to Rerouters (only with differential instrumentation amp. instead of normal OAmp) , but I've fall asleep yesterday... I think that that schem. is the best you can do with this kind of current mirror, especially if you have to connect it in the middle, between loads.Current mirrors usually needs a common reference point (I don't realy know the right english term), so they are not that good for this app.

author: back.to.battery
author_rank: Contributor
timestamp: December 23, 2013, 09:31:00 pm
content: Quote from: Neverther on December 23, 2013, 06:13:05 pmHeh, it's funny, I thought it would be beneficial to sort of 'simplify' my problem and just ask for help with how I wanted to go about it. It seems that was a short-sighted approach. So here's what I'm doing: A friend has a boat, with two engines, and roughly a half dozen gauges per engine (things like coolant temp, oil pressure, trim, etc.). This boat also has two 'control centers', each with a set of ammeter-style analog gauges. Now, normally you can double up on sending units (which can get expensive quickly), but even then certain sending units (like trim) cannot just be doubled up (due to their mounting conditions). Also, because these gauges appear to have internal voltage regulation, I can't simply wire them in series as I could with simple ammeters. The three main reasons I wanted to keep this analog were for reliability, simplicity, and for cost. With over a dozen currents that needed to be mirrored, using micros, ADCs and DACs seemed a bit insensible (though, perhaps with a multiplexing scheme it would be more viable?). In my head I imagined simply measuring a current through one sender and sinking that current away from the second gauge would be a fairly simple analog task. Honestly, I was half-expecting someone to post something like "oh, you're an idiot, that's [simple circuit name] and they've been used since the dawn of time."Anyway, a big thanks to you and everyone for the replies! I'm getting a lot of good avenues of thought to pursue.

author: mrkev
author_rank: Regular Contributor
timestamp: December 23, 2013, 10:01:08 pm
content: Quote from: back.to.battery on December 23, 2013, 09:31:00 pmWell that is exactly what that circut that Rerouter posted does. In fact, it doesnt matter if you use Hall, resistor or anything else. You just need to get that current converted to voltage and than drive with that voltage V to I converter...

author: back.to.battery
author_rank: Contributor
timestamp: December 23, 2013, 10:15:57 pm
content: Quote from: mrkev on December 23, 2013, 10:01:08 pmSee, now, what's incredibly frustrating about this is before appealing to you wonderful folks, I breadboarded EXACTLY that circuit. After it failed to work I assumed I was going about this all wrong. I did, however, use an N-channel mosfet instead of an NPN BJT, but I can't see how that would really cause a problem. The layout and intended functionality are otherwise identical. Oh this is maddening.Edit: I did the initial current-to-voltage conversion with a 1 ohm shunt resistor (higher than I'd like, but it was for proof of concept testing), perhaps I overlooked something in that approach?

author: Rerouter
author_rank: Super Contributor
timestamp: December 23, 2013, 10:22:24 pm
content: I'm an auto/marine instrumentation techniciangenerally those type boats are (re) fitted with dual station senders,so taking VDO gauges for instance, a normal oil pressure gauge will be 10-180 ohms reading, and the dual station sensor will be 5-90 ohms, driving both gauges at the same time, as both gauges are the same model both should read within 2% of reading of each other.equally if I'm thinking straight that 33-240 ohm is for fuel? sadly I've had a quick dig though the vdo catalog and it seems they only make dual station ones for 10-180 gauges, if yours are a different manufacturer they may stock them,

author: Rerouter
author_rank: Super Contributor
timestamp: December 23, 2013, 10:27:56 pm
content: not entirely sure if you opened it but attached is the schematic i drew up,try the bottom right op amp on your breadboard with the nchannel if you want, just remember for an nchannel fet you have to drive it a few volt above the source/drain in order to conduct, this is where a BJT can be helpful, but it limits the minimum resistanceits a standard current source with the bits needed to stabilize most circuits, if not the increase the nF value of the capacitor

author: back.to.battery
author_rank: Contributor
timestamp: December 23, 2013, 10:32:53 pm
content: Quote from: Rerouter on December 23, 2013, 10:22:24 pmHaha, how fortuitous! He's using two sets of gauges (he redid the gauges in the cabin but not the fly bridge), but the new set is Beede, which calls for 33-240 ohm senders in the datasheet (which i verified on the engines with a multimeter). It's an old Sea Ray with big old Mercruiser 485's. It doesn't have any dual senders, and the cost to double up or retrofit seemed excessive. Also, the trim senders for the outdrives can't be doubled up in any way, so mirroring the current somehow is about the only solution there. I was hoping to just whip up a small PCB with some op amps and FETs and save the day.

author: back.to.battery
author_rank: Contributor
timestamp: December 23, 2013, 10:35:52 pm
content: Quote from: Rerouter on December 23, 2013, 10:27:56 pmOh my... I'm really embarrassed now. It would seem my browser didn't load the java applet (and still doesn't), but the page has all kinds of links for the applet at the bottom, so I misconstrued your post to be linking me to a place where I *could* mock up such a circuit, not one where you already had! Thank you so much for taking the time to do that, and I'm sorry that I almost completely missed it! Thanks for taking the time to post it again!

author: C
author_rank: Super Contributor
timestamp: December 24, 2013, 05:43:39 am
content: This may be to simple, but takes a bunch of resistors.The signal you want to clone is between the sensor and the gauge. You just need to sense this with out effecting the gauge one.If you send a small current out via a high resistance to the gauge/sensor connection and then back via a second high resistance path the gauge would not know this happened as long as the two currents matched. The catch is that the two paths need to be balanced above and below the gauge/sensor connection to get this matching.http://en.wikipedia.org/wiki/Wheatstone_bridgeUse three bridgestwo matching bridges as part of a third bridge.In that drawing, the first two bridges will have matching values.R1 = R2 lower resistance for current balance sideR3 = Rx High resistance for gauge sense connectionFor bridge one, Connect point B of the bridge to the gauge where the sensor connects. Use two wires so that point B is actually at the gauge connection. R3 via wire to point B at gauge, second wire back connecting to RxThe second bridge has no added connections. it is just used for matching the first.Now take these two matching bridges and insert them in a third bridge.For the third bridge all resistors match R1 = R3 = R2 = RxThe first bridge is inserted between Rx & point B.The second bridge is inserted between R3 & point D.Assuming the proper resistors match, Point D of the first two bridges will only match when an equal current is flowing out and back from the gauge. To get this match to happen you change the voltage across bridge three.The voltage across bridge three will also change with the signal at the gauge.U1 in above is a differential input opamp.The resistor values just show what resistors that need to match in value.If the opamp does not keep the balance the meter reading will change some.Someone might suggest using fewer resistors or getting the signal from a different spot. It is much easer to get all this to balance with matching resistors on each side. Like wise, any current drawn from the circuit must be done in a balanced manner to maintain a close current match out to the gauge-sensor connection.Note: this circuit should be close to the gauge connection sensed.------in the old days a gain & span circuit was used a lot.For an oscope the span control is like the vertical position control while the gain control is Volts/div.The problem with this circuit is that the two controls interact.-----It may be better/easer to just use a high power output opamp like the ST L165 which is cheap instead of messing with the added transistor.As opamps like to operate in the center between it's supply and most do not like high cap loads use a resistor T network on the output. The two resistors in series helps protect the Opamp from non resistance loads while the third resistor adds some additional pull down to allow the Opamp to work closer to center.Just an ideaEdit: Sorry left out the big part that is reason for working to get the balanced currents. A Very low value current sense resistor between the two connection points to the bridge network just above X2. This sense resistor would have the currents flowing through it from the gauge and the current from the bridge network. With the leads from the bridge connected one way these two currents would add, while a reversed connection from the bridge cancels some or all the added current sensor resistance. The top of B1R1 & bottom of B1R2 will be effected by this current change caused by the original sensor, this is the I. Point A is the E.Good old E = I * RThe original meter controls and uses E & I while the Original sensor controls R.To clone this sensor you need to know both E & I being used to be able to clone a new sensor fake to run the second meter.C

author: C
author_rank: Super Contributor
timestamp: December 24, 2013, 09:21:47 pm
content: Note that I edited my last post to correct for missing current sense resistor.C

author: Neverther
author_rank: Regular Contributor
timestamp: December 26, 2013, 07:11:02 pm
content: Played around with that java app and tried to make one from basic parts.No meter connected to the sensor itself, just acts as voltage divider.It turned out kinda simple for the bare transistor driving it. The voltage-to-current amplifier is bit more complex and I didn't care to make real offset for it, but that resistormonster seems to work good enough.The pot and 10ohm represent the sensor (never a direct short). First opamp takes the voltage offset from the signal (I think you can even ignore this if the gauges are identical, just easier to tune).Then there is just the driving stages for the gauge, both including their own current offset (as it is cancelled in first stage) and amplification for the signal (tested with the opamp part that you can completely mirror the current after single resistor change, some % off as it "good enough". The current flowing there is probably not the same as it would be with the gauge connected)Maybe 9V regulator would stabilize the the system so alternator voltage changes wouldnt affect it too much, but basically just the fact the needles move should be enough to tell you the system isnt broken.The scopes are input current, current on bare transistor drive and the opamp V-I sink.Attached the source file if you want to play with it.ImageSource

author: back.to.battery
author_rank: Contributor
timestamp: February 20, 2014, 01:53:02 am
content: Well, first and foremost, my apologies for seemingly abandoning the thread. It's been a crazy couple of months. As for all the replies, I sincerely appreciate all the suggestions, and should my current efforts fail, I'll certainly be exploring design changes in those directions.And speaking of 'my current efforts'.....they're failing miserably. I've attached a copy of the schematic of what I have prototyped. I've simulated ithere, and it appears to work beautifully. However, once on the pcb, it's a complete flop. I've tried using two different op amps (the LM358 and a TLV272), as well as two different types of N-FETs (IRFML8244 and DMN65D8L), and even tried using an MMBT2222 NPN BJT. It exhibits the same behavior, regardless of any of those component choices.The 'input' side behaves as you'd expect (which is good, seeing as it's just a bunch of resistors in series), but the 'output' side just seems to go completely closed circuit and dump the full current - limited only by the upstream (in this case, 270R) resistor. It doesn't seem to matter what the current is through the input side. Now, in my mind this seems like a biasing issue, like I'm too far outside of the transistors' active/triode regions, but that doesn't make sense to me given the intended operation of the op-amps.Now, I wish I could say that I've done a fair bit of probing and have all kinds of useful information like input and output voltages, but alas, I do not. To keep prototyping costs down I went full SMD on the components, and populated both sides of the very tiny PCB. I probably should have breadboarded it out first, or at least put test points on my PCB, but hindsight is 20-20 I suppose...Anyway, I'm hoping someone here can point out some obvious idiocy or flaw in my logic/design, because I've been at this for days and I can't find it. Sigh.Edit - Fixed broken link >.<

author: Neverther
author_rank: Regular Contributor
timestamp: February 20, 2014, 09:17:25 am
content: Are you running dual supplies for the opamp? I assume not.358 outputs some 0.6V minimum referenced from negative supply.Also the input cannot sense near the negative supply voltage.The 1R shunt is not going to give enough voltage for sensing if you don't have real negative supply.Measure the inputs and output of the opamp if youre not sure what is happening.Also that cap on output of opamp looks kinda wierd, driving capacitive load directly from output is not usually a good idea.

author: Rerouter
author_rank: Super Contributor
timestamp: February 20, 2014, 11:00:37 am
content: The capacitor slows down the response of the op amp and is fine, however you hit it square on the head that he will either need a negative supply rail or a better op amp,

author: back.to.battery
author_rank: Contributor
timestamp: February 20, 2014, 04:53:43 pm
content: Thanks for the replies! Adding the negative rail did the job. It's frustrating because I had considered that, but somehow convinced myself that it couldn't be the problem, since "I wouldn't need my output to go negative or get all that close to zero" (which, of course, seems outright stupid now). I'd better go review basic op-amp circuit design after I kick myself a few more times. Anyway, thanks for the help! Works a treat!