Electronic – Confused between push-pull and open-drain


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.

Best Answer

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.