Chat freely about anything...

User avatar
By shoelessone
#37425 Hello all!

I'm working on a (new!) project with the esp8266. Long story short, I happened across this blog post here: https://www.hackster.io/noelportugal/if ... ton-e11841

In the past, the writer is using a diode and connecting vcc directly to ch_pd. Here is a screenshot if you don't feel like clicking:

Image

My question is this: why is the diode used here? I'm slowly (very slowly!) learning, but it seems that generally you could just connect vcc to ch_pd through a resistor and be "good." It's not clear to me why the diode is used here, and why the diode is used instead of just using a resistor?

I actually posted a question on this blog post to ask the writer why this was done, but a few weeks later I haven't gotten a response so I figured I'd ask here!

Thank you for your help (as always!)
User avatar
By gtalusan
#37511 The button sets GPIO 0 and 4 high. This will turn on the ESP. The code running on the ESP will also set GPIO 4 high. Now when the button is released, GPIO 4 takes the place of the button and magic pixies will flow from GPIO 4 to GPIO 0 and CH_PD to keep the ESP turned on.

The diode is there to prevent the pixies from running back through the button. You only want the pixies going to GPIO 0 and CH_PD.

I believe a GND connection with 10k pull down is also needed from the backend of the diode so that CH_PD, GPIO 0 and (less importantly) GPIO 4 aren't floating.
User avatar
By Barnabybear
#37520 Hi, I'm guessing it was taken from this post viewtopic.php?f=11&t=4458
If the PIR no longer detected movement the output would return low. If the output was able to sink current it could pull the CH_PD pin low before the ESP had completed its task. The diode prevents this.
User avatar
By shoelessone
#37558
Barnabybear wrote:Hi, I'm guessing it was taken from this post viewtopic.php?f=11&t=4458
If the PIR no longer detected movement the output would return low. If the output was able to sink current it could pull the CH_PD pin low before the ESP had completed its task. The diode prevents this.


I suppose this makes sense, but if you take the PIR sensor out of the equation and are totally controlling GPIO4 in software, would the diode still be necessary?