Digital to analog resistive circuit

Thread Starter

andre.holgersson@callisto

Joined Jan 18, 2024
16
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...
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.
Its a good idea to have an additional resistor in series to prevent accidental short. But what would I gain by having the resistors in parallel?
 

dendad

Joined Feb 20, 2016
4,641
The 240R sets the max resistance when the FET is off. And when the FET is on, the minimum resistance is 240R in parallel with 39R = 33R5.
That is about the range you specified. If you remove the 240R, then you can test for an open sensor so that may an an idea, and the PWM signal will need to be set to simulate a 240R reading.
As it is, the FET could be replaced with a switch and it would then allow just full and empty readings.
 

Thread Starter

andre.holgersson@callisto

Joined Jan 18, 2024
16
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Ω.
Right.. And assuming that I use resistor values 66Ω, 120Ω, 264Ω, 528Ω, 1056Ω, 2112Ω, 4224Ω, 8448Ω, how would I know what bits to use for a specific value?
 

AnalogKid

Joined Aug 1, 2013
12,160
In terms of simulating a resistor value within a given range from 33 to 240 ohms, how many different resistor values do you need to synthesize? A range or 30 to 240 is exactly 8:1. If the minimum step size is 30 ohms (30, 60, 90, 120, etc.) then this can be simulated with just three binary-weighted resistors. If you need finer resolution, such as 1 ohm (30, 31, 32, 33, etc.), then you need 8 binary-weighted resistor values, or an 8-bit D/A, to cover the range (from 1 to 255 ohms).

Between the min and max resistor values, how many individual set points do you need?

ak
 

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
I finally decided to use your solution. It worked like a charm! Thanks for your helpful suggestions. I ended up with the following circuit.

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
Thanks for your helpful suggestions. I ended up with the following circuit. It turned up to be a lot cheaper to use pre-fabricated modules for power and I/O instead of "inventing the wheel" on my own. Hopefully someone else can learn from this and come up with a even better solution.
1712343874762.png
 
Top