Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Pull-up resistor on micro input pin is too high Ohmic value?

Status
Not open for further replies.
T

treez

Guest
Newbie level 1
Hello.
I have a switch which pulls down (to ground) a pin of a PIC18F65K22 Micro to give a logic low.
If the switch is open then the pin is pulled up to the 5V rail via a 47K resistor.
Do you think I need a 10n (or thereabouts) capacitor connected to the pin to reduce noise at the pin?

When pulled high, and without such a capacitor, do you think that the logic high will be too noisy...and will sometimes be taken as a low due to noise?
 

Hi,

Many use 10k as the pull up value, though you could go higher if power saving is critical; a 100nf is often used.
Also depends on the use, are you talking hobby or commercial/ industrial use.

Its generally better to also do a software debounce of about 50ms.

So views here,

Switch inputs can be really prone to interference, so if the switches are off board using a shielded lead with things like ferrites are often needed/essential

Edit - you might find these DSS306 series of filters useful, used them on my last build, no interference problems so far.
Farnells stock quiet of few of this range https://www.farnell.com/datasheets/52457.pdf
 
Last edited:
  • Like
Reactions: treez

    T

    Points: 2
    Helpful Answer Positive Rating
Agreed - although the purpose of the switch wasn't specified, it might be just as easy to debounce the signal in software. 47k should be quite safe electrically but intuitively I would go for 22K or even 10K to reduce the impedance and hence susceptibility to interference. Capacitors can cause problems in some situations as they limit the rate of change of input voltage (which is why they are used!) so you can get a situation where the switch opens and the capacitor starts to charge but stays in the "no mans land" zone between the low and high voltage thresholds for too long and causes misreading on the pin.

If you use a capacitor, keep it's value relatively low and ensure it's ground end is close to the VSS pin so it doesn't introduce it's own noise path.

Debouncing in software can be done several ways but the simplest is to detect the pin going low (switch closed), wait a mS or so the re-sample the pin. The delay should be longer than the switch bounce time (data sheet). If it re-samples as still low, it should be safe to assume it has been held down and it wasn't a noise glitch it first saw.

If you want a more secure debounce, after first detection, loop reading the pin, if it is low, increment a counter, if it goes high, clear the counter. Only when a satisfactory count is reached do you accept the switch was closed. This method checks for continuous closure so it avoids the unlikely but possible scenario that you sampled twice and detected noise each time.

Brian.
 
  • Like
Reactions: treez

    T

    Points: 2
    Helpful Answer Positive Rating
47k should be quite safe electrically but intuitively I would go for 22K or even 10K to reduce the impedance and hence susceptibility to interference
thanks, so we are seriously saying that the pin could be read as less than 0.8V when pulled up to vdd (5V)with 47K?
 

thanks, so we are seriously saying that the pin could be read as less than 0.8V when pulled up to vdd (5V)with 47K?
It depends entirely on the application. If the switch is a very short distance from the PIC, and if there are no Van de Graaf generators or big motors nearby, or other obvious sources of noise, you might do just fine with a 100K pull-up. But if the environment has the potential of noise, even static discharge, getting to that line, then you might need 10K or lower. These noise sources, under the right conditions, could bring the 5v high-impedance line down to 0.8v briefly.
 
  • Like
Reactions: treez

    T

    Points: 2
    Helpful Answer Positive Rating
when you say breifly, you mean say, for 100ns every second?
 

'briefly' = as long as it takes for the PIC/software to recognize it as being low.
That depends on what the pin is (an interrupt input or I/O pin) and how frequently the pin is polled.

The current drawn into an input pin is extremely small, Microchip say maximum of 200nA so in worst case, the resistor value that would drop the voltage to say 0.8V is (assuming you are using a 3.3V supply) R = V/I = (3.3 - 0.8)/200nA = 12.5M Ohms. The trouble with using such a high value is the RC time constant in conjunction with the pin input capacitance and track capacitance in parallel. Obviously the pin will go low immediately you close the switch but it might take a long time to go high again. A high impedance point like that is also prone to capacitive and possibly inductive coupling through it's connecting tracks/wires. Using a much lower value of pull-up resistor allows better 'leakage' of such coupling.

Incidentally, in a job I did a few years ago, pull-ups in the megohms regions were used as the unit was electrostatically screened and encased (including battery) in resin. The only communication to the outside world was an LCD indicator and it had embedded reed switches as it's inputs. Unit life had to be > 10 years.

Brian.
 
  • Like
Reactions: treez

    T

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top