The idea is like this:
- connect two rotary encoders to a hardware "hex" debouncer (MC14490)
- 6 (!) outputs of the debouncer go to a cmos 8-port AND gate (CD4068B) (as the idle encoders are not pulling the pullups, so input and output of the debouncer are idle high). Two spare inputs are of course tied to +.
- output of the above AND gate (normal output) goes to an 8-port OR gate (CD4078B). The output of GPIO 14 also goes to one of the OR gate inputs. Other inputs are tied to ground.
- inverted output of the OR gate goes to a one-shot 555 circuit that makes sure output is kept high for some time after a trigger (from either the rotary encoders or the GPIO).
- output of the 555 goes to CH_PD of the ESP8266.
It actually works, so that's not the question .
Please note all four used IC's are low-power CMOS variants, power usage is in the nano- and pico-ampere range.
Still, after the ESP8266 is powered down (CH_PD is set to low), I see for one second a power usage of 1 mA, which is not too good, but still more or less reasonable. But after a second it goes to 14 mA, which is totally unacceptable for battery operation. It stays at that usage, so it's not a capacitor charging.
For the p-o-c I am using an ESP-201, which has a power led on board. I already killed that . Also I set all unused GPIO to be an input, but it doesn't matter. Anyway, as I am using pullups of 10k or more, that cannot be the explanation for the high power use.
After the CH_PD has been down and it set to high again, the ESP8288 is clearly booting, so it really has been off.
The power used is measured between DC/DC converter and the general power rail, so it can't be a DC/DC converter issue.
If I disconnect CH_PD altogether, power use is 0.6 mA which I think is acceptable and also proof that it's not the other four IC's that are the problem. You'd almost suspect that CH_PD isn't drawn "low" enough and some current keeps flowing inside the chip just not enough to keep it running? Strange, I'd suspect a schmitt-trigger input there, really.
The 555 is a NXP ICM7555, CMOS version of the 555, output is push-pull so no pull-up required, so it's connected directly to the CH_PD. I think it's hard to believe that the 7555 doesn't deliver a proper drive to ground, it can drive up to something 100 mA... Also I also can hardly believe the 7555 will need to supply a high amount of current to the CH_PD pin. On my board there is nothing else connected to it, but who knows on the ESP201 board...
Might be interesting to measure the current flowing there.