I've got a circuit which I'm hoping to use to shut down my ESP, except where an interrupt happens from an external chip (MCP23008 GPIO expander), or I have chosen to manually keep myself enabled.

ESP schematic extract

Being a bit cheap, I wanted to do this using diodes - D1 is being fed from the interrupt line on the MCP23008, and D2 is being fed from another GPIO pin on the ESP. It seems that this works for keeping the pin held high (the ESP boots just fine on power up, when the INT pin is high by default, then I bring the GPIO pin high to keep it up), however when the interrupt pin goes low (I set it to Active-High mode), and I turn off the GPIO, the pin remains at 3.3V - even though the two sources on the other side of the diode are now at 0V. Clearly the capacitance on the input is retaining the charge and there's nowhere for it to go.

So I've put a 1K2 pull-down resistor in - however this doesn't seem to have quite the desired effect, and the pin sits at about 2.5V (3.3 - diode drop, more or less) and the CPU does not appear to run. I'm not sure if it's just because the pull-down is too strong.

What is the correct solution here, and can it be done with just diodes and/or MOSFETs (and passives)?

EDIT: this is a followup to ESP8266 Wake from deep sleep with an interrupt (not a duplicate as the question is different)

  • \$\begingroup\$ You need to determine what is driving the signal high. Remove the diodes and try your pulldown on each of the two inputs and on CH_PD in turn, until you determine which results in a notably non-zero voltage across the resistor. Then figure out why. You may need to revise your overall plan. \$\endgroup\$ – Chris Stratton Jul 6 '17 at 22:06
  • \$\begingroup\$ ESP has funky GPIOs: as you pull CH_PD low, some pins go high, but 4+5 don't. you shouldn't need the diodes if you use INPUT_PULLUP instead of OUTPUT +HIGH to float PH_PD in union with the active high external, unless it's not an open collector... \$\endgroup\$ – dandavis Jul 6 '17 at 22:13
  • \$\begingroup\$ Worth mentioning that because the default setting of the interrupt pin is active low, low impedence out. It can be open collector if configured as such, but only after booting once to write the registers. So I have to make it function when the pin is driven high. \$\endgroup\$ – naxxfish Jul 7 '17 at 4:56
  • \$\begingroup\$ Also this is pretty much exactly what I'm trying to do \$\endgroup\$ – naxxfish Jul 7 '17 at 6:01

enter image description here

Figure 1. Schottky diode IV curves. Source: CMLSH05-10DA datasheet.

If you want to use diodes for the OR gate you could consider Schottky diodes which have a lower forward voltage drop. If you were to aim for a 350 mV drop at 25°C you should restrict the current to 0.3 mA. \$ R = \frac {V}{I} = \frac {2.95}{0.3} = 10 \; kΩ \$.

As an aside, does anyone know why the 25°C curve is between 125°C and 40°C?

  • \$\begingroup\$ It's really small, but if you squint I think that's -40C. \$\endgroup\$ – DigitalNinja Jul 6 '17 at 22:34
  • \$\begingroup\$ Ha! That makes sense. \$\endgroup\$ – Transistor Jul 6 '17 at 22:36
  • \$\begingroup\$ This could be a solution - if it is indeed that the 0.7V drop is what's causing the problem. I'm not sure at the moment... I don't know what the specs on the CH_PD pin are exactly as to what is considered HIGH. \$\endgroup\$ – naxxfish Jul 7 '17 at 6:03
  • \$\begingroup\$ Accepting this, because it was the most helpful. Actually, the need for this solution is not required as I've found another solution to the underlying problem! \$\endgroup\$ – naxxfish Jul 7 '17 at 15:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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