Hi, I'm getting ready to build an arduino morse code keyer, which is a device that takes two inputs (two switches) and then makes morse code sounds (short & long) depending on switch was pressed.
Attached is a circuit diagram. On the diagram, the two input switches are on the right side, labeled right paddle and left paddle.
What function do the capacitors serve in a digital-pin switch such as these? What will happen if I omit them? Does it have to do with debouncing?
For outputs, C1 C2 are probably there to round off the rectangle pulses to remove high frequency components.
There really should be a series dropping resistor on these pins of some low value, maybe 10 to 100Ωs.
zirconx:
What function do the capacitors serve in a digital-pin switch such as these? What will happen if I omit them? Does it have to do with debouncing?
No, because using a microprocessor, de-bouncing will be manged in the code.
A Morse keyer is used to control a radio transmitter. The capacitors are to bypass the radiated RF from that transmitter from getting into the keyer circuitry and interfering with its execution of code. An HF transmitter generates RF of similar frequencies to the microprocessor clock.
Once you know that, you will know whether or not you need them.
So I probably don't need the capacitors for practicing morse code (unconnected to a radio). And may or may not need them when I start transmitting.
Turns out this is not as hard as I thought it would be. I didn't add any other components (resistors, capacitors, etc), just wired everything together. My audio is pretty low since I am not using the amplifying transistor shown in the circuit, but it does work.
Turns out they are necessary. I discovered that when I touch the keyer circuit, it would trigger the keyer. A capacitor between the switch and ground fixed it.
I would add a stiffer pull up resistor and not just rely on the internal (weak) pullups - perhaps 1k or 2k2,
if the pin is that sensitive to capacitive interference.
MarkT:
I would add a stiffer pull up resistor and not just rely on the internal (weak) pullups - perhaps 1k or 2k2,
if the pin is that sensitive to capacitive interference.
I tried a 1k, 10k, and a 15k (to vcc). All caused the circuit to trigger (as if I had pressed the paddle switch) constantly.
A capacitor does solve the false triggering issue though.
Paul__B: No, because using a microprocessor, de-bouncing will be manged in the code.
That's quite a lot stronger of a denial than it should be. A resistor+capacitor like that forms a low pass filter, which is one of the cheaper ways to hardware-debounce a switch.
While you are correct that the primary purpose is providing noise resistance, it will also provide debouncing at the same time.