Shop OBEX P1 Docs P2 Docs Learn Events
Switch or Whiskers pulled up to 3.3, or pulled down to 0 when open. — Parallax Forums

Switch or Whiskers pulled up to 3.3, or pulled down to 0 when open.

Martin_HMartin_H Posts: 4,051
edited 2012-10-18 11:49 in General Discussion
I'm planning to do is add whiskers to a robot controlled via a propeller chip, and I'm wondering if I should pull up or pull down via a 10 k resistor. The learn.parallax.com site shows them pulled up, but I want to know how much freedom I have here. From what I've read a pin in input mode has a high impedance, so it would only be sourcing or sinking current a small amount of current either way.

Is the choice purely personal preference or are there other factors to consider?

Comments

  • RobotWorkshopRobotWorkshop Posts: 2,307
    edited 2012-10-18 10:29
    I've seen both methods used but I normally use pull-ups on inputs like that and then ground them with the switch, etc.

    Robert
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2012-10-18 10:50
    For what it is worth, in low power battery operated devices, wouldn't pullups always drain the batteries faster than pulldowns?
  • tonyp12tonyp12 Posts: 1,951
    edited 2012-10-18 10:56
    I would go pull-up with the switch just temp shorting it to ground.

    With battery operation,
    use pull-down OR up so that in ~95% of the time switch etc is NOT allowing
    current thru the resistor to gnd, just through resistor to Prop input pin.
  • Duane C. JohnsonDuane C. Johnson Posts: 955
    edited 2012-10-18 11:25
    Hi Martin;

    Pull up or down makes no difference, its just your preference.

    Yow asked about freedom of choice for the resistor, I assume the value.
    10K is a common value but any value from 1K to 100K would work,
    as long as the pullup or switch is connected to the prop's VDD or 3.3V.

    There is another factor to consider.
    Switches come in many types. In this case they generally come in:
    1. Low voltage "Signal" types, usually plated with Gold, or other precious metal,
    2. "AC" types, often rated for 120VAC or so. These generally have silver or other metal contacts.

    The gold plated contacts on the signal types don't corrode so the the contacts
    close reliably. Assuming the current is not excessive which would arc through
    and destroy the gold plating.

    AC types do have the ability to corrode. AC switched depend on at least a small
    arc to essentially clean the contact. Often these fail in low voltage low current
    applications as the corrosion can be high in resistance because no arcing occurs.
    There is a fix for this. Add a small capacitor, I usually use 0.1uF, across the contact.
    This small capacitor will provide a tiny spark to clean the contact.

    BTW, don't use the capacitor on the gold plated switches as the spark can
    damage them.

    AC = use the cap.
    Signal = no cap.

    Duane J
  • Mike GreenMike Green Posts: 23,101
    edited 2012-10-18 11:31
    Pullups are commonly used with a switch to ground because Vdd is often available at a limited set of locations in a device while ground is available nearly everywhere. This is especially true when the switch or whisker is in a relatively remote location where a shield or ground wire might be provided in a cable, but no power. The pullup can be put locally where Vdd is available.
  • Duane C. JohnsonDuane C. Johnson Posts: 955
    edited 2012-10-18 11:42
    Hi Tony;
    tonyp12 wrote: »
    I would go pull-up with the switch just temp shorting it to ground.

    With battery operation,
    use pull-down OR up so that in ~95% of the time switch etc is NOT allowing
    current thru the resistor to gnd, just through resistor to Prop input pin.
    Yes, it's more efficient to have NO, Normally Open, switches.

    However, for failsafe applications I usually recommend the switch be:
    NC, Normally Closed, and open when activated.
    If there was corrosion on the contact the NO, Normally Open, switch would
    not be able to sense the sensing condition.
    Also, if there is a broken wire the closing of the switch will have no effect.

    Duane J
  • Martin_HMartin_H Posts: 4,051
    edited 2012-10-18 11:49
    OK Thanks all for the information.
Sign In or Register to comment.