Digital to analog resistive circuit

Thread Starter

andre.holgersson@callisto

Joined Jan 18, 2024
16
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!

1709910414294.png
 

crutschow

Joined Mar 14, 2008
34,679
What is the max voltage that is applied to the "Gauge" terminal?
The DOUT voltages will have to exceed that by the Vgs full turn-on voltage of the MOSFETs (at least 2.5V for AO3400 you show).

Otherwise the circuit should work to give you 256 binary resistance steps with a maximum of 255Ω and a minimum of near zero (combined resistance of all MOSFETs when ON).
 

ronsimpson

Joined Oct 7, 2019
3,131
digikey.com has 4000 different digital potentiometers. Here is a 1024 step part.
Many of the pots have 128 steps or 256 and some as little as 16.
They have too high a resistance for you but it is an idea.

For the MOSFETs in your design, I have used the CD4066, CD4051, 52 or 53. More ideas.
What is the current in the resistors?
What are you making?

1709913419717.png
 

Jerry-Hat-Trick

Joined Aug 31, 2022
574
You can get digital pots down to a value of 1.0 KOhm (maybe lower, I'm not aware) although at best they are +/- 20% accurate. Maybe try two in parallel, (maybe each in series with a different fixed resistor) which will give you a huge range to tweak/calibrate values you want by making them different values.
 

tonyStewart

Joined May 8, 2012
132
Let's refine your specs.
Output: 240ohm = min, 33 ohm = max
Resolution: 8 bits, Accuracy < 1 bit
Input: digital, parallel or maybe serial
Hardware: THT or SMT, likely THT in sockets.
Input Voltage: ?, Output Voltage: ?
Supply Voltage: 5? 12? or 11.5 to 14.5? or x?
 

Jerry-Hat-Trick

Joined Aug 31, 2022
574
The one in post #5 states the tolerance is 1%.
But it does require a serial interface to control the resistance.
I saw that, but its minimum value is 20kΩ which is far higher than the TS is looking for. I think the wiper resistance in digital pots is an issue which I believe is why they are not available in low values - I'm not familiar with the internals. The digital pots I've used all had a serial interface to control the value - is there another way?
 

Thread Starter

andre.holgersson@callisto

Joined Jan 18, 2024
16
What is the max voltage that is applied to the "Gauge" terminal?
I'm not sure. I will have to measure the signal. Probably not very high voltage. A guess is something like 5V. The "Gauge" is actually a tank level input on a Victron Cerbo GX. The only thing the manual says is "The tank level inputs are resistive and should be connected to a resistive tank sender. Victron does not supply tank senders. The built-in tank sensor connections do not support mA or 0-5V type sensors, this type will require additional accessories or replacement with a resistive type sensor."

The DOUT voltages will have to exceed that by the Vgs full turn-on voltage of the MOSFETs (at least 2.5V for AO3400 you show).
Otherwise the circuit should work to give you 256 binary resistance steps with a maximum of 255Ω and a minimum of near zero (combined resistance of all MOSFETs when ON).
The MCU outputs 3.3V, so that is what the PCF8674 will output, unless I use a level converter to "ramp it up" to 5V.
I take it my idea is sound then?
 

ronsimpson

Joined Oct 7, 2019
3,131
Assuming the Gauge voltage is in the range of 0 to 5V. The Gate to Source voltage on the MOSFETs needs to be about 5V and not more than 10V. So I think the Gate voltage should be 0 and 10V. The 3.3V or 5V will not work.
 

Thread Starter

andre.holgersson@callisto

Joined Jan 18, 2024
16
digikey.com has 4000 different digital potentiometers. Here is a 1024 step part.
Many of the pots have 128 steps or 256 and some as little as 16.
They have too high a resistance for you but it is an idea.

For the MOSFETs in your design, I have used the CD4066, CD4051, 52 or 53. More ideas.
What is the current in the resistors?
What are you making?

View attachment 317192
Thanks, but I have thought of that. The lowest resistance digipot I have found is 1KΩ, so a single digipot won't do it. I would have to use a couple in parallel, and in that case it would be cheaper and simpler to use mosfets and resistors.
 

Thread Starter

andre.holgersson@callisto

Joined Jan 18, 2024
16
Assuming the Gauge voltage is in the range of 0 to 5V. The Gate to Source voltage on the MOSFETs needs to be about 5V and not more than 10V. So I think the Gate voltage should be 0 and 10V. The 3.3V or 5V will not work.
I see. Of course it wouldn't work out that easy... Do you know of any other MOSFETs that would work with a 3.3-5V gate voltage?
 

ronsimpson

Joined Oct 7, 2019
3,131
Do you know of any other MOSFETs that would work with a 3.3-5V gate voltage?
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.
1709932798015.png
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.
1709933098648.png
You might look at G3VM-31HR1 .
 

dendad

Joined Feb 20, 2016
4,493
1709933717437.png
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.
 
Last edited:
Top