Creating controlled resistance to ground - Page 1
Forum section: electronics / projects

author: IDEngineer
author_rank: Super Contributor
timestamp: December 15, 2020, 07:12:11 pm
content: There's a style of fluid sensor (often used in fuel tanks, etc.) that involves a linear array of reed switches and a magnet on a float. As the float moves with the fluid level, different reed switches are closed. The output of this entirely passive system is a resistance to ground, typically a few hundred ohms at "empty" to a few tens of ohms at "full". Current capacity is obviously quite low given the reed switches so this is purely a low-level signal environment.We just got a call from a customer who wants us to replicate this output so they can keep using their existing upstream inputs without modification. They want a single wire referenced to ground that presents a resistance to ground that varies from this few hundred ohms to a few tens of ohms. It needs to be ~linear and contiguous (i.e. not "stepped" like a series of reed switches). It may be connected to any (reasonable) voltage as part of a divider.This is similar to a DC electronic load except that there's no guarantee of applied voltage nor current. "Measuring" it is an interesting challenge.The easy answer is an open drain NFET operating in its linear range. But since we don't know the attached voltage, it's difficult to close the loop around it. It's supposed to be "just a resistance" so we can't apply our own voltage across it.Seems like I've also run across a D/A converter that had a separate reference input, allowing you to treat it like a digitally controlled resistance, but it's unlikely its range would magically match what we need here.EDIT: Absolute worst case we could "build" a low-res D/A using multiple NFET's and associated resistors (so we can control the dynamic range of the resistance) but that just feels inelegant.I'm guessing this problem has been solved before, and if so there's no point in reinventing the wheel. Any RTFM out there? Thanks!

author: dmendesf
author_rank: Frequent Contributor
timestamp: December 15, 2020, 07:20:32 pm
content: I think the most similar thing is 4-20mA transducers. The 4mA start is used to guarantee a minimum power for the circuit. Can you get power from somewhere else? If so you can use a LDR + led or a linear optocoupler like IL300 to make a variable resistor down to nothing.

author: IDEngineer
author_rank: Super Contributor
timestamp: December 15, 2020, 07:42:57 pm
content: Power is entirely separate from the controlled resistance to ground. We have local circuitry which has its own power source and local regulator. Normally this circuit transmits its data via CAN but in this case the customer insists on continuing to use a pure resistance to ground because that's what the upstream piece of equipment demands and they don't want to change it.

author: IDEngineer
author_rank: Super Contributor
timestamp: December 15, 2020, 07:48:24 pm
content: Quote from: dmendesf on December 15, 2020, 07:20:32 pmGood idea, but the IL300's output element is a photodiode which is a current output device. Thus we'd still need a translation output stage to yield a pure resistance to ground capable of tolerating (say) 12 or 24 VDC applied to the voltage divider that the pure resistance is made part of.

author: bdunham7
author_rank: Super Contributor
timestamp: December 15, 2020, 07:53:37 pm
content: Quote from: IDEngineer on December 15, 2020, 07:42:57 pmThe customer's upstream equipment doesn't demand a pure resistance, they just think it does. It has some test current or signal that it applies and then measures the result and it just needs to see the appropriate results in response to its test signal. If you aren't allowed to know what those test signals and conditions are (they could be a test current while reading the voltage, the other way around or something else I haven't thought of) then your job seems difficult to me. Perhaps a motorized rheostat with a feedback potentiometer?

author: IDEngineer
author_rank: Super Contributor
timestamp: December 15, 2020, 08:36:03 pm
content: Quote from: bdunham7 on December 15, 2020, 07:53:37 pmAgain, I agree - but the problem is the conditions may change depending upon the environment. Both 12VDC and 24VDC are commonplace. If the applied voltage changes, then presumptions we might make could be invalid. Yes, we could then sample the input voltage... but does that catch all of the possibilities?A resistor to ground is pretty darned simple, and thus flexible. That old reed-switch-plus-resistors approach does have the elegance of simplicity going for it. My hope is to come up with some scheme by which we can use nice 40-60V NFET(s) in open drain configuration, but we need a way to close the loop around it/them. Otherwise replicating the reed switch scheme using SOT23-3 NFET's may actually be a straightforward approach, inelegant though it may be.

author: dmendesf
author_rank: Frequent Contributor
timestamp: December 15, 2020, 08:49:58 pm
content: The LDR+led wasn't a joke or some arduinesque contraption, it's a product. Look for VTL5C7, there are others (at least some are sold as Vactrols).

author: dmendesf
author_rank: Frequent Contributor
timestamp: December 15, 2020, 08:54:19 pm
content: Can you put a series resistor (say, 1 ohm) with the FET source to measure the current and close the loop?

author: KaneTW
author_rank: Frequent Contributor
timestamp: December 15, 2020, 08:59:24 pm
content: Digital pots do exactly what you want.

author: IDEngineer
author_rank: Super Contributor
timestamp: December 15, 2020, 09:03:08 pm
content: Quote from: KaneTW on December 15, 2020, 08:59:24 pmYep, and that's the easy way out. I'm just wondering about alternatives. One would be a R-2R ladder with NFET's pulling the legs to ground. I haven't checked the price of digital pot IC's but an R-2R FET solution would be really inexpensive.

author: IDEngineer
author_rank: Super Contributor
timestamp: December 15, 2020, 09:05:30 pm
content: Quote from: bdunham7 on December 15, 2020, 07:53:37 pmYou laugh, but the linear faders of high end analog audio mixing consoles are (were?) done exactly like that. My first reaction upon encountering them was "YUCK!" but then I thought about keeping the analog signal path entirely separate from the gain control and my opinion improved a bit.

author: Ian.M
author_rank: Super Contributor
timestamp: December 15, 2020, 09:15:53 pm
content: Shouldn't be *too* tricky to do.Take a 'classic' OPAMP + MOSFET adjustable current sink, and derive its control voltage from a multiplying DAC fed with a reference proportional to the MOSFET drain voltage.

author: coppercone2
author_rank: Super Contributor
timestamp: December 15, 2020, 10:01:29 pm
content: I think you need to fuse it then because your sensor could electrify something in a controlled but dangerous wayI assume pipe = earth. Don't put any earth resistance unless you figure out exactly what the safety aspect is.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: December 16, 2020, 03:06:26 am
content: A "multiplying DAC" is one thing that comes to mind.Then there are also I2C "digital potentiometers"Another option is to use a DAC and append an opamp and transistor to make a variable current sink.

author: IDEngineer
author_rank: Super Contributor
timestamp: December 16, 2020, 04:52:26 am
content: More: I've scanned the digital pot IC market thinking that might be an easy, single-component way out. There are 1Kohm devices with 100 steps, which we could make work by only using ~25% of its dynamic range (25 steps) to get the ~240 ohm maximum value that this "standard" defines. However, these devices also have a figure of merit called "wiper resistance" which is self-explanatory... and which is well above the 33 ohm minimum value required by the "standard". So even with the device set to "zero" resistance there will still be more resistance than the minimum value. In some cases the wiper resistance is more than the MAXIMUM value of 240 ohms.Yes, we could parallel the device with an external resistance to drop the total but then we'd get some sort of logarithmic response curve. I suppose we could then do a formula, or lookup table, to convert these nonlinear values to their linear equivalents. Jump through enough hoops and maybe it could work.But I've also found that most of them run on 5V supplies (the minimum voltage this resistance must endure is 12VDC, and really more like 16VDC given the automotive environment even with protection circuitry). I didn't find any of low-ish max resistance (remember, our target maximum is 240R) that tolerated anywhere near 16VDC. So I've concluded that a IC-style digital pot would be more trouble than it's worth to make work in this application, and that's presuming it could work at all.As for a "1 ohm source resistor", the max resistance is 33R at one end of the dynamic range so even 1R represents a meaningful percentage. Plus, what current (dropped voltage) do we presume? If the output feeds into a 12V system, we'll get one reading. If it goes into a 5V system, we'll get another. 24V systems are not uncommon in certain automotive environments either. Yes, a workaround here could be an A/D to measure what voltage the resistance is connected to, but it will have to be high value to avoid becoming a significant parallel path to ground (and affecting our resistance).Given the above, the R-2R-FET approach is sounding pretty good. 1% resistors will give us sufficient accuracy. FET's with 30V+ tolerance are commonplace, and the resistors can take anything the FET's can. A 5-6 bit R-2R is only a handful of parts, all of them small and inexpensive. No feedback/closed loop is required. And ultimately, it really is what is desired (a pure resistance to ground) instead of something trying to fake it with various design compromises.Unless some magic solution is proposed, that's the direction I think we're heading here given the constraints. I'd be happy to discard that approach if something better comes along.

author: james_s
author_rank: Super Contributor
timestamp: December 16, 2020, 06:41:22 am
content: How about analog switch ICs paired with resistor networks? It's not particularly elegant, but it's highly customizable and using SMT parts it could be made fairly small. A small microcontroller could convert any number of interfaces to drive the switches.

author: IDEngineer
author_rank: Super Contributor
timestamp: December 16, 2020, 07:44:27 am
content: That's my general plan, except use standalone SOT23-3 packaged FET's to get lower on resistance. I haven't been particularly impressed with the on resistance of analog switch arrays and with a low end of 33 ohms small amounts matter.

author: mikerj
author_rank: Super Contributor
timestamp: December 16, 2020, 07:53:05 am
content: Quote from: Ian.M on December 15, 2020, 09:15:53 pmAgreed, and might also be a good exercise in compensation to make it reliably "resistance" instead of oscillate12/24v also suggests a possible automotive type environment, so the usual supply and input protections will likely be needed. Also will the "sensor" always be on the low side or high side, or could it be either?A very cheap and nasty way of creating variable resistance is switching between the lowest and highest required value resistor via PWM using a FET, to multiply the resistance by the duty cycle. This might be viable if the upstream measurement system has a low enough bandwidth with suitable filtering.

author: IDEngineer
author_rank: Super Contributor
timestamp: December 16, 2020, 08:01:40 am
content: Hadn't even considered PWM. I agree it's nasty in an elegant sort of way - or perhaps elegant in a nasty sort of way. Definitely worth checking to see if it would be compatible. Might be specific to the upstream device. Thanks!

author: Non-Abelian
author_rank: Contributor
timestamp: December 16, 2020, 08:46:47 am
content: Really, the Vactrol mentioned by someone easier is the easiest solution. Vactrols also come in duals with a common center tap so that one can be used as a reference for the resistance you want to control. Look for a VTLC 3/2.

author: SeanB
author_rank: Super Contributor
timestamp: December 16, 2020, 11:09:35 am
content: How about a simple R 2R ladder and some highish voltage (at least 60-80V for automotive, with logic level gate drive) MOSFET switches. That way you have the resistor required, and you just need to have a basic need to drive a n bit DAC to drive it. Resistor values are either one single value of the smallest bit size, with 2 in series for the 2R case, so you just have 3n+1 resistors to place on the board. Otherwise you need a R and a 2R value, and need 2n+1 again, but using a single value is cheaper as all off the same reel could be considered to track reasonably well, so you could get by with a 1% part on a 8 bit converter with almost no added error. 8 bits will exceed the resolution of most indicators anyway, as they are likely sub 8 bit anyway. 10 bits will, to most systems, look exactly like it is a smooth linear sweep in any case. If you need more than 10 bits, you probably need a different measuring system, or the tank is massive.

author: Zero999
author_rank: Super Contributor
timestamp: December 16, 2020, 11:47:21 am
content: Quote from: IDEngineer on December 16, 2020, 04:52:26 amSo use the digital potentiometer and an op-amp + MOSFET to scale down the resistance.https://www.eevblog.com/forum/projects/ptc-resistance-output-from-0-10v-analog-input/msg2454789/#msg2454789https://www.eevblog.com/forum/beginners/voltage-controlled-resistor-options/msg2917762/#msg2917762

author: David Hess
author_rank: Super Contributor
timestamp: December 16, 2020, 11:52:40 am
content: One of the common applications for operational transconductance amplifiers like the LM13700 is making grounded and floating voltage controlled resistors. A voltage controlled resistor can also be made with an analog multiplier/divider.

author: Someone
author_rank: Super Contributor
timestamp: December 16, 2020, 08:32:23 pm
content: Quote from: IDEngineer on December 16, 2020, 08:01:40 amYes, it will depend on how the upstream device creates a test current. For DC applications you can just swamp out the switching with a capacitor and likely assume the output impedance of the source is equal to or higher than the "sensor". If the source is pulsing the test, or has very low output impedance, then its no longer simple/universal.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: December 16, 2020, 08:57:38 pm
content: The electronic load method is to measure the output currentand voltage, and use a set ratio of the two to set the output condition.The classical (constant current) load only measures (and feeds back on) current. The classical (constant voltage) load (shunt regulator) only measures voltage.By mixing the two together, the load characteristic lies somewhere between CV and CC -- a resistance.The challenge then is to vary these proportions electronically. A friend has even created an audio amplifier with this, I believe using OTAs (LM13700) as variable gain amplifiers. (Audio power amps with certain output impedance characteristics, are desirable in the hi-fi crowd: most amps are CV (low Zo), suited to modern low efficiency drivers that need heavy damping; a modest Zo suits vintage speakers, or helps emulate the sound of a tube amplifier; and high Zo (CC) works with some specialty or custom driver types.)You could also take the power DAC approach, which is simply to output a binary number to an array of MOSFETs, sinking an array of resistors, whose values are in binary sequence. (Or use an R-2R network, possibly?) The main annoyance of this method is really just getting a binary sequence of values, while choosing from E96 or whatever series values. Probably a few bits should be spanned by series/parallel combinations to keep the BOM items down (two and four resistors, in series or parallel, spans three bits (5 resistors total), or five bits (13 resistors total) -- not too shabby, but obviously it goes exponentially with span, so one or two levels seems justifiable).Note that the bandwidth may not need to be very much, so that an MCU could sample current and voltage sequentially (at a paltry say 10kS/s or less) and stabilize their ratio in a control loop (PID or whatever).I don't see that it's worth making assumptions on how the outside equipment works. If it tests with a voltage, current or resistance, the amount may vary from case to case, or even over time (supply voltage, resistance drift, etc.). The effect is to require a calibration step (to set up the default voltage and resistance the OE uses), but also to massively increase error sensitivity if the sense method is poorly matched (driving a CC sense with a CC load, or CV with CV). Both issues are easily avoided by performing one offset calibration at factory test (or designing it to a tight enough standard that this is not necessary -- likely, this is quite easy) and using a true-resistance (double feedback) method.Tim

author: Zero999
author_rank: Super Contributor
timestamp: December 16, 2020, 11:07:52 pm
content: Quote from: bdunham7 on December 15, 2020, 07:53:37 pmIt might not be a pure current, or voltage source. It could be just a resistor, with the sensor forming the other part of the potential divider.Quote from: IDEngineer on December 16, 2020, 04:52:26 amHow higher voltage will be across the resistor? 24V into 240R will give a power dissipation of 2.4W!For fun I played around with LTSpice to make a circuit which would convert a 100k digital pot to around 240R, with hardly any voltage across it, but it would need a low-offset, single supply op-amp to work well.It's unnecessary because 30V 10k digital potentiometers exist, such as the AD5290YRMZ10 and MCP45HV51-103 and throw it into the circuit I linked to previously. 256 position is probably more than good enough, as I doubt the requirements are that strict.https://docs.rs-online.com/4426/0900766b816c6cfe.pdfhttps://docs.rs-online.com/86fe/0900766b81380da7.pdf

author: IDEngineer
author_rank: Super Contributor
timestamp: December 16, 2020, 11:19:21 pm
content: Hmm, I will check into those higher voltage digital pots. Thanks for the tip!As mentioned earlier in this thread, we could linearize the curve with an equation or lookup table. The latter could use interpolation if the resolution required it. Honestly I don't think we'll need anything close to high resolution, but linearity is important.What I don't know is the effect of your current sources at the top of the first circuit's R_Upper and the second circuit's M1 drain.I've just confirmed that the customer will send us a sample system. Once we characterize that, we should be able to make informed design choices.Right now my favorite solution is the PWM'd NFET as it gives us better tolerance of voltage/current extremes, much finer control than an R-2R ladder, and reasonable parts count/real estate. But we have to confirm that the receiving system won't go bonkers with the high frequency content.

author: bdunham7
author_rank: Super Contributor
timestamp: December 16, 2020, 11:28:39 pm
content: Quote from: Zero999 on December 16, 2020, 11:07:52 pmI've no idea what equipment OP is working on, but I have seen level sensor systems that have a variable resistance sensor and a meter that operates thermally, with a resistive heater and a bimetallic strip driving the indicator needle. This is how some fuel gauges worked in cars for years, only with a sliding wiper with sparks and all exposed right to the fuel. And the currents were surprisingly high--you are considering the high resistance dissipation, what do you think it would be at 10 ohms? Some other designs used a coil setup that sent a lot less current to the sending unit in the tank. You could theoretically have different systems that used the same sensor unit, but different modes of operation with drastically different currents.

author: IDEngineer
author_rank: Super Contributor
timestamp: December 16, 2020, 11:58:52 pm
content: Quote from: bdunham7 on December 16, 2020, 11:28:39 pmPrecisely my concern with using "sense resistor in drain/source of FET" approaches.

author: David Hess
author_rank: Super Contributor
timestamp: December 17, 2020, 01:15:02 am
content: Quote from: IDEngineer on December 16, 2020, 11:19:21 pmSwitched capacitor techniques can be used to make multipliers which can implement a voltage variable resistor. For example the LTC1043 can be used to make a multiplier.

author: Zero999
author_rank: Super Contributor
timestamp: December 17, 2020, 07:33:47 pm
content: Quote from: IDEngineer on December 16, 2020, 11:19:21 pmI don't understand. There are no current sources in the circuits I posted. I wouldn't recommend using the first circuit anyway. It was just to see if the voltage across the digital potentiometer could be kept very low. The second circuit is much more linear.QuoteThat's the best solution. You might find it doesn't even need to be resistive. A constant voltage/current source might work.QuoteWell you've got to get rid of the power somehow. PWM would definitely be more tolerant of higher voltages. Current is probably the same whichever method you use. The downside of PWM is the noise, but that can be removed with filtering.You could add current limiting to the circuits I posted, with another op-amp and PNP emitter follower to short the MOSFET's gate to 0V, when the voltage across R2 exceeds a certain level. If you go with PWM, you could also limit the current, again by shutting off the transistor, when the voltage across the resistor exceeds a certain level.Quote from: IDEngineer on December 16, 2020, 11:58:52 pmIt should be fairly linear over a large range of currents. The problem will be at low currents, the offset voltage of the op-amp will start to be significant. Use a chunky MOSFET, with frequency compensation and it will be fine from 1mA to a few hundred mA.PWM could also be problematic at lower currents, when the impedance will be higher.

author: IDEngineer
author_rank: Super Contributor
timestamp: December 17, 2020, 07:48:00 pm
content: Here's a bit more on this topic, including a simplified circuit.The requirement is a variable resistance to ground of 33R (minimum) to 240R (maximum). Off condition going to near-infinite resistance is acceptable. The low end makes digital pots difficult since their "wiper resistance" is often a lot more than 33R. The high end is troublesome too since I haven't found any digital pots below 1K. Finally, the potentially high-ish voltages severely narrows the number of potential (no pun intended!) candidates.The PWM approach is appealing for numerous technical reasons. And if we could rely on this being a simple voltage divider application we could likely get away with it. However, a phone call this morning has revealed that there are many existing vendors of the upstream equipment that expect this "variable resistance to ground". Getting access to internal schematics from some of these large, multinational corporations is basically hopeless. And it's easy to imagine input circuits that would be troubled by a PWM scheme. What if they're not filtering all that much (who needs to filter a simple resistance?) and just driving an A/D input? If their S/H samples during a PWM transition and they happen to have "too much" bandwidth, they could get wildly spurious readings. And that's just one possibility.We're trying to get a conference call with the first large corporate customer, but that only addresses THEIR system. We don't want a bunch of custom versions based on customer input designs.I'm going to breadboard this approach and see what some capacitive filtering looks like on a scope. If we drive the PWM frequency high enough perhaps it can be clean enough to be reasonable.EDIT: We've confirmed that the max power rating of the existing devices is 125mW. So while we could be exposed to ~24VDC it cannot be simply a short to the rail, there has to be additional circuitry which limits our total current/power.

author: glentek
author_rank: Regular Contributor
timestamp: December 17, 2020, 08:54:57 pm
content: I used to manufacture those resistance ladder level probes. They always had a converter in the head attached to the probe. This converter was nearly always resistance to current loop. Surely your customer's probe has similar? You wouldn't run long cables to a resistance probe. An off the shelf solution is to replace the converter.

author: IDEngineer
author_rank: Super Contributor
timestamp: December 17, 2020, 09:18:54 pm
content: I'll bet its a current loop, yes, but you'd be surprised what the marine industry will do. They locate these sensors meters away from the input using 24 gauge wire in a big harness carrying all sorts of other signals, hundred amp transients, etc. Ground loops and offsets are standard operating procedure. CAN is black magic bleeding edge technology. We tried really hard to convince them to go with CAN but the existing products from the large multinational companies are apparently cast in stone and cannot be altered. I'm talking systems that get installed on multi-million dollar yachts, from company names that everyone on this site would instantly recognize. I suppose they don't ship a lot of volume (think single digit thousands per year) so there's little incentive to refine the designs. Plus there's limited competition for that market and "Market share means never having to say you're sorry".It's basically retro-engineering to a "standard" that's been around for decades and nobody's willing to change. So we rip out our existing CAN and Rube in some sort of psuedo-compatible "how ya doin'" (in my best Aussie accent).

author: IDEngineer
author_rank: Super Contributor
timestamp: December 17, 2020, 09:22:10 pm
content: Quote from: glentek on December 17, 2020, 08:54:57 pmI just looked up a sample of the industry-standard sensors this would replace. Their interface is exactly two wires: Ground, and resistance out. Period. No local converter in that! And it's "been that way for decades". I suspect this is why they use such a low resistance range... they have to keep the impedance down in an attempt to control noise.We did tell them we'd need +12VDC in for local power. That took some arguing but they finally agreed to run a brand new wire to supply us with power. So our interface will be three wires: +12V, Ground, and resistance out.EDIT: Here's a photo of a typical sensor head. Note the two - only two - wires with a passive 33 (min) to 240 (max) ohms between them. We are allowed to ground one of the wires, thus the other becomes a variable resistance to ground to an unknown input circuit. The one thing we are assured is that our dissipation will not need to exceed 125mW.

author: Zero999
author_rank: Super Contributor
timestamp: December 17, 2020, 10:44:49 pm
content: Quote from: IDEngineer on December 17, 2020, 07:48:00 pmA minimum resistance of 33R makes the op-amp+digital potentiometer topology more viable. The higher voltage drop across the 33R vs that of a 10R resistor, means op-amp the offset voltage contributes less of an error. The maximum power rating of 125mW means the voltage will be limited to 5.5V which increases the range of suitable digital potentiometers. A zener diode could be used to protect against voltage spikes.Where's the filtering on your PWM circuit? You'll need some, as you can't be sure the device will have any.

author: IDEngineer
author_rank: Super Contributor
timestamp: December 17, 2020, 11:11:30 pm
content: Quote from: Zero999 on December 17, 2020, 10:44:49 pmAs I said, it's a simplified "schematic" (almost more of a block diagram) that we threw together to help the conversation with the big company that makes the upstream equipment. We'll derive the filtering once we have something real to measure. You're absolutely correct, we can't be sure the upstream device will have any filtering... in fact that's one of the things that worries me. Hence my earlier comment about them probably thinking "Who needs to filter a simple resistance?".

author: IDEngineer
author_rank: Super Contributor
timestamp: December 18, 2020, 04:05:12 am
content: I spent a while breadboarding the PWM scheme. Results were mixed.First, the bad news. This industry knows to test sensors like this with an ohmmeter. Simple, straightforward, and works fine with passives. But you cannot test the circuit "open" with an ohmmeter because the parasitic capacitances in the FET couple the gate edges to the drain and source. The result is voltage in the drain-source circuit, which the ohmmeter reads as negative resistance and it auto-switches to DCV. This is visible on a scope too; the "output" (top of the 33R) swings below ground at the edges because the circuit is essentially unloaded.When the above circuit is given a pullup to some modest voltage, the voltage divider works as you'd expect. Duty cycle varies the voltage in a predictable fashion. But significant filtering is required, and even with "overkill" filtering (a 10uF tantalum from the center of the divider to ground) and a relatively high PWM rate (100KHz), it's just not practical to adequately filter the output. There's only 33R limiting the charge/discharge current of the filter, so the output is nasty with very visible RC charging/discharging occuring on every gate edge. Even taking the PWM frequency to ~200KHz isn't fast enough to keep up with the charge/discharge rate. And all of this will be far worse in the "several meters of 24 gauge wire" real world environment.Tomorrow I think I'll toy around with a five bit R-2R ladder, and take a closer look at the opamp-FET approach Zero999 posted earlier. The former will yield ~3% steps which should be more than sufficient and will be testable with an ohmmeter, while the latter should eliminate the gate edge coupling problem due to running the FET in its linear range. This project is starting to remind me why railroad tracks have 4ft 8.5in spacing.

author: bdunham7
author_rank: Super Contributor
timestamp: December 18, 2020, 04:24:15 am
content: Quote from: IDEngineer on December 18, 2020, 04:05:12 amYes, it looked like 'one of those' to me at first. The motorized pots are probably looking good by now. I'm just curious--since you are obviously emulating a sensor, what is the replacement signal that your device is receiving that it has to translate to a resitance? Or is this some sort of tester?

author: IDEngineer
author_rank: Super Contributor
timestamp: December 18, 2020, 04:38:49 am
content: One of our specialities is non-contact measurement of fluids in a variety of ways - presence, flow, column height, etc. We have several patents (and a whole lot of trade secrets) on these techniques and the ways we embody them into ready-to-install sensors.Until recently, our sensors used CAN as their output. But our products have become sufficiently well respected that some cross-pollenization is occurring and we're getting requests to use our technology in new and different applications and industries. For example, one version just going into production now incorporates a high current output that can intelligently and directly control large pumps based on our fluid measurement and various programmable parameters. This gives them access to our technology while eliminating the need for expensive standalone pump controllers.We were approached a while back by a co-location equipment company that uses sensors to detect accumulated water on the floors of huge data centers that they design, construct, and maintain for very well-known clients (think of names that might rhyme with "woogle"). That ended up going nowhere because they thought they wanted to connect arrays of such sensors via I2C covering thousands of square meters. We didn't want to be responsible for the failure of unrealistic specifications.Basically we have some sensors. They don't want to change 95% of the design. They just want the back-end 5% to be different so it can plug into an existing environment.This passive resistance interface is the latest "Can you work with our existing environment?" inquiry. Honestly we thought the decades-old variable resistance thing had faded away long ago. But nope, it's alive and well and the "standard" for some extremely large and well entrenched marine industry players. They, their products, and their "standards" are not going away so we must accommodate them. David vs. Goliath.

author: dietert1
author_rank: Super Contributor
timestamp: December 18, 2020, 09:41:11 am
content: Are you having a problem with analog design? Looking at the other threads linked above, the solution has a 33 Ohm resistor, the mosfet, an opamp to enforce resistor behaviour (linearity) and some multiplying DAC or digital potentiometer for generating the analog output, plus few other resistors and capacitors. Maybe you can find a ditigal potentiometer part with integrated operational amplifier. To complicated?You could use the four resistors you want with four mosfets on four digital ports. Your processor should have spare ports. In fact, you could use three mosfets with four resistors 240R, 316R, 68R and 39R, where the 240R is hardwired and the other three are switched.Regards, Dieter

author: T3sl4co1l
author_rank: Super Contributor
timestamp: December 18, 2020, 10:07:07 am
content: Quote from: IDEngineer on December 18, 2020, 04:05:12 amWhile PWM is going to be one of the less effective / accurate methods, we can at least give it a fair run:1. Don't PWM the whole damn thing. Just do what range is necessary. Namely, put 240 ohms in parallel with the terminals, and switch the remaining 38 ohms in parallel with it, with a transistor. (Or 33 in series with 207 and shorting out the 207, either way is fine.)2. Don't use a Fuckoff Huge(R) transistor. I mean, you didn't say what you used, but if it was just whatever power transistor was to hand, that'd obviously be a factor. But even 2N7002 is surprisingly big; and even at ~3 ohms Rds(on), it's not that great to begin with. Preferably find a better transistor; 2N7002 is quite old. Every little bit helps here!There are quite good ones below 30V, like RUM001L02T2CL -- though that may be a bit too low for comfort, for operating range and transient protection purposes; YMMV. Could even use a GaN FET here, I suppose -- just because the drive voltage is low and the capacitance is teensy. A smallish-signal application for a screaming fast switch, why not?Drive it slowly to avoid noise and oscillation issues.3. Add filtering. This is a PWM circuit like any other; we're transforming power, in some manner. Filtering will both help contain charge injection and noise, as well as keep voltmeters happy that might not be so well behaved with all that AC around.We could further investigate charge balancing for the switch. This is a PITA to do with discretes, and probably not production-practical anyway (Cgd varies widely over Vds, and between parts). CMOS analog switches do quite well; it might even pay to use one, even if we only expect unidirectional current flow.Could also maybe bring back the old fashioned inverted BJT -- a mode which has especially low Vce(sat). Probably NMOS does better for a lot less bother, but it would be interesting to demonstrate. Back-burner / desperation option.We still expect poor results for small test signals -- there's always going to be some injection and rectification. If we can identify the magnitude used by typical end systems, that'll show us what ranges we need to optimize for. (This final option straddles the dark line between marketing and engineering, but hey, whatever works.)QuoteYeah, single pole filters stink -- nice thing about this application though, the impedance on at least one port is always moderately well defined. If we take the geometric average, 89 ohms is the impedance we can design around. A three pole (CLC) filter affords, well, a lot of attenuation -- say, < 0.1% ripple for Fc < 10kHz at Fsw > 100kHz. So, uh, let's see, 10kHz and 89 ohms is around 0.18uF and 1.4mH? Probably with the individual capacitors being double that, because networks? And give or take filter prototype, of course.As for 10uF, into 89 ohms that's a cutoff of 179Hz, which should be, hmm, about the same attenuation (~60dB) actually. Well, it will be,with a good enough capacitor.It could be your tantalum had a few ohms ESR, which will limit the attenuation to more like... 28dB? That would match the observation.Hm, I wonder if there's any interesting... or, really, useful at all, physics, driving a filter with a time-dependent source resistance. It could do weird parametric things, on account of the impedance varying during a cycle. Well, not so much with Fc << Fsw, but I don't know an analytical approach to use when Fc ~ Fsw. Such things are very important to switching inverter design, but mainly just simulated, a rather inefficient process unfortunately...Tim

author: IDEngineer
author_rank: Super Contributor
timestamp: December 18, 2020, 05:31:24 pm
content: Quote from: T3sl4co1l on December 18, 2020, 10:07:07 amGood point and I did think of that. If I was careful about device selection I could optimize for gate charge, which would ease the coupling to the drain-source. I could also slow the charge/discharge since we're talking small currents here, just buy off on letting the FET spend more time in its linear region. I may dig into that a bit.But at the moment a straightforward FET-R setup is looking pretty good, given the compromises required by the retro-engineering. If we use a "five-bit" design we'll have a grand total of 11 components, five of which can be small cheap SOT23's and six of which will be SMD resistors. That's pretty hard to beat from a cost and simplicity standpoint. It will also be literally a DC resistance to ground, as close to the original design as possible without using reed relays (!!!). This will allow the greybeards in that industry to continue testing with an ohmmeter, which will reassure them and minimize Customer Support and retraining overhead.

author: Zero999
author_rank: Super Contributor
timestamp: December 18, 2020, 05:46:26 pm
content: If you want good filtering, split the resistor up in to several lower value resistors and use more than one capacitor.

author: IDEngineer
author_rank: Super Contributor
timestamp: December 18, 2020, 05:58:02 pm
content: Yes, to be clear, this was just quick slap-it-together breadboarding to get a very rough feel for how it would work. A more refined design would include better filtering.Before that, I want to experiment with the 5-bit pure resistance approach. My gut tells me that may be the end game here.

author: Renate
author_rank: Super Contributor
timestamp: December 19, 2020, 12:38:08 am
content: Quote from: dmendesf on December 15, 2020, 08:49:58 pmLED? What's that? Raysistors had light bulbs in them.Also, 90 Ω and 180 Ω were quite common in old (US) automotive gauges.The ones I know use a clever dual winding magnetic gauge in a bridge configuration with a fixed resistor.On my Chevy the advantage is that the needle stays on the current position when you turn off the engine.So, is the final design going to work transparently?Even when the mechanic probes it with his ohmmeter with the leads reversed?

author: IDEngineer
author_rank: Super Contributor
timestamp: December 19, 2020, 12:49:18 am
content: Quote from: Renate on December 19, 2020, 12:38:08 amYeah, that's one of many concerns. "Transparently" to the equipment when powered up is probably achievable. But "transparently" in the sense that it can be tested with an ohmmeter while unplugged (and thus unpowered)... several of the approaches discussed here won't do that. It's not a deal killer but it is an argument for a purely resistive approach that at least defaults to one end (33R) or the other (240R) when unpowered. That would mean a technique where there is a fixed resistor in the circuit and whatever switching is done modifies that value via series or parallel elements.Lots of conflicting choices on this one.

author: IDEngineer
author_rank: Super Contributor
timestamp: December 19, 2020, 01:11:53 am
content: @Zero999, on that second circuit you included, does the FET drain have to be connected to your current source? The receiving equipment must provide some sort of voltage (and hence current) to measure our output resistance. With the digital pot going to the opamp's noninverting input I'd think it would control the FET based on the receiving equipment's own current and a local current source would not be needed. The disconnected case would slam the FET fully on, of course, but with the source resistor it would drop back as soon as a connection was made.I'm thinking if the source resistor were increased to 33R then one end of the operating envelope would be (33 + min Rds, e.g. FET fully on) and increased resistance would be backing off the FET drive from the opamp. With the 10R there now the FET would never be fully on. Then again, maybe that doesn't matter since in normal operation it's probably going to be midrange most of the time anyway. And the current (hence dissipation) involved is small even in the linear region.Another thought: Put ~230R in parallel with the FET, and let the FETreducethe total resistance by shunting the 230R. The advantage here is that an ohmmeter would read something even when depowered (not true in the present configuration) and thus reassure the greybeards. With the FET fully off, the total would be 240R (one end of the dynamic range). Would still have the polarity problem, though, due to the FET's body diode.

author: dietert1
author_rank: Super Contributor
timestamp: December 19, 2020, 07:12:44 am
content: Your circuit could become polarity independent using photomos relays, like Panasonic AQY210EHA. You would need two of them on two output ports. Plus four resistors.Regards, Dieter

author: Unixon
author_rank: Frequent Contributor
timestamp: December 19, 2020, 11:58:50 am
content: Quote from: IDEngineer on December 15, 2020, 07:12:11 pmDo you need to make a continuous version of that sensor?

author: Renate
author_rank: Super Contributor
timestamp: December 19, 2020, 02:05:45 pm
content: Two tangental themes:Another case where you have to present a resistance and you have no control on how it's handled is the ID pin in USB.Samsung phones (and others?) senses the ID pin with a 5 bit ADC non-linearly on a resistance from 1.5 k to 330 k.(They use that for various factory modes.)The sense voltage could be very low or even pulsed.I mentioned 90 Ω sensors above.I have a propane tank which had one.The tank is sealed, it has a float on an arm.By its nature it must rotate less than 180°So they gear it up to make a rotation of more like 300°.What rotates is a magnet behind a zinc? plug.The actual readout is just a snap on plastic accessory that goes on the outside of the tank.Rochester (now Manchester?) mades all sorts of pure visual or remote readout gauges.Because of differences in tank shapes/sizes they are mostly the same but they print different scales.The standard remote was just a gratchy wire wound rheostat. Now they offer Hall effect.I just use an Infineon TLV493D 3 axis magnetometer that is glued in an old plastic shell of a gauge.It reads out on I²C and I put it on Modbus.

author: Zero999
author_rank: Super Contributor
timestamp: December 19, 2020, 06:56:46 pm
content: Quote from: IDEngineer on December 19, 2020, 01:11:53 amI1 is just there to represent the test current. It's whatever is measuring the resistance. I chose a constant current for the simulation because it makes interpreting the plot easier, because the voltage in mV will be equal to the resistance in Ohms.The op-amp will adjust the drive to the MOSFET to ensure the voltage on R2 = R3. Putting a resistance in parallel with the MOSFET will make no difference, as long as it's not too lower value.

author: djerickson
author_rank: Regular Contributor
timestamp: December 20, 2020, 01:22:08 pm
content: Lots of ways to skin this cat. If you really need a variable resistor, this basic circuit is used in e-loads to simulate a resistor. It works over a pretty wide range, but the voltage must be positive. Maybe with a Howland current source it could be bipolar? Exercise left to the student.Oops! the resistor equation should be R = Rs / Ratio.CheersDave Ericksonwww.djerickson.com

author: IDEngineer
author_rank: Super Contributor
timestamp: December 23, 2020, 03:20:53 am
content: Update: I've got this working now using PWM and a garden variety 2N7000/2N7002 based on the following changes.1) Slowed the PWM frequency to 50KHz2) Slowed the gate rise/fall time by increasing the external gate resistor3) Added filtering around the entire R-drain-source circuitThat cleaned up the signal and calmed the capacitive coupling from the gate to the channel.Then, at first, I couldn't understand the nonlinear behavior... until I looked at it like a "resistance multiplier" and not just a variable resistor in series with a fixed one. Then the math made sense. 100% duty cycle = value of fixed resistor. 50% duty cycle = 2x value of fixed resistor. 10% duty cycle = 10x value of fixed resistor. And so forth.Now I'm able to install an ohmmeter across the circuit and set the resistance very predictably with firmware. Parts count is low, real estate will be low, behavior is predictable. I can get away with parts of modest tolerance by calibrating in firmware to factor out the tolerance of the fixed resistor and the FET's RDSon (our sensors require calibration anyway so it's barely any extra labor).Thanks for all the feedback, it helped a lot! Special thanks to member "mikerj" for reminding me that PWM would work in this application, which for some reason my blinders had successfully concealed from me! {grin}