need advice on pull-up pull-down converter

Status
Not open for further replies.

T3STY

Full Member level 4
Joined
Apr 17, 2012
Messages
239
Helped
24
Reputation
48
Reaction score
24
Trophy points
1,308
Visit site
Activity points
3,715
need advice on pull-up pull-down switch circuit

I need to design a circuit for a push button which, when pressed, should behave either as a pull-up or pull-down. So I though of a simple NPN -based circuit that simply swaps the V+ and GND lines across a pull-down circuit.

What happens is this: SW1 selects between 5V or GND. The transistor acts as a NOT gate. Between SW1 and the NOT output I have either [5V; GND] (pull-up) or [GND; 5V] (pull-down). The pull-up/down is formed then with the resistor-SW2 circuit. I have simulated the circuit in a circuit simulator, and it works.

However, I'd like to know from you if there are any alternative/better solutions to this? Can you identify any side-effects of this circuit or tell me why I should not use it?
 

As I said before, the transistor acts as a NOT gate. It's use is to swap the output based on the input, so I can use a resistor-switch circuit as either pull-up or pull-down. The difference between the latest in fact is they have inverted V+ and GND. The transistor helps doing that.
You might be right, if you use a double-push-double-trigger (DPDT) switch (which has two separate switching rails) you can easily swap V+ and GND. But instead I need to use SPDT switches which can't do that (they have a single switching rail).
 

:thinker:
Me neither............

You have a single load (Rl) a SPDT switch with the ends connected to Vcc or Gnd via a resistor, would accomplish the same, wouldn't it?
 

Not if I want to switch between a pull-up or pull-down output.
The pull-up/down circuit on the output must act either as default high or default low. Then, when you press the button "SW2" it should:
if default high => act as pull-down, switch the output to GND.
if default low => act as pull-up, switch the output to Vcc.
In order to make a single resistor-switch circuit act as pull-up and pull-down you need to swap Vcc and GND. I have made this schematic that shows what happens when SW1 is either high (on the left) or low (on the right).


Now, either I didn't understand you, or you didn't understand me... please let me know. Maybe provide an example schematics that would do the same without a transistor.

- - - Updated - - -

So you need both the normal and inverted signal at the same time?
Sorry, I didn't see your post before.
No, obviously, not *at the same time*. that wouldn't be possible What I meant is that I want to be able to choose if the button should act as pull-up or pull-down using the switch SW1.
 

By "at the same time" I meant two separate outputs.

Still confused. I don't see SW1. Is SW2 the push-button or some other switch?
 

Refer to the original schematic in my first post. SW1 is on the middle left. SW1 is the (toggle) button that I use to select between pull-up and pull-down. When SW1 is high it creates the pull-up circuit that you see on the left side in my previous post. When it's low it creates the pull-down circuit on the right side.

Listen buddy, I have written the whole think again and again and I think I'm unable to explain what I mean. So instead of repeating myself for next 10 posts, I'll attach here a Flastad circuit simulator circuit file that you can load and see for yourself what it does. As I said it's working but I want to know if there are any downsides, I'd very much appreciate that.
 

Attachments

  • PUPDOWN.txt
    733 bytes · Views: 87

Okay, now that I understand which one is the pushbutton I see what you are doing. If the circuit seems to do what you want then I see no problem.

You could perform a similar function with an XOR gate such as the CD4070. When one of the two inputs is low, the output follows the other input. When one of the inputs is high, the output is inverted from the other input.
 

I am in agreement with crutschow - unless you need to avoid an IC and use all those discrete parts, several kinds of logic gates or CMOS parts would work fine.
A potential downside of your implementation is that you have no current limiting through the switch, except for whatever it has for internal resistance. As long as the switch chosen is specifically a "break before make" design, you are OK, but if it isn't or the switch wears and starts to make ground contact before breaking the +5V contact, there can be arcing/damage.
 

I'll attach here a Flastad circuit simulator circuit file that you can load and see for yourself what it does. As I said it's working but I want to know if there are any downsides, I'd very much appreciate that.

I loaded your schematic into Falstad's. It works as you describe.

Depending on how the SPDT switch is set, it provides either:

(a) direct connection to supply+ when push switch pressed,
low impedance to ground when idle,

or

(b) direct connection to ground when push switch pressed,
low impedance to supply+ when idle.

The transistor conducts a lot of current in scenario 'a'.
 

Thank you for your feedback guys!
The reason I have avoided using ICs is that they usually can't provide more than 30mA current on each pin. I might need instead up to 5V 100mA outputs. Do you know any ICs that can handle that?
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…