Pull Down when pin set low

Hi,

I need your help. I apparently understand nothing about electricity! SIGH

I am using this guide to do a very low power project. http://www.esp8266.com/viewtopic.php?f=11&t=4458

Everything is working as it should except when I set my holdPin to Low, it does not power off the board. When I measure it with my multimeter, there is still a low voltage 1.6 - 1.3v for a long time on the CH_PD/gpio0 pin. What can I do to kill this low voltage that remains in the system?

Hope you will excuse my incompetence..

Best Regards

Please post schematic and code.

It is VERY simple.

Pin 0 connected to CH_PD

//Example Code void setup() { pinMode(0, OUTPUT); digitalWrite(0, HIGH); Serial.begin(115200); }

void loop() { delay(5000); Serial.writeln("Shutting down"); delay(200); digitalWrite(0, LOW); }

Problem: Pin0 does not go to 0v, it goes to 1.6-1.3v for some reason, hense the board does not power off

D0 is the RX pin do not use it.

.

Yeah. I found that out. I am really using D5, so please ignore that. It was just to align my story with the link description.

Is that the

LarryD: D0 is the RX pin do not use it.

Really?

https://github.com/esp8266/Arduino/blob/master/doc/reference.md

There are several pin numberings used for the ESP8266 - some use the GPIO numbers, and some use the NodeMCU numbers (which are often printed on development boards)... I think the NodeMCU people did a great disservice to the community by making their own, different, set of pin numbers ("snatching defeat from the jaws of victory").

I don't know what the Arduino ESP8266 libraries use - that link is i think for the arduino ESP8266 library people use, but not certain about that. I don't use them with the Arduino IDE.

Brain wasn't engaged. Was thinking Arduino.

DrAzzy: Is that the Really?

https://github.com/esp8266/Arduino/blob/master/doc/reference.md

There are several pin numberings used for the ESP8266 - some use the GPIO numbers, and some use the NodeMCU numbers (which are often printed on development boards)... I think the NodeMCU people did a great disservice to the community by making their own, different, set of pin numbers ("snatching defeat from the jaws of victory").

I don't know what the Arduino ESP8266 libraries use - that link is i think for the arduino ESP8266 library people use, but not certain about that. I don't use them with the Arduino IDE.

I just started using them, and they are pretty powerful, but there is a lot of guessing involved, and not a lot of documentation.

But back to the problem. How can I pull down the voltage when I set the pin low?

But back to the problem.

But back to the question:-

DrAzzy: Please post schematic and code.

Anyone try this setup ?
I want a battery powered button. I used ESP.deepSleep(0); and the Button is connected to RESET.
After the job the ESP-07 goes back to sleep.
Current is about 0,015mA.

Now i see this option. I connect GPIO4 with 2k resistor to CH_PD
At the end of the sketch GPIO4 will set to LOW and the ESP shut down…but i see the LED lights a little bit and current is 0,020mA !

If i manually disconnect CH_PD from Vcc current is very very low and LED is off.
Why this is not if i use an GPIO to switch ?

Anyone can help ?

I don`t use the diode because i read about that the ESP have protection if i use OUTPUT GPIO and put Vcc to this pin.
The button only will push one second until the LED switched on.

EDIT:
Ok, i know what the problem is.
If i cut CH_PD from Vcc the ESP switch off.
If i set the CH_PD to GND (with an resistor as example) it switches of, but not 100%, the LED lights a little bit.
And i think if i set a GPIO to LOW it will pulled to GND ?
I made a test and set the GPIO to INPUT at the end of the sketch, it don´t work.
So if there is no option to “disconnect” a GPIO it will not really work

The OP's circuit:- |500x267

This makes little sense. The 1K is not a pull down resistor. A pull down resistor goes from the pin to ground. The diode is stopping the input getting a proper logic 1 and you are relying on just the reverse diode leakage.

I discussed this trick some years ago on the forum here. It works famously!

47k (sufficient) resistor goes from CH_PD to ground. The diode anode goes to your chosen I/O pin and the button connects CH_PD to Vcc (3.3 V)

Easier to give a schematic:

Grumpy_Mike: The OP's circuit:-

This makes little sense. The 1K is not a pull down resistor. A pull down resistor goes from the pin to ground. The diode is stopping the input getting a proper logic 1 and you are relying on just the reverse diode leakage.

OP's circuit is from 2017...

Reply #9 resurrected the thread, don't know if it's got anything to do with the OPs problem.

@Grumpy_Mike It is not a pulldown resistor. Is for limitation.

@wvmarle I don´t know the problem is the same, i am asking here because they will use the same trick.

@Paul__B Ok, your resistor is bigger as my resistor. For testing i don't used the diode, because i read about the GPIO have protection if i put voltage to a pin that was configured as output.

Do you measure the current on deepsleep and your button trick ?

Thanks to all for replays to this old posting !

EDIT: Ok, i made a test with a simple sketch, switch LED on. Only with resistor, no diode and i do not connect a GPIO pin to CH_PD. The diode is only to protect GPIO for reverse current ?!

ESP start and LED is on. I disconnect CH_PD from 3,3V and the LED switch of, but lights a little bit ! Same test, without resistor to GND. ESP start and LED is on. I disconnect CH_PD from 3,3V and LED is fully of. So if there is an resistor between CH_PD and GND it will not really work.

EDIT2: But if i leave the resistor and use an GPIO it os the same. The ESP will not fully switched off. If i switched the LED of by sketch the current is same as deepsleep ! So this is the problem. So my question, anyone build this really knows the current of deepsleep and this setup ? I think the ESP have a problem with this setup !

That sounds rather confused.

When CH_PD goes to ground, the chip is not in deep sleep, it is completely shut off and will reset. Whatever you measure in this state is the power down specification, not deep sleep.

The diode is to protect the GPIO in case the button is pressed while the GPIO is pulling down. :astonished:

Ok, actually i try this setup again.
I only test it with a programmer connected to my PC in the past.
Now i use an power supply to generate 3,3V

I use an simple sketch: digitalWrite(led,LOW);
to switch the on board LED ON… that’s all ! (I use an ESP8266-07)

If i disconnect the CH_EN pin (pull out the wire) the ESP8266 will power off AND the LED is OFF !

If i switch CH_EN pin to ground the on board LED will light a little bit.
For this i use an Attiny85 with simple digitalWrite(pin,LOW)

And that is the “problem” i am writing about now and before.
In this “LED light a little bit” mode the current is not as low as i disconnect the CH_EN.

@Paul__B
So do you know about this ?
Do you measure the current in deep-sleep, CH_EN off by pulling the wire and by self holding/self off switching like in the sketch you post ?

EDIT:
I tested this on a breadboard. I see that i have differences if i disconnect my wire bridge from Vcc and CH_EN. If the wire is still connected to Vcc the LED light a little.
If the wire is connected to CH_EN only, the LED is fully off.
If i add an multimeter and move my hand over the ESP or the multimeter, the current will change without any touching !

Ok, this flying connection make problems. But my attiny was connected with wires to the ESP and also here i got problems.
I test it again with soldering !
If the test will not work i use the ESP deep-sleep.
Power down is 15µA and deep-sleep 25µA. I will use this and then i forgot the other option.