voltage ladder with SPST

Thread Starter

ofiryaish

Joined Jan 10, 2018
25
Hey,
I got a problem. I got only 4 SPST switches and I need 16 kind of voltage. I was trying to solve this with voltage summer using op amplifier, but the problem is that I need 16 kind of voltage from 3 to 5 volts, so it's quite impossible to do it with op amplifier.

do you have to solution for this?
 

LesJones

Joined Jan 8, 2017
4,511
Another possible solution would be to have 4 resistors in series with each shorted out by a switch. The total resistance would be the sum of the resistors the had it's parallel switch open. The chain of resistors would ve fed from a constant current source. So if for example the resistors were 1K, 2K, 4K and 8K and the constant current was 1 mA you woul be able to get 0 to 15 volts in 1 volt steps. By choosing the resitor values and contant current value you should be able to get the steps that you want. It would need to be buffered by an op amp configured for non inverting unity gain. (Or another chosen gain value.)

Les.
 

crutschow

Joined Mar 14, 2008
38,515
You could also use the parallel circuit below with a voltage input (Vref).
The output on the right is a current that can go to the summing (minus) input of an op amp.
An opamp feedback resistor equal to 0.5333R will then give a full scale output voltage (all switches closed) of Vref.
The disadvantage of this circuit is that, for a positive output, Vref must be negative

upload_2018-12-31_13-10-18.png
 

Thread Starter

ofiryaish

Joined Jan 10, 2018
25
You could also use the parallel circuit below with a voltage input (Vref).
The output on the right is a current that can go to the summing (minus) input of an op amp.
An opamp feedback resistor equal to 0.5333R will then give a full scale output voltage (all switches closed) of Vref.
The disadvantage of this circuit is that, for a positive output, Vref must be negative

View attachment 166879
I used it as you told, but it was really hard to chose the suitable resistor values.
how did you calculated it? I need to understand in order value other ranges, for example 2.5V to 5V
thank you
 

danadak

Joined Mar 10, 2018
4,057
Something like this ...

upload_2018-12-31_19-7-50.png

To calc compute the ratio needed for low V with all
switches open. Eg. for 2.5V ratio needed is 2.5/5.0 =
1/2. Then pick any convenient value for last R to
ground. Say 5K. Then 5K / (5K + xK) = 1/2, solve for x.,
In this case x = 5K, that has to split equally between the
4 Rs associated with switches. 1250 ohms each.


Regards, Dana.
 
Last edited:

crutschow

Joined Mar 14, 2008
38,515
Here's a circuit using SPST switches and an op amp to give a 4-bit binary sequence (16-levels) with 156mV steps from 2.5V to 4.84V.
The resistors change the non-inverting gain of the op amp in a binary sequence.
The test sequence is generated by binary counter U2.
For the required resistor values you can use all 10kΩ resistors and connect them in series or parallel to get the other values.

upload_2019-1-1_0-26-50.png
 

Thread Starter

ofiryaish

Joined Jan 10, 2018
25
Here's a circuit using SPST switches and an op amp to give a 4-bit binary sequence (16-levels) with 156mV steps from 2.5V to 4.84V.
The resistors change the non-inverting gain of the op amp in a binary sequence.
The test sequence is generated by binary counter U2.
For the required resistor values you can use all 10kΩ resistors and connect them in series or parallel to get the other values.

View attachment 166908
very nice. if I want to connect 4 leds indicate if the switch is on or off how I can do it?
when concocting them in parallel to the resistors the output is getting messed up.
 

danadak

Joined Mar 10, 2018
4,057
You can go two directions here. One use quad comparator to detect V
out of the network and turn on LED. You have to do an error budget
to make sure you choose feedback resistor tolerance so that it matches
up to switch closure.

The other, a low end micro, just connect 4 switches to it, and 4 leds + R
to limit current in LED, small amount of code, and you are in business
with no other external parts like OpAmps, Comparators. You will also
have less error issues to deal with on tolerance since LED becomes
direct function of a switch closure detected.

ATTINY2313/4313 good choice. Could use Bascom Basic to write the
code. Or a microchip part. Or PSOC -

upload_2019-1-1_7-12-49.png

The schematic, everything is onchip, except switches, Rs, and LEDs.
Accuracy of Vout is +/- 10% for a PSOC 4, or +/- 2.5% for a PSOC 5.
Or if more accuracy needed using a PWM and onchip Vref and SAR
could do ~ +/- .1%. Note a lot more of the chip unused as you can see
in the resources used window, right hand window.



Regards, Dana.
 

crutschow

Joined Mar 14, 2008
38,515
if I want to connect 4 leds indicate if the switch is on or off how I can do it?
Another option is to use a logic-level N-MOSFET (fully turned on with Vgs=2.5V) with the LED connected from drain to V+, and the source to ground.
Move the switches to the top side of the resistors with the other resistor side to ground, and connect the MOSFET gates to the switch-resistor node.
The MOSFET will then turn on and light the LED when the switch is closed.
 

graybeard

Joined Apr 10, 2012
118
FYI, danadak's circuit is how most automotive companies multiplexed steering wheel button signals onto one wire going through the clockspring mechanism until recently. Now they are starting to use a ucontoller in the steering wheel and running a CAN bus through the clockspring.
 
Top