ESP.deepSleep on ESP 8266-12 with consumption of 190mA?

Hello guys
Here I am, the Portuguese who can not write English (only with the help of my friend Google) and are learning ESP 8266.
I ask again for help for the following:

I want to make a detector for door opening and closing a battery powered using any model of the ESP 2866, in this case the model 12.
The needs are as follows:

  • Inform the opening or closing of the door as soon as possible. At this stage I use BLYNK.
  • Use the previous point to know the battery status using ADC_MODE (ADC_VCC) and ESP.getVcc ().
  • Use deep sleep to “numb” the ESP 8266 indefinitely until motion is detected on the door (open or close).
  • When detecting door movement, it reads the status of the door, reads the battery voltage, sends this information (in this case via BLYNK) and returns to “sleep”.

To detect the opening of the door I use a magnetic reed, connected to the gpio 12 and to wake up another reed connected between the reset and the negative.
I did not make the connection between reset and gpio16 because I do not want the ESP 8266 to wake at the end of x time, but stay permanently “out of service” until the door moves.
This second reed, to reset, must be installed so that it is always open and only closes momentarily when the door is moving. That is, either with the door open or closed the magnetic must always be out of reach of the reset reed and only when the door opens or closes to pass momentarily by the reed. Ideally the same magnetic would act the two reeds, which is difficult, but that’s another story. I will use two reeds and two magnetic ones for now.
I was able to program the ESP 8266 to meet all the needs, but I can not lower the consumption below 195mA. This consumption is unacceptable because I do not want to constantly change batteries.
I have researched and everything I find that using ESP.deepSleep (0), the ESP 8266 gets sleep" indefinitely (because the time setting is “0”) and consumption should drop to 10μA.
As I already said in terms of programming everything is solved and I am sure that the ESP 8266 is in deep sleep because immediately following ESP.deepSleep (0), I put the instruction Serial.println ("******** ***** ") that is never executed.
As an additional note, the ESP 8266 warms up considerably, which seems to contradict what I said in the previous paragraph.
I can not figure out why I can not get consumption down to 10μA as everything I’ve read says.
Someone can help me ?

#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

ADC_MODE(ADC_VCC);  // Activates internal voltage measurement function

char auth[] = "xxxxxxxxxxx";
char ssid[] = "xxxxxxxxxxx";
char pass[] = "xxxxxxxxxx";

const int DoorGpioPin = 12; // [D6 on NodeMCU] pin we're connected to Door
const int ledGpioPin = 13; // [D7 on NodeMCU] pin we're connected to LED

void setup() {
  Blynk.begin(auth, ssid, pass);
  Serial.begin(115200);
  Serial.println("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); //  Simulates the serial monitor cleaning
  Serial.println("");

  // prepare GPIOs
  pinMode(DoorGpioPin, INPUT);
  pinMode(ledGpioPin, OUTPUT);

  // Checks the status of the door

  if ( digitalRead(DoorGpioPin) == HIGH ) //closed
  {
    String doorState = "  Porta Fechada";
    Blynk.notify(doorState);  // Notifies Blynk
    Blynk.virtualWrite (V2, doorState); // String for LCD Blynk
    digitalWrite(ledGpioPin, 1); // Turns off the local Led on GPIO 13 [D2]
    Blynk.virtualWrite(V4, 1);  // turn app LED on V4 OFF
    Serial.print(doorState + " \t");

  }

  if ( digitalRead(DoorGpioPin) == LOW )  //opened
  {
    String doorState = "**PORTA ABERTA**";
    Blynk.notify(doorState);  // Notifies Blynk
    Blynk.virtualWrite (V2, doorState); // String for LCD Blynk
    digitalWrite(ledGpioPin, 0); // Turns on the local Led on GPIO 13 [D2]
    Blynk.virtualWrite(V4, 255);  // turn app LED on V4 ON
    Serial.print(doorState + " \t");

  }

  //***********************************************************
  //Reads Battery
  float bat = ((float (ESP.getVcc()) / 954.545)); // Reads voltage on ESP8266 [954.545=ESP.getVcc/3.3v
  Blynk.virtualWrite (V3, bat); // Sends battery status to Blynk
  String batState = ("Bateria= " + String (bat));
  //***********************************************************

  // Print for Serial Monitor - See the connection status in Serial Monitor

  Serial.print (batState + " \t");
  //Serial.println ("ESP.getVcc: " + String (ESP.getVcc())); // Option to discover the value of ESP.getVcc()

  Serial.println("");
  Serial.println("I'm gooooing to sleeeeeeeeep....ZZZZzzzzzzzzz");

  ESP.deepSleep(0);

  Serial.println("*************");

}

void loop() {

}

Have you removed the LED and 3.3V power regulator?

190ma is way too much for esp! something is not ok. i use wemos d1 mini pro, and the power consumption is around 75-80ma with wifi, and ~20ma without wifi. never had consumption above 100ma!

you should check your multimeter and if it measures ok, then check your wireing / schematic.

It does not have any Led

I have already remembered the problem being the multimeter, but how far I can test it seems to be good.
As for the schematic I checked it several times and found no error.
In addition, everything seems to work well in addition to the ESP 8266 heating and measuring 190mA

For what I researched 190mA is the normal consumption of ESP

during operation.

but you only want operation when the door moves, correct?

when i use deep sleep, i put the amount of time to sleep in this command,

but you put zero, so obvious it doesnt sleep?

Correct.
The problem is to stay with 190ma after deep sleep ie not 10μA as it is supposed

there is no deep sleep.

you are not using it properly.

If you enter 0 as the deep sleep timer… it will sleep until reset or D0 pulled to RST pin… like a switch.

You’re suppose to put a delay(100) after the ESP.deepsleep function… try that.

1 Like

but if it is chewing 190mA it is not sleeping?

Probably because he didnt delay to give the MCU time to sleep…

Nearly all tutorials on Google say that you need to put a delay(100) right after the deepsleep command.

1 Like

I read somewhere that gets put or he falls asleep indefinitely. I suppose this is correct. But I’ve also tested with, say 100000, and it’s the same thing.
As I said at the beginning, I think it goes into deep sleep because it never gets to run Serial.println ("*************")

oh, yeah, i have a delay(10) after mine, so your story check out Master guru master

1 Like

that is false logic, as you say it is chewing 190mA so it is NOT sleeping.

I’m going to try delay (100) or (10)

1 Like

I tried delay (10) and it’s the same thing.
In my logic after running deep sleep does not execute any more command, neither delay (xx).
Is this correct?