Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By Erik84750
#73210 For a ESP8266-12E/F interface board I would like I/O pins to be configurable as either input or as output, with the accompanying required hardware setup.
Therefor an optocoupler CNY17 is used when configured as input, and a N-channel MOSFET when configured as output.
Input- and outputconnectors are separate.
See drawing attached. Is this an acceptable hardware configuration?
You do not have the required permissions to view the files attached to this post.
User avatar
By btidey
#73213 Few comments

MOSFET seems to be upside down. Drain is shown connected to 0V. I suspect you are trying for an open drain output.

There is nothing limiting input current to opto. If you are assuming external resistor or a current source that's ok but I would put in at least a limiting series resistor to avoid blowing the opto.

The output would follow the input when used in input mode. That may be OK.

If the GPIO is output and the input turns the opto on then there is a serious conflict. You should have a series resistor from the emitter to limit this. A value of say 2.2K will still allow a good high to be developed on input but limit the current if the opto turns on and GPIO is output low.
User avatar
By Erik84750
#73218 Hi btidey, thank you very much for your very valid and valuable comments! The schematic will be adapted asap, I will post the full result for your information.
User avatar
By Erik84750
#73219
btidey wrote:Few comments

MOSFET seems to be upside down. Drain is shown connected to 0V. I suspect you are trying for an open drain output.

(..)

The MOSFET is N-channel, hence lowside: source is connected to ground, drain to load, load to positive.

EDIT: strike through above, you are entirely correct!! MOSFET upside down, will be corrected. Thank you!