combining 2 digital output's to get more mA?

AlainD

Well-known member
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?
 
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/documentation/computers/raspberry-pi.html#how-drive-strength-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.
 
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.
 
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.
 
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?
 
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.
 
Back
Top