Shop OBEX P1 Docs P2 Docs Learn Events
PE Labs button - what limits current to pin? — Parallax Forums

PE Labs button - what limits current to pin?

W9GFOW9GFO Posts: 4,010
edited 2010-02-04 18:59 in Propeller 1
How is the pin protected from too much current when a button is wired like this?

attachment.php?attachmentid=67423

Rich H

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The Simple Servo Tester, a kit from Gadget Gangster.
332 x 340 - 13K

Comments

  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2010-02-04 07:39
    What current? Ohm's law states R=V/I so I is dependent upon R and V. The I/O pin itself when in input mode has a super-high resistance which means the current is practically nil. Now if the pin were configured as an output (which would be wrong) then you would need a series resistor from the pin to limit current.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    *Peter*
  • Nick McClickNick McClick Posts: 1,003
    edited 2010-02-04 07:44
    I'll give it a go, although I'm sure I'll get something wrong (but then we'll both learn something!)

    The propeller uses Tri-State Logic. When pins are set as inputs, they're not connected to ground, but are in a high-impedance state. No current flows through them - and they determine the voltage level like your voltmeter does.

    The pull down resistor keeps the input pin from floating, and keeps you from getting a short circuit when the pushbutton is... pushed.

    If you make P18 an output (dira[noparse][[/noparse]18]~~) and connect it to ground (outa[noparse][[/noparse]18]~), you will have a short circuit. BUT, I've done this before without breaking anything - i think there is some protection on the device for this mistake (clamping / esd diodes ?)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Forums RSS Feed!

    Gadget Gangster - Share your Electronic Projects
  • W9GFOW9GFO Posts: 4,010
    edited 2010-02-04 07:49
    Phil Pilgrim (PhiPi) said...

    It's a well-worn adage of system design that no amount of software malfunctioning should ever cause harm to the hardware.

    Wouldn't this be a case where a software error could cause hardware damage and should therefore be avoided?

    Rich H

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Simple Servo Tester, a kit from Gadget Gangster.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2010-02-04 08:09
    Well yes, a software error could make this an output but still the outputs are not perfect switches plus the cmos characteristics will limit the short-circuit current anyway. The Prop seems to be hardy and survives these accidental short-circuits but it is still good practice to insert a current limit resistor (around 220R) in the general-purpose I/O pins. If it is always being used as an input you can safely increase the value to at least 1K but 220R assures that the current will be limited plus there is still sufficient drive when it is used as an output. You can keep wrapping the baby up in cotton wool to protect it but soon you won't find the baby for the cotton wool. (Hint, just be practical within reason).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    *Peter*
  • Toby SeckshundToby Seckshund Posts: 2,027
    edited 2010-02-04 08:42
    The mouse/Kbd ccts put 100 Ohms in series, presumably for the same reasons. Chip has said that there should always be an external protection resistor. They cost fractions of a penny to put them in,and if it turns out to be a complete waste of time just bridge them out. If there is a button then there will be a pusher, they are never predictable coming along with several·Mega Volts of static etc ....

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Style and grace : Nil point
  • edited 2010-02-04 18:59
    Hi folks,

    Thanks for asking W9GFO. In addition to the current discussion, your post caused me to notice an error in the schematic. The I/O pin connection symbol is pointing into the pushbutton circuit, indicating that the I/O pin is functioning as an output and transmitting a signal to the circuit. It should be pointing away from the pushbutton circuit to indicate that the I/O pin is an input that's receiving a signal from the circuit.

    For BASIC Stamps, it is possible to damage an I/O pin or even the module's interpreter chip by accidentally sending a high signal to ground without a protection resistor. Likewise, sending a low signal to the circuit at the beginning of this post would result in similar damage as soon as the button gets pressed. So, in our Stamps in Class educational textbooks, we almost always put a resistor between the I/O pin and the test circuit. There are some cases where the circuit's performance is adversely affected, and it couldn't damage the I/O pin, so we leave it out. Like with a piezospeaker.

    While one of our engineers was working on the Propeller Datasheet, he did some tests where he drove ground with a high signal and 3.3 V with a low signal with no protection resistor and reported no I/O pin damage over 24 hour periods. I'm not sure if this got published anywhere, but that bit of internal news tipped the scales for me on removing the protection resistor. I was already leaning that direction because it's the kind of habit that might save some time and money in prototyping, but those pennies could add up in mass production designs.

    I'm definitely open to suggestions for the next revision. Any additional opinions on the pros and cons of including the protection resistor would be greatly appreciated.

    Thanks, Andy

    P.S. I noticed that I set up the possibility of shorting a high signal to ground in Chapter 7 doing RC decay on a potentiometer. There's a corrected circuit and information posted here:


    forums.parallax.com
    ·· -> Propeller Chip
    ······ -> Propeller Education Kit Labs, Tools, and Applications
    ·········· -> Measure Resistance and Capacitance

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Andy Lindsay

    Education Department
    Parallax, Inc.
Sign In or Register to comment.