I require a toggle switch to send a pulse.

Thread Starter

Jordy-H

Joined Nov 17, 2017
8
Hello,

I am making a flight simulator. I basically need a toggle switch (SPST) that with the use of extra electrical components closes the circuit for a few milliseconds, as it needs to mimic a keystroke, as it is going to be put into a membrane keyboard (thus avoiding programming). I have very limited electronic knowledge. I am not going to use Arduino or any other form of a system to program the switch, purely because I know even less about programming than electronics.

So if could show me a simple circuit that will be able to complete this task that would be awesome, preferably without the use of extra power inputs. If you need it then include it of course, as I say I really don't know how to make this work. The only idea that seems plausible at this point in time is https://www.electronicspoint.com/threads/toggle-switch-momentary-pulse-circuit-problem.279705/ but they are having troubles.

THANKS IN ADVANCE!
 

dl324

Joined Mar 30, 2015
18,300
By power do you mean what is coming from the keyboard?
Yes.

You could use something like this:
upload_2017-11-17_14-54-22.png

One shot period is approximately R1*C1 seconds. You can replace the inverter with a NOR gate with the inputs tied together so you only need a single IC.

This one shot triggers on a rising edge and is non-retriggerable, but switch bounce may cause multiple pulses if the time constant is shorter than the switch bounce period. You should plan on debouncing the switch if that would be an issue.
 

Thread Starter

Jordy-H

Joined Nov 17, 2017
8
I'll be honest with you mate, I don't really know what I circuit diagram is. But I think you said that if I plan on flicking it on and off quickly there could be a problem?
 

dl324

Joined Mar 30, 2015
18,300
I don't really know what I circuit diagram is.
Which part don't you understand?
But I think you said that if I plan on flicking it on and off quickly there could be a problem?
You want a few mS pulse. That will be shorter than the period that the switch contacts will bounce. To avoid problems with multiple triggering, you need to debounce the switch.

If output pulse had been on the order of 100mS, switch bounce wouldn't have been an issue because the one shot is non-retriggerable.
 

Thread Starter

Jordy-H

Joined Nov 17, 2017
8
That makes a little more sense now, it was just the Bouncing stuff. If I take that into my local electronic store, should they have all the parts that I need?
 

ebeowulf17

Joined Aug 12, 2014
3,307
In the flight sim, if you hold the key you're pressing for a little longer (half second or so,) does it still work the way you need? I expect it will. The reason I ask is because I think you can choose a longer pulse, say 100ms or so, which will eliminate the potential switch bounce issues. I don't think the pulse actually needs to be as short as you originally suggested.
 

dl324

Joined Mar 30, 2015
18,300
Yea that makes sense, I think I got lost with my numbers. I do mean a few hundred ms.
If you're talking about hundreds of mS, the circuit I provided becomes impractical. For 100mS, you're looking at a 100uF cap because you can't increase the resistor to much more than 1M ohm due to leakage in an electrolytic cap.

I think a 555 timer would be more practical for hundreds of mS.
 

crutschow

Joined Mar 14, 2008
38,449
For 100mS, you're looking at a 100uF cap because you can't increase the resistor to much more than 1M ohm due to leakage in an electrolytic cap.
I think your calculator needs batteries. ;)
1M ohm and 100μF gives a time-constant of 100 seconds.
For 100ms, 1MΩ with 100nF should suffice.

A 555 has the roughly the same time-constant relation to its period as your CMOS circuit.
 

AnalogKid

Joined Aug 1, 2013
12,102
What kind of keyboard are you wiring into? If if is a standard alphanumeric keyboard, they have scanning circuits and firmware that deal with switch bounce. That should make things easier.

You said you needed an output pulse of a few milliseconds. Do you have a more specific spec? This could cook down to 1 transistor, 1 capacitor, and 2 resistors.

ak
 
Last edited:

Thread Starter

Jordy-H

Joined Nov 17, 2017
8
What king of keyboard are you wiring into? If if is a standard alphanumeric keyboard, they have scanning circuits and firmware that deal with switch bounce. That should make things easier.

You said you needed an output pulse of a few milliseconds. Do you have a more specific spec? This could cook down to 1 transistor, 1 capacitor, and 2 resistors.

ak
Just a normal keyboard like for a computer.
 

AnalogKid

Joined Aug 1, 2013
12,102
Are you stuck with a SPST switch, or can you get a SPDT to fit in your application? I can't draw schematics today, but something like this:
SPDT switch
1 uF cap
100 K resistor to GND
2N7000 MOSFET
Drain to KB
Source to GND

You might need a diode in there to debounce the switch release.

ak
 
Yes.

You could use something like this:
View attachment 139540

One shot period is approximately R1*C1 seconds. You can replace the inverter with a NOR gate with the inputs tied together so you only need a single IC.

This one shot triggers on a rising edge and is non-retriggerable, but switch bounce may cause multiple pulses if the time constant is shorter than the switch bounce period. You should plan on debouncing the switch if that would be an issue.
Can you please identify the parts in this drawing a bit more detail? Thanks!
 

Papabravo

Joined Feb 24, 2006
22,077
Pushbutton, resistors, a capacitor, and a 555 timer chip.
The timer chip can be configured in at least three ways:
  1. It can be astable and have no stable states. It will be a square wave oscillator.
  2. It can monostable, with one stable state. When triggered it will change state for a predetermined amount of time and return to it's stable state.
  3. It can be bistable with two stable states. Separate trigger signals are used to make it change states.
You can find a datsheet for the part using Google and the are endless online tutorial on how to use the part.
 
Top