i am trying to create a digital logic trainer. to provide inputs through switches and outputs through LEDs, however when i connect the logic gates to the switches they don't work the way they are supposed to do. i am guessing that the gates need high or low not on or off. can you guys explain or direct me to a link to a switch that can provide high when activated and low otherwise. for example this is the scehmatics :


simulate this circuit – Schematic created using CircuitLab

thank you!

  • 1
    \$\begingroup\$ Switches do not magically provide voltages/signal levels. Can you please show us a schematic/drawing of what you are doing, and we can help you work out what you need to do to make it work as you intend. Use this site's built in circuit drawing tool (edit your question and make a drawing) \$\endgroup\$ – KyranF Oct 15 '15 at 17:48
  • \$\begingroup\$ oh okay hold on \$\endgroup\$ – MrAbdul Oct 15 '15 at 17:49
  • \$\begingroup\$ Are your switches Single Pole, Single Throw (as shown in your schematic) or something more? \$\endgroup\$ – gbulmer Oct 15 '15 at 20:02
  • \$\begingroup\$ Add a I0K resistor from the "NOT" input to ground, \$\endgroup\$ – Jasen Oct 15 '15 at 22:33

First of all, your digital logic IC needs power as well, of course. Second, your LED needs a resistor - it's probably blown up already. The switch should be done more like this:


simulate this circuit – Schematic created using CircuitLab

If you want to keep the switch in the way it is, where when the switch is "on" the input to the gate is "HIGH", then you can do it like this, and still have a valid signal when the switch is not pressed:


simulate this circuit

In the second way, the LED will be always ON until the switch is pushed down, and while the switch is down, the LED will be OFF.

  • \$\begingroup\$ You've inverted the switch from the OP - he has close to set input high while you have close to set input low. Better would be to connect the switch to 3.3V and the 10K resistor to ground to keep with what the OP expects. Of course, either way works fine. \$\endgroup\$ – DoxyLover Oct 15 '15 at 20:12
  • \$\begingroup\$ @DoxyLover my circuit actually does what the OP has requested - LED goes "ON" when the switch is "ON", thanks to the NOT gate. The OP's circuit will have issues with floating voltages as well, when the switch is not pushed, there is no way for the input pin in the logic chip to discharge it's input capacitance, thus causing undefined behaviour. \$\endgroup\$ – KyranF Oct 15 '15 at 20:50
  • \$\begingroup\$ @DoxyLover of course, they can just put the 10K shunt resistor to ground from the input, parallel to the 3.5V source shown in the OP's diagram (as you mentioned). The output will be inverted logic though, if the NOT gate shown could be a mistake using the circuit drawing program - maybe it's not a NOT gate in reality? In the current circuit the OP shows, the LED will be on when the switch is NOT on. \$\endgroup\$ – KyranF Oct 15 '15 at 20:52
  • \$\begingroup\$ Actually, rereading the OP, he's requesting a switch that produces a high output when closed. He says nothing about what the output of the NOT should be, nor which way the LED should light. (I am assuming he understands the function of the NOT gate.) I still think the batter answer is to take his schematic and just add the series resistor to the LED and a pull-down on the switch. \$\endgroup\$ – DoxyLover Oct 15 '15 at 22:24
  • \$\begingroup\$ @DoxyLover I guess so, the operation should be fine either way. I'll post a second option in addition to my own original suggestion, which follows the OP's switch polarity. \$\endgroup\$ – KyranF Oct 15 '15 at 22:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.