Shop OBEX P1 Docs P2 Docs Learn Events
General question about pin I/O amps. — Parallax Forums

General question about pin I/O amps.

potatofacepotatoface Posts: 23
edited 2013-08-13 08:58 in Propeller 1
I see that the propeller input pins can only sink about 40 mA of current.
(Im new here to bare with me)

So, If I were to connect a push button inline from the VDD(300 mA) to say....pin 1 and try to read the states of the pushbutton with INA[1], would I risk frying the pin with too many amps?

Could someone give me the rundown on how to make sure I'm not going to destroy the pin input? Do I have to construct an amperage divider circuit of some sort?

Thanks,

Comments

  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2013-08-13 00:21
    potatoface wrote: »
    I see that the propeller input pins can only sink about 40 mA of current.
    (Im new here to bare with me)

    So, If I were to connect a push button inline from the VDD(300 mA) to say....pin 1 and try to read the states of the pushbutton with INA[1], would I risk frying the pin with too many amps?

    Could someone give me the rundown on how to make sure I'm not going to destroy the pin input? Do I have to construct an amperage divider circuit of some sort?

    Thanks,

    No current will flow at all as it's an input and besides the current rating is more of a guide but it is referring to the pin as an output where it would sink or source current. If you connect a pin to Vdd it will read a high but if you disconnect it, it will still read a high perhaps as it is such a high impedance input and the tiny amount of capacitance will hold that reading (for a while). Typically we just connect the button to ground and to the pin and use a pull-up resistor (around 10K) from the pin to Vdd. When the button is pressed the input is read as a 0 and when it's released it reads a 1.
  • potatofacepotatoface Posts: 23
    edited 2013-08-13 01:35
    No current will flow at all as it's an input and besides the current rating is more of a guide but it is referring to the pin as an output where it would sink or source current. If you connect a pin to Vdd it will read a high but if you disconnect it, it will still read a high perhaps as it is such a high impedance input and the tiny amount of capacitance will hold that reading (for a while). Typically we just connect the button to ground and to the pin and use a pull-up resistor (around 10K) from the pin to Vdd. When the button is pressed the input is read as a 0 and when it's released it reads a 1.

    ah . thanks for clearing that up. I forget that those pins are very sensitive to voltage .


    So, If I were to use the pin as a voltage source to power a LED light, the in-line resistor is to make sure that the LED is not blown by too much current?
  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-08-13 02:11
    potatoface wrote: »
    ah . thanks for clearing that up. I forget that those pins are very sensitive to voltage .


    So, If I were to use the pin as a voltage source to power a LED light, the in-line resistor is to make sure that the LED is not blown by too much current?

    A 100 ohm should keep most common LEDs safe. You also want a resistor to limit current for the Propeller's sake. If you connected a Propeller pin to ground and made it an output and set the pin high, the current flowing from the pin could destroy it.

    One thing to keep in mind is a pin set as and output can both source and sink current. If the ouput pin is set high, it will source current (if there's a place for the current to flow). If the pin is low it will sink current (if there's current to sink).

    So you could connect the anode of an LED to 3.3v, a 100 ohm resistor to the cathode of the LED and the other side of the resistor to the Prop pin. In this case whenever the pin is set as an input it will block the current flow and the LED will be off. When the pin is switched to an output, even though it is set low, the LED will turn on. Setting the pin high will actually turn off the LED since the external 3.3V source doesn't have a corresponding low voltage level to flow towards.

    Input mean the Prop will sense the state of the pin. It does not let current enter the Prop (as long as the voltage isn't above 3.3V).

    Years ago, when I was new to all this, I thought a pin set as an input would allow current to flow "in". I was wrong. Current flows in when a pin is set as an output and also set low (it's low by default). You use a pin in its output state to control outside devices (LEDs, other chips, etc.). Use a pin as an input to receive input from the outside world as in button presses, and receiving data from other chips.

    BTW, Welcome to the forum. This stuff is a lot of fun. I hope you check out my index (a link is in my signature) for some of the forum posts I've found interesting. Post #2 of my index has a list of my projects. Most (if not all) of my projects are based on the Propeller. Post #3 has links to some tutorials which make learning to use the Propeller easier.
  • Clock LoopClock Loop Posts: 2,069
    edited 2013-08-13 08:58
    A book well worth its cheap price.
    Start here: http://www.amazon.com/dp/0071771336/ref=rdr_ext_tmb
Sign In or Register to comment.