Cap and resistor for switches... what are they for?

Go To Last Post
8 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi.  I'm looking at a schematic for an r/c radio controller that has a bunch of switches going to inputs on an Atmega64.  Each and every input goes like the attached image.  I removed both discrete components (of course bridging the resistor) and the switch seems to work fine.  I opened up a different radio and it too has a resistor inline and a cap on every switch.

What are they for?

 

My first thought was debouncing, but the same setup is used for a potentiometer too.  Does that need to be debounced?

Or does it help with EMI?

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Maybe I found the answer on my own (thank's Google):

 

http://www.digikey.com/en/articl...

 

 

Under "filtering" suggests it is for filtering out garbage picked up from external wiring.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Good find!

 

Note that in your attached image in post #1, the capacitor is in the wrong place.  It should be on the uC side of the resistor.

 

The capacitor can also serve to debounce the switch.  (See this post from Simonetta.)

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Are you sure you have the cap on the correct side of the resistor?

 

If the input feeds through an RC, then the RC acts as a low pass filter, and it attenuates transients, (like static electricity, or perhaps an induced EMI pulse if the input wires are long enough and the interference strong enough).

 

With the resistor tied to Vcc, instead of PortX.Y, and the junction of the R and the C going to the input and the switch, it forms a nice de-bounce filter.

 

With the resistor in series with the pin it can also limit the pin's output current, if the pin is inadvertently made an output.

If the pin is an output, and high, and the user pushes the switch, then the switch is shorting the pin directly to Ground, not a good thing.

 

There are, clearly, many ways to connect R's, L'S, and C's to the input pin.

 

JC

 

Edit: Cross post with Chuck

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This is for R/C he says. That mean "Radio control". So, there is inherently more than a little RF around. If the purpose is to RF-proof it, coming toward the MCU from the switch, you should have a series R, followed by a C to ground. C on the other side of the R ought to help, also, but not as effectively. 

 

Jim

 

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sorry for the confusion.  ka7ehk is right that I meant "rc" as in "radio control", not "resistor-capacitor" circuit.

 

I double checked, and my diagram is correct.  By "correct", I mean it is consistent with both the schematic for one brand, as well as what I physically observe on another brand.

 

So they did it wrong?  Or... maybe it is more about protecting surrounding circuitry from the rf generated FROM the chip rather than protecting the chip from surrounding EMI?  Could it be one of those "this device meets FCC regulation blah blah to not cause but must accept interference" scenarios?

 

I'm still confused and would like to know why they are there in this configuration.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

s_mack wrote:

Or... maybe it is more about protecting surrounding circuitry from the rf generated FROM the chip rather than protecting the chip from surrounding EMI?  Could it be one of those "this device meets FCC regulation blah blah to not cause but must accept interference" scenarios?

That would be my guess, now that you mention the RF aspects.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Maybe a filter for the RF side of the board, with a resistor on the AVR side to keep the pin currents low when the cap is discharged.

while(!solution) {patience--;}