Digital to analog resistive circuit

Thread Starter

andre.holgersson@callisto

Joined Jan 18, 2024
16
You could add a NPN buffer transistor at each output with the collector load resistor connected to a 7.5V or 10V power supply.
As what I have read about transistors, they often lead to usage of additional transistors. Could you please supply a example circuit for this? And perhaps the part number of a suitable NPN buffer transistor? It would be much appreciated, As said in the beginning, I don't have much experience with transistors. I tend to avoid them, but this could be a good opportunity to actually learn how/why and when to use them in a real life circuit.
 

Thread Starter

andre.holgersson@callisto

Joined Jan 18, 2024
16
The problem is that the Source of the MOSFET could be near 5V. With the S at 5V the Gate needs to be 5V above that. It is not the voltage from Gate to Ground but the voltage from Gate to Source that turns on a MOSFET.

I got some of these boards for $9.00. They work directly connected to a micro (3.3 or 5.0). A relay does not have the problem the MOSFETs does. The relays are good for 10A and 500 volts which is over kill. There are several different kinds on the market.
View attachment 317206
There are also solid-state relays that are much smaller. I just picked one at random. You drive it like a LED then add a resistor. This one has 16 ohms of on resistance which is too much, but this is an idea.
View attachment 317207
You might look at G3VM-31HR1 .
A 8ch relay board would be to big and would probably not be silent enough to be accepted by the admiral (Wife), but the G3VM component might do the trick. I'll have to read up on the details.
 

Thread Starter

andre.holgersson@callisto

Joined Jan 18, 2024
16
View attachment 317209
As it is just a gauge, would something like this work?
I could be tested with a switch in place of the FET. The 39R will maybe need to be a 5W resistor.
Sadly it probably wouldn't work. The "gauge" is a microcontroller device and regarding the input they pretty much rule out anything other than a resistive input. "Sensor connections do not support mA or 0-5V type sensors, this type will require additional accessories or replacement with a resistive type sensor." Thanks for the idea though.
 

Thread Starter

andre.holgersson@callisto

Joined Jan 18, 2024
16
Is the gauge an automotive gauge by any chance? One with a hot-wire meter?
If so, you can use PWM and a single resistor.
The "gauge" is a microcontroller device and regarding the input they pretty much rule out anything other than a resistive input. "Sensor connections do not support mA or 0-5V type sensors, this type will require additional accessories or replacement with a resistive type sensor." Thanks for the idea though.
 

AnalogKid

Joined Aug 1, 2013
12,158
My read of post #1 and #24 is that you want to simulate a *resistance* to GND, as seen by the gauge, not a voltage or current. Is that is correct?

If so, then the next question is - does the downstream input expect a varying resistance to GND, to Vbat, or something else?

ak
 

Thread Starter

andre.holgersson@callisto

Joined Jan 18, 2024
16
My read of post #1 and #24 is that you want to simulate a *resistance* to GND, as seen by the gauge, not a voltage or current. Is that is correct?

If so, then the next question is - does the downstream input expect a varying resistance to GND, to Vbat, or something else?

ak
Correct. It is a RESISTANCE that I want to simulate. The answer to question no 2 would be a varying resistance to GND. Pretty much all resistive sensors work that way.
 

crutschow

Joined Mar 14, 2008
38,534
Could you please supply a example circuit for this? And perhaps the part number of a suitable NPN buffer transistor?
Below is a one transistor, common-emitter inverter circuit acting as a switch, to generate a high output to the MOSFET's gate equal to the supply voltage at R2.

The transistor shown is a common NPN part that is appropriate, but just about any small NPN will work.
(You can buy dual versions of many small transistors in a single, surface-mount package, to reduce part count if you like).

Note that this circuit inverts the signal, since when the transistor input from the PFC857 is low (turning 0ff Q1), then its collector output is high through R2 from its supply voltage, to turn on the MOSFET
Similarly when the transistor input is high (turning on Q1 which conducts R2's current to ground), then the output is only a few tenths of a volt, turning off the MOSFET.

Make sense?

1709944909271.png
 
Last edited:

Ian0

Joined Aug 7, 2020
13,158
The "gauge" is a microcontroller device and regarding the input they pretty much rule out anything other than a resistive input. "Sensor connections do not support mA or 0-5V type sensors, this type will require additional accessories or replacement with a resistive type sensor." Thanks for the idea though.
It might be just worth a try. It does see a resistance. It is samples the resistance and averages it, it might actually work. Without knowing the algorithm it uses, it is difficult to know, but I would guess that there is some averaging going on, especially if it is used with tank-level sensors.
 

AnalogKid

Joined Aug 1, 2013
12,158
A problem with the circuit in #1 is that the I2C expander might not be able to produce a high enough gate voltage for the FETs toward the top of the string. One way around this is to add an 8-bit 12 V driver circuit such as a ULN2803 octal driver plus a resistor network.

If you really want 255-step adjustability, there is another way:

https://en.wikipedia.org/wiki/Resistor_ladder

Question for the TS: If you replace the sensor with a pot, and adjust the pot from 33 ohms to 240 ohms, what are the max and min voltages across it?

Also, do you really need 255-step adjustability? If all you need to verify performance are tests at max, median, and min, things area whole lot easier.

ak
 
Last edited:

Thread Starter

andre.holgersson@callisto

Joined Jan 18, 2024
16
Below is a one transistor, common-emitter inverter circuit acting as a switch, to generate a high output to the MOSFET's gate equal to the supply voltage at R2.

The transistor shown is a common NPN part that is appropriate, but just about any small NPN will work.
(You can buy dual versions of many small transistors in a single, surface-mount package, to reduce part count if you like).

Note that this circuit inverts the signal, since when the transistor input from the PFC857 is low (turning 0ff Q1), then its collector output is high through R2 from its supply voltage, to turn on the MOSFET
Similarly when the transistor input is high (turning on Q1 which conducts R2's current to ground), then the output is only a few tenths of a volt, turning off the MOSFET.

Make sense?

View attachment 317225
 

AnalogKid

Joined Aug 1, 2013
12,158
When configured correctly, an R-2R ladder can sink a binary-weighted current to GND that appears to the outside world as a varying resistance.

To the TS: What is the open-circuit voltage at the input pin of whatever this circuit is driving?

ak
 

Ian0

Joined Aug 7, 2020
13,158
When configured correctly, an R-2R ladder can sink a binary-weighted current to GND that appears to the outside world as a varying resistance.

To the TS: What is the open-circuit voltage at the input pin of whatever this circuit is driving?

ak
The R-2R ladder appears as fixed source resistance to a variable voltage, with the resistance equal to the value of R.
 

Ian0

Joined Aug 7, 2020
13,158
Hi!
I am trying to create a variable resistance circuit to simulate a resistive sensor that outputs resistance 240-33ohm range. (240ohm = min, 33 ohm = max)
Would the following circuit fly? The idea is to digitally control the resistance by turning AO3400 N-channel MOSFETs on/off and thereby bypass/connect different resistors to acquire the wanted resistance value.
Sadly, have no previous experience with transistors, and even after watching numerous YouTube videos I don't feel a bit wiser. I'm not even sure if I have drawn the transistor pins correctly? Some help would be much appreciated!

View attachment 317186
Can you cope with a system that is linear in CONDUCTANCE (reciprocal law in resistance) rather than linear in RESISTANCE?
If so you can put the MOSFETS in parallel, with all the sources joined to ground, and the resistor in each drain.
Toshiba makes a MOSFET array called TBD62183 that is pin-compatible with the ULN2803.
 

AnalogKid

Joined Aug 1, 2013
12,158
The R-2R ladder appears as fixed source resistance to a variable voltage, with the resistance equal to the value of R.
Correct. But -

My read of the device is that it does not want to be fed an external current (IOW, it doesn't read the voltage across an internal input resistance to GND) and it doesn't want a low impedance voltage source impressed on it. I see it as an internal pull-up resistance to a regulated internal reference voltage as the upper end of a voltage divider, with the lower end of the divider to GND provided by the external sensor. IOW, the device input is a current source, requiring an external resistive path to GND to sink current out of it.

If all of that is correct, then a "fixed ... resistance to a variable voltage" will appear as a variable resistance to GND as long as the actual external voltage always is below the open circuit voltage of the input.

ak
 

Ian0

Joined Aug 7, 2020
13,158
Correct. But -

My read of the device is that it does not want to be fed an external current (IOW, it doesn't read the voltage across an internal input resistance to GND) and it doesn't want a low impedance voltage source impressed on it. I see it as an internal pull-up resistance to a regulated internal reference voltage as the upper end of a voltage divider, with the lower end of the divider to GND provided by the external sensor. IOW, the device input is a current source, requiring an external resistive path to GND to sink current out of it.

If all of that is correct, then a "fixed ... resistance to a variable voltage" will appear as a variable resistance to GND as long as the actual external voltage always is below the open circuit voltage of the input.

ak
Agreed.
We're not absolutely sure what the TS is doing. I assume that he wants to fool a gauge into thinking that it has a resistive sensor attached, and wants to "dial in" various resistance values according to some other input.
I'm thinking it's some "automotive"-like gauge that connects to Vbatt and it sensor is a resistance to ground. (I may be wrong)
We know that Rsensor varies between 33Ω and 240Ω. Does he know the resistance he wants to simulate, or does he know the voltage that should appear across the sensor?

I was thinking that if he knows R then he also knows G, which will vary from 4mS to 30mS (and few of these senders are linear), then it is easier to simulate the conductance with parallel resistors than simulating the resistance with series resistors, and probably easier than simulating it via a voltage source and output impedance.
It's all rather vague. . . .
 

dendad

Joined Feb 20, 2016
4,641
I would give the PWM idea from post #19 a test as that may well work and is simple, but otherwise, try this sort of thing...
FuelGuage2.jpg
The 27R is to prevent a short to gnd as that may damage the gauge. This resistor selection will allow a little lower and higher that the sender values.
 

Ian0

Joined Aug 7, 2020
13,158
I would give the PWM idea a test as that may well work and is simple, but otherwise, try this sort of thing...
View attachment 317292
The 27R is to prevent a short to gnd as that may damage the gauge. This resistor selection will allow a little lower and higher that the sender values.
Exactly what I suggested.
The lowest value required is 33Ω, so the first resistor should be 66Ω (in theory) and the 27Ω is not required.
As it is linear in conductance and not resistance, the available values get further apart for high resistances.
The highest is 283Ω on your circuit, but the next highest is 155Ω.
If you start with 66Ω then 240Ω is achieved with 264Ω||8448Ω||4224Ω, the next nearest values either side being 248Ω and 234Ω.
 
Top