I am planning to use i2c based port expander (earlier I was using atmega328P's GPIO) for inputs and outputs. On a digikey search, I found MCP23008, MCP23009 and MCP23017 as possible replacements. Out of these three, only MCP23017 is push-pull. Other two are open-drain. I have an understanding that push pull can actively source and sink and open-drain cannot actively source. I am not very sure how does this affect my use case and hence I need some expert advise.

Here is the use case:

Switch sense and triac

SS1 and TRIAC1 are supposed to go on GPIO of port expander. SS1 is supposed to be digitally read and TRIAC1 is supposed to be driven HIGH or LOW.

As such does it matter whether I use open drain or push pull type? If yes, which is the better option? Also, I want to keep the component to a minimal. Ex - I want to drive the triac driver directly by the port expander rather than using another transistor. So, please take this in consideration as well.

Note: Both circuits will be replicated 4-10 times on the PCB and hence the requirement of port expander.


1 Answer 1


Push-pull or open drain is relevant only for output ports. So for the SS1 pin, it does not matter.

However, to drive the TRIAC1 wire, given the schematic you gave, it is mandatory that you use push-pull. If you use open drain, either TRIAC1 is pulled to ground (with logical state 0), or unconnected (with state 1). In both cases, the optotriac LED wouldn't turn on and the triac wouldn't trigger. If you use push-pull, you can source current to the led (with state 1) so it's ok.

Now, there would be ways to make it work also with open-drain outputs, without using more components: if you connect the anode of the led to +3.3V and the cathode to the resistor and then to the TRIAC1 output of the MCU, you can use both push-pull or open-drain, as you wish. In both cases, you'd be able to turn the light on by setting the output to logical state 0 and turn it off by setting it to 1.

  • \$\begingroup\$ Thanks dim. About the workaround you mentioned, is it well accepted in the industry or just a hacky workaround? The board might be placed in electrically noisy environments. \$\endgroup\$ May 12, 2016 at 9:52
  • \$\begingroup\$ This is not a workaround, this is a real solution, and is often chosen by designers. The advantage vs push-pull is that you have more flexibility for the supply voltage of the led. For example, you could supply +5V to the led and the expander, even if powered with 3.3V, would be able to sink current and supply the led with +5V. And you can have different supplies for different output pins, also. You have to check the maximum rating on the GPIO pins of the chip, however (in this case, +5.5V). \$\endgroup\$
    – dim
    May 12, 2016 at 10:10
  • 2
    \$\begingroup\$ @Whiskeyjack The push-pull is needed if you have high frequency switching, because it sources, than it sinks - it takes also the capacitive charge, the LED would turn off quicker. In your case it's irrelevant what you gonna use. Also, there is quite impossible that a noisy environment would induce such current to turn on the LED. \$\endgroup\$ May 12, 2016 at 10:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.