Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Switching Logic Outputs

Status
Not open for further replies.

JoeWawaw

Member
Hi
I'm designing a circuit, and there's one little problem. I basically want to have two outputs in such a way that when a push button is pressed, the first outputs switches from 5v to 0v, and the other from 0v to 5v. The restriction is that this can only be activated with that one push button. I can't figure out how to do it, as i am kind of new to electric circuits. i have attached an image of the circuit.
Thanks
Untitled.png
 
Hi
I'm designing a circuit, and there's one little problem. I basically want to have two outputs in such a way that when a push button is pressed, the first outputs switches from 5v to 0v, and the other from 0v to 5v. The restriction is that this can only be activated with that one push button. I can't figure out how to do it, as i am kind of new to electric circuits. i have attached an image of the circuit.
Thanks
View attachment 71682

Just use a hex inverter logic intergrated circuit .....as you are using 5 volt supply then a 7404 TTL chip will be ideal. It contains 6 inverters, you will only need two of these.
Just place your switch on one inverters input (eg pin 1), one of your outputs will be its output (pin2). Then link/join this output (pin 2) to another inverters input (pin3), and take your second output from this second inverter (Pin4).
Of course you will need to put +5 volt supply to pin 14 and - ground 0 volt to pin 7
Just another thought, if you are using a mechanical switch, this will cause switch contact bounce, causing you to have intermittent / unusual output results. It may be best to use a schmitt trigger hex inverter chip .... eg. 74LS14 .....same pinout as 7404.

hope this helps you to get started,
Rotarymaker
 

Attachments

  • 74LS14 schmitt trigger inverter.pdf
    108.9 KB · Views: 285
ahh... i get it, thanks. But i forgot to mention one other thing: for my circuit, one output has to be before the switch (at 5v) and the other one after it (gnd)
 
ahh... i get it, thanks. But i forgot to mention one other thing: for my circuit, one output has to be before the switch (at 5v) and the other one after it (gnd)

Not sure what you are trying to say here JoeWawaw....???
If you use the inverter circuit as explained, one output will always be at 5 volt and the other will be at 0 volt (gnd) ....they will reverse state, when switch is switched.

Rotarymaker
 
If you look at the first image i put up, out 1 is before the switch, and out 2 is after it. the switch is in between the the outputs, in your idea they are both after the switch
 
If you look at the first image i put up, out 1 is before the switch, and out 2 is after it. the switch is in between the the outputs, in your idea they are both after the switch

Yes I see that is the way you have drawn it, but is the important bit, to have 0V or 5V output at each output, without them being the same voltage at the same time.....I'm confused here,.... why has the switch to be physically in between the outputs?.... perhaps an explanation of what you are trying to achieve project wise might help to clarify things
 
Sure. maybe you can find a completely different solution for me :p
So I'm trying to "demultiplex" an array of 12 switches arranged in a 3x4 manner, one of those keypad digits thing.
It comes with 12 switches multiplexed to 7 pins, 3 for one side, 4 for the other, i want to rearrange it so that a i have all 12 pins available.
My idea was to have this circuit connected twelve times from each "anode" to each "cathode", then when one switch is pressed, the voltage alternates only on those two pins that connect that switch, which would then be connected to some gate that would give me an output.
 
So, if i were to connect the inverter to only the "cathode" of the switch, it would be possible to activate it with multiple different buttons, thus making demultiplexing fail.
 
Sure. maybe you can find a completely different solution for me :p
So I'm trying to "demultiplex" an array of 12 switches arranged in a 3x4 manner, one of those keypad digits thing.
It comes with 12 switches multiplexed to 7 pins, 3 for one side, 4 for the other, i want to rearrange it so that a i have all 12 pins available.
My idea was to have this circuit connected twelve times from each "anode" to each "cathode", then when one switch is pressed, the voltage alternates only on those two pins that connect that switch, which would then be connected to some gate that would give me an output.

Ahh ....I see now.....that changes things totally......my thoughts now are that you are going to have to use a microprocessor to work this .... basically you are using a 3x4 keypad matrix ..... if you haven't done any "PIC" programming then a simple starting approach may be to try a program called Flowcode .....they include a 3x4 keypad within their program and is quite simple to use, when you spend a little time running through their keypad tutorial
I think they have a free trial version that you can download and use. You do not have to even physically build your project......you can test your program via a real time simulation screen within this program.
Have a look at
Code:
http://www.matrixmultimedia.com/lc_index.php?p=25
BTW, I am not affiliated with this company, but have used their program successfully and learned it quickly, without ever having any programming skills!
 
Ahh.. I have an arduino, it wouldnt be too hard to control the keypad with it, but i wanted to find away that does not involve microcontrollers etc., its kind of a project to understand how logic gates work and try to apply them in real life
What i would like to do essentially with my keypad is that i would input some code, which would activate a motor which locks and dislocks my door 8) i have the circuit for the code and all that using some logic gates, its just this multiplex input thats giving me a hardd time
 
Ahh.. I have an arduino, it wouldnt be too hard to control the keypad with it, but i wanted to find away that does not involve microcontrollers etc., its kind of a project to understand how logic gates work and try to apply them in real life
What i would like to do essentially with my keypad is that i would input some code, which would activate a motor which locks and dislocks my door 8) i have the circuit for the code and all that using some logic gates, its just this multiplex input thats giving me a hardd time

I really dont know how you are going to achieve this without a microcontroller of some sort....
but here is a great link that may shed some light on keypad operation and issues that they can have

Code:
http://pcbheaven.com/wikipages/How_Key_Matrices_Works/

cheers,
Rotarymaker
 
Here's one possibility for demultiplexing the keypad without using a micro. The key switch matrix is scanned using two 4017 counters and the switch states are latched by 4013 ICs. I haven't included latch reset circuitry.
KeypadDecode.gif

Edit:
One CD4017 could be eliminated, outputs of the remaining one being applied to both rows and columns, providing the extra loading on the outputs doesn't slow the rising edges of the latch clock inputs so as to prevent reliable latching.
 
Last edited:
My idea was to have this circuit connected twelve times from each "anode" to each "cathode", then when one switch is pressed, the voltage alternates only on those two pins that connect that switch, ...
That should be pretty simple; see attached sketch. Obviously for a 3x4 matrix you'll need 3+4=7 transistors.
 

Attachments

  • switch complementary outputs.png
    switch complementary outputs.png
    12.4 KB · Views: 161
That should be pretty simple; see attached sketch. Obviously for a 3x4 matrix you'll need 3+4=7 transistors.

Not sure if thats going to work Dougy83.
My thoughts on your idea is that you are tying down the bottom of your switch to 0.7 volts (base emitter voltage of bottom transistor) ..... remember that this is a 3 x 4 matix keypad, which means that all switches on that row or column will be stuck at that voltage when one of those row or column switches are pressed. Same issue with the top of your switch...... that complete row or column will also be 0.7 volts when one of the switches is pressed.
 
>> Not sure if thats going to work Dougy83.
Draw it out and have a think about it.

>> My thoughts on your idea is that you are tying down the bottom of your switch to 0.7 volts (base emitter voltage of bottom transistor) .....
Correct. Why is this an issue?

>> remember that this is a 3 x 4 matix keypad, which means that all switches on that row or column will be stuck at that voltage when one of those row or column switches are pressed. Same issue with the top of your switch...... that complete row or column will also be 0.7 volts when one of the switches is pressed.
I'm not sure why you keep mentioning 0.7V... and why you think this is an issue. Yes, the row and column of an activated switch will be ~0.7V; this will result in the PNP transistor for that row being activated in addition to the NPN transistor for that column being activated.

From what I understood from his posts he wants to get a logic level from his switch matrix. The circuit I posted (when extended to each row/column) will give him 7 logic-level outputs from his switch matrix, which he can then feed into his logic decoder circuit.
 
Take a look at some of the stuff that was posed in this https://www.electro-tech-online.com/threads/graphic-lcd.133287/ thread. The spec sheet that the OP posted has a graphic through it, but the other references should help.

Multiplexing a keypad and driving a display at the same time was probably my first 6800 MCU project back in the mid 70's. It was a fundamental concept back then.

If your going to do ANY microprocessor interfacing, you need to learn about "contact bounce". It can be done in software or hardware, but it's very important. A "switch" when it makes contact actually "bounces" or makes contact a random number of times before it settles. I'll let you google the subject. I'd use terms like "software contact bounce eliminator" or "hardware contact bounce eliminator" or "contact bounce".
 
After a few days, i've found a way of doing it, see the attached picture. on the top i have a zener diode with a breakdown voltage of 4V, so when the switch is depressed, it conducts, and when it's pressed, the voltage splits to 2.5V and the zener diode blocks the current.
although think the trick with the counters is a good idea, since I'd have to make seven (i think) of these to make it work.
and im not going to use any microprocessor in this project, all just logic gates and counters, so i dont think contact bounce would be a problem, right?
Flip-Flop.png
 
Switch Matrix.png
>> Not sure if thats going to work Dougy83.
Draw it out and have a think about it.

>> My thoughts on your idea is that you are tying down the bottom of your switch to 0.7 volts (base emitter voltage of bottom transistor) .....
Correct. Why is this an issue?

>> remember that this is a 3 x 4 matix keypad, which means that all switches on that row or column will be stuck at that voltage when one of those row or column switches are pressed. Same issue with the top of your switch...... that complete row or column will also be 0.7 volts when one of the switches is pressed.
I'm not sure why you keep mentioning 0.7V... and why you think this is an issue. Yes, the row and column of an activated switch will be ~0.7V; this will result in the PNP transistor for that row being activated in addition to the NPN transistor for that column being activated.

From what I understood from his posts he wants to get a logic level from his switch matrix. The circuit I posted (when extended to each row/column) will give him 7 logic-level outputs from his switch matrix, which he can then feed into his logic decoder circuit.

Dougy83,

Apologies for delay on my reply.

My point is, that it is a working switch matrix with rows and columns, which I assume that if you place a logic high on point A (see my redrawn attachment) of the matrix switch, that you would like to see a logic high at point B when the switch is closed.
With your circuit you will never see a logic high at point B, because the base emitter junction of the lower NPN transistor will always limit / drag down the input AND output of the switch to 0.7Volts when the switch is closed.
I cannot explain it any simpler than that.
Dougy83, I not looking to argue with you over this, its really great to get different opinions .....perhaps I'm looking at this at a totally different angle that you, but I was reading that JoeWawaw was requesting to monitor what state his matrix switches were in, so I'm presuming that he's still using logic levels on the matrix switches rows and columns.
Looking forward to your reply,
Rotarymaker
 
My point is, that it is a working switch matrix with rows and columns, which I assume that if you place a logic high on point A (see my redrawn attachment) of the matrix switch, that you would like to see a logic high at point B when the switch is closed.
Why are you placing any external voltage on the switch matrix?

With your circuit you will never see a logic high at point B, because the base emitter junction of the lower NPN transistor will always limit / drag down the input AND output of the switch to 0.7Volts when the switch is closed.
There doesn't need to be any logic high (or low) on any base-emitter junction. The junction will have about 0.7V across it when the switch is closed, and 0V when the switch is open.

Dougy83, I not looking to argue with you over this, its really great to get different opinions .....perhaps I'm looking at this at a totally different angle that you, but I was reading that JoeWawaw was requesting to monitor what state his matrix switches were in, so I'm presuming that he's still using logic levels on the matrix switches rows and columns.
I don't see any point that needs to be argued. The circuit is very simple. Close the switch and tell me what the voltage on the outputs are. Now open the switch; what are the output voltages now?

The following quote is what JowWawaw was asking for. The circuit I provided gives a a near 0-5V swing on one output and a near 5-0V swing on the other; the change occurs when the switch is pressed.
Hi
I'm designing a circuit, and there's one little problem. I basically want to have two outputs in such a way that when a push button is pressed, the first outputs switches from 5v to 0v, and the other from 0v to 5v. The restriction is that this can only be activated with that one push button. I can't figure out how to do it, as i am kind of new to electric circuits. i have attached an image of the circuit.
Thanks
View attachment 71682
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top