Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By buchacho
#54160
Barnabybear wrote:Hi, use EDIT: GPIO 0 (incorrect -> GPIO 2) not 13 and it will work perfectly. There are not many parts or pins used but each has been chosen for a reason. I explain more tomorrow when I have more time.

What is special about GPIO 0? Are there any other pins I can use that are equivalent?
User avatar
By Barnabybear
#54201 Hi, sorry I didn’t get back to you, and I wasn’t focused during the last set of posts – was building a scope kit. Anyway, the circuit was designed to be used with an ESP8266-01 so GPIO’s where limited. The theory:

In the off state.
The PIR output is LOW.
As there is no input from the PIR, GPIO 0 or GPIO 2 the 10K resistor pulls CH_PD LOW & the IC is powered off.

Wake up.
The PIR output goes high.
This pulls GPIO’s 0, 2 & CH_PD HIGH completing all the requirements for the correct booting of an ESP8266-01 as RESET is pulled HIGH in a different part of the circuit.
GPIO 0: The HIGH is via a diode feeding a 10K resistor and then through a 1K resistor. The diode, dependant on type will drop 0.7V which is the voltage that will be seen on GPIO 0. So 3.3V – 0.7V = 2.6V which is above the 75% Vcc threshold 3.3V * 0.75 = 2.48V, and one of the boot requirements is met. The only purpose of the 1K in this part of the circuit is to ensure that if due to an error in the coding or unexpected event, the PIR is HIGH and GPIO 0 is set as an OUTPUT and set LOW that no more than 3.3mA flows which is below the 12mA maximum current and GPIO 0 is not damaged.
GPIO 2: The HIGH is via the PIR output and through a 1K resistor. GPIO 2 sees the full PIR output voltage meeting another of the boot requirements. Again the 1K resistor prevents damage, if GPIO 2 is set as an OUTPUT and LOW, and the PIR is HIGH or the GPIO HIGH and the PIR is LOW. In the original design of the circuit GPIO 2 could detect the state of the PIR output. The ESP would wake when a room was entered and report to Thingspeak, then wait until the room was vacated and report again and power off.
CH_PD: The HIGH is via the PIR output through a diode. The same as GPIO 0.

The PIR goes LOW (no longer detects).
GPIO 0: Now set as an OUTPUT and HIGH. The PIR has no effect as it is blocked by the diode.
GPIO 2: Could be set as in INPUT and detect this. It could also be set as an OUTPUT and set HIGH but this would be overridden by the PIR output (LOW) as any voltage would be dropped across the 1K (safely 3.3mA), or as a LOW which would be blocked by the diode from having any effect.
CH_PD: The HIGH is provided by GPIO 0 set as an OUTPUT and HIGH through the 1k and 10K resistors. These form a 1:10 voltage divider which results with 3.0V seen on CH_PD well above 75% Vcc.

The final stage – GPIO 0 is taken LOW to power down the IC.
GPIO 0: Set as an OUTPUT and taken LOW. Unless the PIR goes HIGH again this will power off the IC.
GPIO 2: Unless set as an OUTPUT and HIGH has no real effect here.
CH_PD: Is now pulled LOW via the 1K & 10K resistors – Given that the INPUT resistance is given somewhere in the M ohms should result in a voltage of near zero.

To answer your question: There is nothing really special about any of the pins used and you can swap most out if needed so long as you still meet the requirements of the important pins.
Hope that helps & sorry it I didn’t get back sooner or sounded abit off, if you need more help please post, I don't always catch the posts, so feel free to PM me.
What are you working on?
User avatar
By buchacho
#54928 Barnabybear, thanks for the extensive explanation!! Sorry for the delayed response, I got caught up with some other project stuff. I am working on a similar project, trying to detect if a door is opened, but using a switch instead of a PIR.

What kind of scope kit were you building? Sounds interesting since I kind of need to get one.

Thanks again for your help.