Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 7 of 7

Thread: combining 2 digital output's to get more mA?

  1. #1
    Senior Member
    Join Date
    Dec 2016
    Location
    EU
    Posts
    217

    combining 2 digital output's to get more mA?

    Probably a stupid question from a software guy:

    While driving an optocoupler I have to limit the input below 5mA (or 10mA or even 20mA depending on the teensy), this by adding a current limiting resistor.

    Can I combine 2 digital output's with there own current limiting resistor to deliver more mA to the optocoupler?

  2. #2
    Senior Member
    Join Date
    Aug 2013
    Location
    Ohio
    Posts
    125

    Related to drive strength, seen in Raspberry Pi documentation

    Interesting coincidence... Reading some tech docs on the Raspberry Pi over the weekend, I discovered that's approximately how they handle PIO drive strength: https://www.raspberrypi.com/document...-is-controlled

    It is possible to use multiple output amplifiers to drive a signal. But it's also possible to get into a bit of trouble if software doesn't drive them to the same states consistently.

  3. #3
    Senior Member
    Join Date
    Sep 2021
    Posts
    170
    the normal way would be to use a transistor.

  4. #4
    Senior Member
    Join Date
    Dec 2016
    Location
    EU
    Posts
    217
    Quote Originally Posted by Mcu32 View Post
    the normal way would be to use a transistor.
    Yes I also thought about a BS170.

    The second reason that I thought about using 2 DO's is that I can lower the current after the "start", to limit the current on the LED part of the optocoupler and the Teensy.

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    27,406
    Yes, you can do this with 2 resistors. Just try to avoid driving the pins to opposite outputs. If each pin has its own resistor, the hardware should be fine, but it does waste power.

  6. #6
    Senior Member
    Join Date
    Dec 2016
    Location
    EU
    Posts
    217
    Quote Originally Posted by PaulStoffregen View Post
    Yes, you can do this with 2 resistors. Just try to avoid driving the pins to opposite outputs. If each pin has its own resistor, the hardware should be fine, but it does waste power.
    Thanks

    Changing the pin to digital in without pull-up when not driving the output is avoiding driving some output, am I right?

  7. #7
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    27,406
    If the LED anode is connected to 3.3V and the resistors connected to the cathode, so logic low turns on the LED, you could use pinMode OUTPUT_OPENDRAIN to avoid any conflict.

    But the conflict probably isn't a big problem if you keep the time short. The wasted current will be approx the same as when the LED is on. Even if the conflict time is 1 microsecond (a long time for Teensy 4) the LED needs to be on for a good portion of 1 second for a human to observe. The total amount is extremely small because the time is so short.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •