Shop OBEX P1 Docs P2 Docs Learn Events
What resistor for 5V device? — Parallax Forums

What resistor for 5V device?

lardomlardom Posts: 1,659
edited 2013-02-21 16:52 in Propeller 1
The i/o pin resistor for a Ping is 4.7K and 10K for the IR reciever. Both are 5V devices. The current drawn by the pin is ultra low so Ohm's law clearly doesn't apply here. What is the rule? Is powering a 12V motor with a transistor connected to an i/o pin a bad idea?

Comments

  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2013-02-20 22:29
    Are you asking about 5V devices to the Propeller or Transistors to 5V microcontriollers?
    I answered for the second, but I see this is in the Propeller 1 forum.

    I suppose that you might really want to know something I didn't replay to.

    Connecting a 12v motor powered by an actual 12volts directly to a 5v device is a disaster as it is too much voltage. And if it is a big motor, it may be too much current. Devices usually have 0.5 volts of over-voltage they will allow.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


    Transistors are a bit of a special case as this is usually about driving them to saturation for a heavy load, or non-saturation for linear mode (audio and test equipment)

    Futhermore different conditions for output protection and for input protection create different solution.

    Foremost is to protect the microcontroller in all situations.

    To drive a transistor to saturation... A resistor as little as 220 ohms will protect a BasicStamp at 5V. This 5v/220ohm = about 20 ma. But you often can drive a transistor to saturation with far less, and I often provide only 5ma. You need to learn to read the PDF for the required base current for a saturated condition.

    Some transistors such as the 2n2222 are no problem, but others such as at TIP31 would demand too much current and destroy the i/o port. That is one of the reasons that Darlington pair transistors, like the TIP120 were created.
    ~~~~~~~~~~~~~

    That is the core answer for an output to a transistor. Change it to a MOSfet and the whole situation changes. Change to inputs to the microcontroller and for data a much higher resistor can be used.

    There is the dillema of source and sink. And these are often confused with data signal. And output to aNPN transistor sources, but in some cases we can use a PNP transistor and turn it on with a ground... that sinks current through the microprocessor.

    Similar source and sink conditions can be created with LEDs and the current still needs to be limited to protect the microcontroller.


    ~~~~~~~~~~~~~

    You question is very general. IF you are having problems with a specific hook up, provide a schematic.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-02-20 22:41
    lardom wrote: »
    The i/o pin resistor for a Ping is 4.7K and 10K for the IR reciever. Both are 5V devices.

    In general, if the Propeller is just receiving a signal from a 5V device the resistor value doesn't matter much as long as it's above ~3K (I usually use 10K since I have lots of them). In cases like the Ping, there's a complication since the Prop not only receives a signal from the Ping but also sends a signal to it. This is when a large resistor value can cause a problem. If the device requires both input and output then you want to use a resistor closer to the 3K value so the 5V device will recognize the 3.3V as a logic high.

    I've had 5V devices not recognize a Prop's signal if there was a 4.7K resistor in series but would recognize the signal fine without a resistor (this was a one way communication line).

    I'll let Loopy and others discuss the transistor issues.
  • JonnyMacJonnyMac Posts: 9,108
    edited 2013-02-21 00:00
    You only need a resistor for a driven signal. The IR receiver has a pull-up to 5v of about 20K -- this is plenty to protect the Propeller IO pin. When the signal is active the line is pulled low through an NPN transistor.
  • lardomlardom Posts: 1,659
    edited 2013-02-21 06:42
    Quote by Loopy Byteloose
    Are you asking about 5V devices to the Propeller or Transistors to 5V microcontrollers?
    It was a two part question: 1)Why do you need a large resistor value in series with a Propeller pin? 2)Is it dangerous to drive a 12V motor through a transistor whose base is connected to a Prop?
    I'm starting to think about controlling larger machines so 'guessing' as I have done up to this point will no longer do. Sorry about the lack of clarity.
  • tonyp12tonyp12 Posts: 1,951
    edited 2013-02-21 07:29
    With Transistors you pretty much use the highest resistor value on the base that still gets you the saturation you want.
    Most of the time 2K ohm will make the transistor turn on hard (eg fully on)

    >I'm starting to think about controlling larger machines
    Then it's time to go with power mosfets.
  • Duane C. JohnsonDuane C. Johnson Posts: 955
    edited 2013-02-21 07:31
    Hi Larry;
    Here are some example circuit snippets:
    Prop_Interface.png

    Link
    Generally the resistors shown are about the minimum advisable values for safety.
    Other considerations often apply. These are just the core circuits.

    Duane J
    961 x 976 - 30K
  • lardomlardom Posts: 1,659
    edited 2013-02-21 09:10
    @Duane C. Johnson, I made a jpeg of of your interface diagram.

    @tonyp12, I'll look into power mosfets and opto-isolators.
    Quote by Duane Degn,
    In general, if the Propeller is just receiving a signal from a 5V device the resistor value doesn't matter much as long as it's above ~3K
    Good tip. I'll remember that.

    Quote by JonnyMac
    You only need a resistor for a driven signal. The IR receiver has a pull-up to 5v of about 20K -- this is plenty to protect the Propeller IO pin. When the signal is active the line is pulled low through an NPN transistor.
    I destroyed the ground pin on one of my two ir recievers so I'll just take it apart to see what's inside.
  • Duane C. JohnsonDuane C. Johnson Posts: 955
    edited 2013-02-21 09:46
    Hi Larry;
    lardom wrote: »
    @Duane C. Johnson, I made a jpeg of of your interface diagram.
    I added a link to this diagram on my website:
    Link
    Ok, this is a .png instead of a .jpg.

    I intend to edit or add things from time to time.

    Duane J
  • Mark_TMark_T Posts: 1,981
    edited 2013-02-21 16:03
    lardom wrote: »
    It was a two part question: 1)Why do you need a large resistor value in series with a Propeller pin? 2)Is it dangerous to drive a 12V motor through a transistor whose base is connected to a Prop?

    An input above 3.3V will pull the pin voltage up until an input-protection diode starts conducting - its job is to help prevent static electricity discharges
    damaging the gate oxide on the input transistors on that pin.

    However these protection diodes aren't very big and can only handle (IIRC) about 0.5mA or so continuous without risk of damage in the long term.
    The series resistor limits the current to at or below the safe limit.

    One consequence of having a series resistor of a relatively large value (10k say) is that it forms a low-pass filter in combination with the input
    capacitance on the pin (due to the chip and the pcb traces). Thus the risetime of logic transitions will be somewhat larger - this can matter
    with fast clocked interfaces (10's of MHz ballpark)

    And with the transistor base - no problem, the base-emitter voltage is limited to at most 1V in most devices (its a forward biased junction),
    so the 12V or whatever on the collector isn't relevant (unless you burn up the transistor - then the base resistor has the job of protection)
  • lardomlardom Posts: 1,659
    edited 2013-02-21 16:52
    Mark_T wrote: »
    And with the transistor base - no problem, the base-emitter voltage is limited to at most 1V in most devices (its a forward biased junction),
    so the 12V or whatever on the collector isn't relevant (unless you burn up the transistor - then the base resistor has the job of protection)
    That, my friend, is great news. I wondered about that. I reasoned that the base/emitter voltage was different from the voltage through the emitter/collector even though the emitter was common to both circuits because they were 'separate' circuits. I didn't know how to verify it and I couldn't find the answer after doing an internet search.
Sign In or Register to comment.