Digitally switch between two resistance values

Thread Starter

LordOfThunder

Joined Jun 27, 2018
67
Hello!
I have to modify an already existing circuit so that it can switch between two resistance values (more details below).
Because I do not have a lot of experience, I would be grateful if you gave me some feedback about the validity and soundness of the design.
Assuming the validity of the design, how do I achieve the requirement 7?

In the current design, the R5 resistor is used to tune the value of the output current of a fixed current source IC. I need to switch (by firmware) between two values of the output current. By firmware, I mean using a PIC microcontroller. The U1 IC is already fixed by design and cannot change. Hence the need to switch between two values of the R5 resistor.

Below are the circuit requirements and goals.
Goal:
  • Using a GPIO pin of a PIC microcontroller, switch between two values of the equivalent resistance of R5 and RA.
Requirements:
  1. 1) The equivalent resistance should be X = 4.3 kOhm or Y = 1 kOhm
  2. 2) The value of X = 4.3 kOhm is finalized. The value of Y = 1 kOhm is not finalized yet (it might be as low as 500 Ohm).
  3. 3) Cannot change V1 and U1
  4. 4) The space on PCB is very limited so the least area and least number of components should be used
  5. 5) The switch does not need to be fast (the switch will likely operate only once or twice)
  6. 6) The switch has to be controlled by a GPIO pin of a PIC
  7. 7) A digital low on the PIC pin should correspond to Y = 1k (I am failing here, for the time being)

Screenshot from 2021-04-23 20-47-34.png
 
Last edited:

crutschow

Joined Mar 14, 2008
27,697
The above circuit should work, but the MOSFET you have selected has a maximum on-resistance of 6 ohms.
That will increase the equivalent resistance about 0.6%, so if that is more than you want, you could use a lower on-resistance device.
There are many available that are well below an ohm.
 

AnalogKid

Joined Aug 1, 2013
9,351
In a small-signal application like this, I think you can eliminate Rb. A lightly-loaded PIC output pin should swing close enough to GND to turn off Qa. However, the BSS138 minimum threshold voltage is 0.8 V, an exceptionally low value. Rc should help pull down the gate. If turn-off speed is not critical, then having the PIC GPIO pin go open-circuit rather than low will assure that Rc turns Qa completely off.

Note that with 5% tolerance resistors (indicated by the values on the schematic), the Qa 6 ohm Rdson will be lost in the error bands of the other components.

In fact, that 6 ohms pulls the total equivalent resistance closer to the desired 1.000000K (assuming all of the other resistances are perfect).

ak
 

DickCappels

Joined Aug 21, 2008
7,690
You could use a small realy. As a late friend of mine used to say: "Fix it with feedback".

1619202640200.png

You can place one resistor in series with CD4066 pin 8 and the other in series with CD4066 pin 11 instead of the 30.1 ohm.
 

Thread Starter

LordOfThunder

Joined Jun 27, 2018
67
The above circuit should work, but the MOSFET you have selected has a maximum on-resistance of 6 ohms.
That will increase the equivalent resistance about 0.6%, so if that is more than you want.
There are many available that are well below an ohm.
Thank you for pointing it out. Given the application, around 10-20% accuracy is more than enough so the MOSFET equivalent resistance can be regarded as negligible.
 

Thread Starter

LordOfThunder

Joined Jun 27, 2018
67
In a small-signal application like this, I think you can eliminate Rb. A lightly-loaded PIC output pin should swing close enough to GND to turn off Qa. However, the BSS138 minimum threshold voltage is 0.8 V, an exceptionally low value. Rc should help pull down the gate. If turn-off speed is not critical, then having the PIC GPIO pin go open-circuit rather than low will assure that Rc turns Qa completely off.

Note that with 5% tolerance resistors (indicated by the values on the schematic), the Qa 6 ohm Rdson will be lost in the error bands of the other components.

In fact, that 6 ohms pulls the total equivalent resistance closer to the desired 1.000000K (assuming all of the other resistances are perfect).

ak
Thank you for the hint. Because space is tight, losing the RB resistor is something that I would gladly do.
 

Thread Starter

LordOfThunder

Joined Jun 27, 2018
67
Is this some kind of Homework or School Project?
No, it is not. I work as a researcher in Physics, so my knowledge of electronics is not very deep and I sometimes need a helping hand or feedback. I found people on this forum to be very helpful and friendly, that is why I posted this seemingly trivial question.
I hope you would forgive me a certain degree of noobness, as much as I would forgive you for not being familiar with the details of loop quantum gravity just to make an example.
 

Thread Starter

LordOfThunder

Joined Jun 27, 2018
67
You could use a small realy. As a late friend of mine used to say: "Fix it with feedback".

View attachment 236499

You can place one resistor in series with CD4066 pin 8 and the other in series with CD4066 pin 11 instead of the 30.1 ohm.
I am trying very hard to understand how should I use this circuit but I am unsure about the role of the two "Ref. 0 Ohm" and "Ref. Resistor" lines. I am sorry but could you please elaborate a little on that? I understand what is and how a CD4066 multiplexer works. I just do not understand the meaning of "Ref. 0 Ohm" and "Ref. Resistor".
 

DickCappels

Joined Aug 21, 2008
7,690
The circuit as drawn presents a resistance of either 0
Ohms to zero an offset or 13.1 ohms gain calibration to the test circuit. It can be any two resistances or reactances which are referred to the + input of the opamp which is connected to a virtual ground at +2.5 volts.

The two control imputs to the transmission gates re CMOS level digital signals that detrmine which resistance will be used.

For what purpose do you want to switch resistances?
 

Thread Starter

LordOfThunder

Joined Jun 27, 2018
67
@DickCappels Thank you very much for the explanation. I was able to understand the circuit (more or less) and implement it in LTspice.

For what purpose do you want to switch resistances?
I am using an LT3741 (U1 in the figure) constant current source to drive a current of about 900mA over a load of 3Ohm.
To tune the current value a resistor R5 of 4.3 kOhm is used, as shown in the top figure of the first post.
This is already done and tested both in simulation and on PCB. The P1 pin in the figure corresponds to the CTRL1 pin of the LT3741.

Now, I need to switch between two values of the output current: 900mA as before and another new value of about 100mA. The LT3741 cannot be changed, so to achieve the goal I thought about digitally switching the R5 equivalent resistance between 4.3 kOhm and a lower value of about 500kOhm. The precise values are not critical.

I have simulated the circuit you proposed in LTspice and it is working as expected both without the opamp (using the real ground instead of the virtual ground) and both with the opamp. The little difference in equivalent resistance between the two schematics is not relevant for this kind of application. So my next question is what are the advantages of using the virtual ground instead of the real one?

Below the two simulated circuit schematics. The V2 voltage source is fixed. The V5 voltage source comes from one GPIO pin of a PIC microcontroller and can be low or high depending on which resistor needs to be selected.
Screenshot from 2021-04-25 18-06-57.png

Screenshot from 2021-04-25 18-11-06.png
 
Last edited:

DickCappels

Joined Aug 21, 2008
7,690
In the application from which the circuit came there were many analog circuit and I really did not want to generate a negative power supply, so I split the power supply at 50%. The 50% point is the common ground for the analog circuits.

900 ma would require a pretty hefty op amp or buffer.
 

Thread Starter

LordOfThunder

Joined Jun 27, 2018
67
In the application from which the circuit came there were many analog circuit and I really did not want to generate a negative power supply, so I split the power supply at 50%. The 50% point is the common ground for the analog circuits.

900 ma would require a pretty hefty op amp or buffer.
Now everything is clear. Thank you.
 

Thread Starter

LordOfThunder

Joined Jun 27, 2018
67
Thank you to everybody for the suggestions. I think that I am satisfied with this couple of designs. I am going to discuss them with my mentor.
 

atferrari

Joined Jan 6, 2004
4,424
Coming late to the party, I recalled this circuit suggested for the LM317 in its original datasheet.

20210425_141603.png

Used a similar one (with capacitors) in a switched caps filter.

Planned to draw something closer to the required application but today I can't. Essential tremor is not the best. Sorry.

If found to much off track, please let me know.
 
Last edited:
Top