Simulate a momentary push button?


I'm new to CircuitLab. I'm just creating a simple circuit on a breadboard, where I've added a momentary push button and some logic gates.

How can I simulate the 2 states of the circuit, without changing the circuit? (ex: replacing the push button with something else)

Ideally I'd like to have 2 graphs, one which shows the output with the button pushed, and the other without.


by JohnKoz
February 22, 2024

In your simulation, instead of a push button use a relay driven by a low frequency square wave voltage source. Then the relay contact mimics the push button and you can plot both the voltage source and the output of interest

by Foxx
February 22, 2024

Thank you Foxx. I guess there are a few options to CHANGE the circuit (thank you for your suggestion), but I have to ask: what purpose does the push-button component serve if we can't use it in a circuit? (not shooting you; hoping CircuitLab would comment)

by JohnKoz
February 23, 2024

You can control the PB state (open or closed) by going to build mode, double clicking on the PB and selecting "open" or "closed" in the resulting menu. Then you would have to go back to simulate mode to see the result. I don't know how you would plot this. My suggestion would get the same results but would be simple and easy to plot

by Foxx
February 24, 2024

1 Answer

Answer by JohnKoz

I ended up creating a momentary button from 4 timed switches. The effect is as follows:

T1s: button closes
T2s: button opens
T3s: (I change some other timed state)
T4s: button closes
T5s: button opens

Though I felt a little nauseous creating this, it solves my problem. Even this way I wish the timed switches could be automatically resettable or cyclic allowing for repeats. Another idea would be to create a timed button.

+2 votes
by JohnKoz
February 24, 2024

If you want to dissociate the "main source" of your circuit from passing through what is the switch, you can use the Mr. Foxx suggestion by putting the clocked signal to a gate of a MOSFET.

I would rather limit the use of the timed switched to a case where I want to investigate something like a rush in current to simulate an initial powering on (part of) a circuit. Although someone else may also have other use for them.

by vanderghast
March 01, 2024

Your Answer

You must log in or create an account (free!) to answer a question.

Log in Create an account

Go Ad-Free. Activate your CircuitLab membership. No more ads. Save unlimited circuits. Run unlimited simulations.

Search Questions & Answers

Ask a Question

Anyone can ask a question.

Did you already search (see above) to see if a similar question has already been answered? If you can't find the answer, you may ask a question.

About This Site

CircuitLab's Q&A site is a FREE questions and answers forum for electronics and electrical engineering students, hobbyists, and professionals.

We encourage you to use our built-in schematic & simulation software to add more detail to your questions and answers.

Acceptable Questions:

  • Concept or theory questions
  • Practical engineering questions
  • “Homework” questions
  • Software/hardware intersection
  • Best practices
  • Design choices & component selection
  • Troubleshooting

Unacceptable Questions:

  • Non-English language content
  • Non-question discussion
  • Non-electronics questions
  • Vendor-specific topics
  • Pure software questions
  • CircuitLab software support

Please respect that there are both seasoned experts and total newbies here: please be nice, be constructive, and be specific!

About CircuitLab

CircuitLab is an in-browser schematic capture and circuit simulation software tool to help you rapidly design and analyze analog and digital electronics systems.