How to simulate a momentary switche being pressed every few seconds?

Hello, Not sure if right place. When running time domain simulations, how do I simulate a momentary switch being pressed every now and then?

by chromedragon
August 03, 2012

You can do this using a Voltage Controlled Switch and driving the '+' control input using either:

i) the PWSREPEAT(t1,v1, t2,v2, ....) or PWS(t1,v1, t2,v2, ....) expression in a voltage source (see:

https://www.circuitlab.com/docs/expressions/

and

https://www.circuitlab.com/docs/circuit-elements/#behavioralsources

for more);

ii) a Digital Clock source and set the period to the repeat interval you want and the duty cycle to give you the one interval that you want.

If you use the PWS() etc., source to control the switch, then don't forget to connect the '-' input of the switch to the negative end of the controlling source (usually at ground).

If you use the Digital Clock source, don't forget to connect the '-' input of the switch to ground.

by signality
August 03, 2012

Just not getting this. I can set this 'PWS(0,0,5,24)' on a '+' side of a Voltage Source and get a 'pressed' event, but where do i go from here. It seems as if i can't get the 't3,x3' and beyond parameters to work.

Could somebody post a schematic with a switch being pressed and released and have a time simulation on that?

by nelsonkoehn
August 04, 2012

Thanks!

by chromedragon
August 04, 2012

@nelsonkoehn,

Have a look at:

If you throw away SW2, NOT1 and BUF1, then connect ctrl to the '+' input of the switch.

Bingo, a SPST switch controlled by a PWS source.

Is good yes?

by signality
August 05, 2012

Post a Reply

Please sign in or create an account to comment.

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

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.