I have numerous 2 pin push button switches(SPST). You know, the ones that have in and out? Just two pins. Ok, now the problem. I would like to use these as digital switches. How would i do that? I have been using the attached schematic, but that doesn't give me an absolute 0. I need a 1 or a 0. Not and NC! Any ideas, or will i need to get a SPDT switch?
Try using 4.7k instead of 10k. Your pull-down resistor might not be strong enough.
YOu should have a switch debouncer there where the 220 ohm resistor is. It looks like it should work to me unless something about the lack of a debouncer is confusing your uC. What are the two states you are getting? High impedence and...?
Also, I am not entirely sure if you need the 220 resistor, but if there is sufficient leakage current going through to form a sufficient voltage drop, that could be messing around with your results, but that seems unlikely
Usually we put one side of the switch to ground and the other end to a pullup resistor (say 10K) That way it'll work with TTL style devices also, because those require more current to be toggled low than high. HCMOS etc won't care either way. A 0.1uf cap in parallel with the switch will provide debounce if the switch is connected to a schmitt trigger style input. You don't really need the 220R..... The only use I could see for it was if you were interfacing with a microcontroller where the pin could be configured as either an input or an output and you were worried about a mis-configured pin (set to output) being damaged when the swich is pressed.
This isn't for a uC. It is just for some test circuits i would like to make before i connect them to the uC. Isn't 4.7k smaller than 10k? What good would that do?
I don't quite know the terminology of High and Low impedance, but i am getting a steady "1", or High, in each switch position. I need 0 while the switch is Not Connected, and a 1 while it is connected. What am i doing wrong? I will try a switch debouncer soon.
This isn't for a uC. It is just for some test circuits i would like to make before i connect them to the uC. Isn't 4.7k smaller than 10k? What good would that do?
I don't quite know the terminology of High and Low impedance, but i am getting a steady "1", or High, in each switch position. I need 0 while the switch is Not Connected, and a 1 while it is connected. What am i doing wrong? I will try a switch debouncer soon.
You said you didn't need a NC so I assumed that meant "not connected", which is what high impedance (or high resistance as in infinite resistance)means.
Using a smaller pull down resistor would make it so that more current flows through the resistor from +5V to GND when the switch is closed and make the 5V drop across the resistor stronger and less sensitive to noise (since more current is flowing through it, it is harder to disrupt). Just imagine if the pull down resistor was 1 trillion ohms. Still a pull-down resistor right? Or would the current flowing through it be so little that the slightest thing could disturb it enough to cause the voltage drop across the resistor to jump back up to 5V and always cause the output to be high? Now if the pull-down resistor was 0 ohm, it would pull down so strongly that you could never pull it high again because the +5V would be shorted and an infinte amount of current would be flowing which is really hard to disrupt.
YOu could always try a pull-up resistor instead like Kchriste said (but then pushing the button would pull the circuit low). YOu don't see many pull-down resistors.
Oh, ok. Yes, i ment Not Connected, but i'm not sure what i ment by it? I ment not connected to ground. My mistake. But yes, i will try the pull-up, and then run it into a hex inverter. Thanks
You need to use different resistor values for different logic families.
You didn't say whether your hex inverter is a TTL 7404, or a Cmos 4069.
A TTL input draws a max of 1.6mA at 0.4V when low. So the max value resistor to ground is 0.4V/1.6mA= 250 ohms.
A Cmos input draws no current so the max value for a resistor to ground to make it low could be anything.
I have numerous 2 pin push button switches(SPST). You know, the ones that have in and out? Just two pins. Ok, now the problem. I would like to use these as digital switches. How would i do that? I have been using the attached schematic, but that doesn't give me an absolute 0. I need a 1 or a 0. Not and NC! Any ideas, or will i need to get a SPDT switch?
The chip has a part number marked on it. What is it?
TTL= 7404, 74LS04. Cmos= 4069, 74HC04.
It might even have Schmitt trigger inputs. Its number will tell you.
Is that resistor able to hand the power dissipation? it seems like a lot of heat would be going through that resistor. You don't want too small a resistor because you use up a lot of uneeded current, but you don't want one too high either so that the resistor isn't strong enough to pull-down.
Your hex inverters don't need an absolute 1 and 0 at their inputs. The max voltage for a logic low for TTL is 0.8V and the min high voltage is 2.0V. The outputs go to a max voltage of 0.4V for a logic low and to a min voltage of 2.4V for a logic high. The extra 0.4V is for noise immunity.
The logic voltage limits for Cmos inputs is 1/3 and 2/3 of the supply voltage. The outputs go to the positive supply and ground voltages if they don't need to supply current.
Is that resistor able to hand the power dissipation? it seems like a lot of heat would be going through that resistor. You don't want too small a resistor because you use up a lot of uneeded current, but you don't want one too high either so that the resistor isn't strong enough to pull-down.
I don't know. The resistor doesn't get hot. The 10ohm got very hot, but the 150 works slick.
Your hex inverters don't need an absolute 1 and 0 at their inputs. The max voltage for a logic low for TTL is 0.8V and the min high voltage is 2.0V. The outputs go to a max voltage of 0.4V for a logic low and to a min voltage of 2.4V for a logic high. The extra 0.4V is for noise immunity.
The logic voltage limits for Cmos inputs is 1/3 and 2/3 of the supply voltage. The outputs go to the positive supply and ground voltages if they don't need to supply current.
167mW in a 1/4W (250mW) rated resistor is pretty good, because the resistor won't get too hot. 250mW in a 1/4W resistor causes it to reach about 200 degrees C.
Power in a resistor is calculated by squaring the voltage across it then dividing by the resistor's value. Power in a resistor is also calculated by squaring the current in the resistor then multiplying it by the resistor's value.