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

prove you can deep sleep your device.

that is step 1.

remove all code and just get it to deep sleep for 10 seconds, then wake, then sleep then wake.

show serial output.

then for step 2 you can add in the reed switch code, then the blynk code…

While I can’t speak for any deep sleep gurus (whom are probably sleeping :slight_smile: ) I can say that I think you need at least something in your void loop… :wink:

An empty loop just makes for boring hardware… except on boot!

How does the system know when to sleep/wake, or do anything else for that matter, without at least Blynk.run();

If you put:

ESP.deepsleep(10 * 1000000); 
delay(100);

the device will sleep 10 seconds and reboot… regardless what is in the loop.

If you use:

ESP.deepsleep(0); 
delay(100);

It will sleep forever or until you pull D0 to RST or reboot it.

1 Like

the question is - what does this code do with yoru hardware?

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

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

const int sleepTimeS = 10; //this is n seconds

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("I'm gooooing to sleeeeeeeeep....ZZZZzzzzzzzzz");
  Serial.print("Time: ");
  time = millis();  //prints time since program started
  Serial.println(time);
  delay(10);
  ESP.deepSleep(sleepTimeS * 1000000);
  delay(10);
}
void loop() {
}

Hello jamin
Thank you for your intervention.

This is exactly what I want, but with the 10μA contained in the manuals.
However, I took the suggestions that made here, and I changed the code but the result is the same.

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

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

char auth[] = "xxxxxxxxxxxxx";
char ssid[] = "xxxxxxxxxxxxx";
char pass[] = "xxxxxxxxxxxx";

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);
  Blynk.run();
  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);

 
}

void loop() {
 // 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);
  delay(100);

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

}

Yep, I thought so… you did say this earlier on…

@toco Aside from the hardware/power mods mentioned by @Dave1829 and the software adjustments by @Jamin If you are still running at too high a current load, perhaps you have something wrong with the device itself? Do you have anything else to test with?

and can you show these results?

I can always make another circuit in case there is any problem with the current one, even though I have already done several checks.
But only tomorrow. It’s 2:00 in the morning here.
But I liked that someone told me, from their own experience, if they had effectively measured the 10μA in deep sleep.

I dont have an ESP module to test with, only dev boards, but ill knock something up when I get home and post up my results.

Each time I reset the result is expected.

Yup that is the typical serial output of a deepsleep reboot.

@toco Well, “deep sleep” on it :wink: … but since low power modes have nothing to do with Blynk directly, you may find only limited quantity and subjective advice here. I recommend you also ask around at dedicated ESP8266 forums.

Then share your findings here to increase our knowledge :stuck_out_tongue_winking_eye:

:joy:

and the 190mA - where is this measured?

OK
I’ll take the advice and try elsewhere.
Then, if it’s worth it, I’ll come back here to share.
THANK YOU ALL.

I have this running on my mailbox and it works great for weeks on a 800mah cell phone battery. Ground is tied to reset through a normally closed push button switch. When the mailbox is closed the circuit sleeps at about 10 micro ah. When the mailbox door is opened the switch closes and then opens when it is closed sending the data. Battery voltage is an ESP8266 function so no wires required. Oh…it also sends the temp outside through a dallas onewire sensor on pin 0. This is a picture of the board if it links.

Hope it helps.

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <DallasTemperature.h>
#include <OneWire.h>

char auth[] = "basdlfj;alkdfjalskdfjals;kdfjaslkdfj"; //mail box  
const int sleepTimeS = 1000;

#define ONE_WIRE_BUS 0 
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature DS18B20(&oneWire);    // Pass our oneWire reference to Dallas Temperature.
float T1,T2;  // Temps in C&F
ADC_MODE(ADC_VCC);

void setup()  
{
DS18B20.begin();
 Blynk.begin(auth, "SSID", "PW", IPAddress(123.456.1.1)); 
DS18B20.requestTemperatures(); // Send the command to get temperatures
T1 = (DS18B20.getTempCByIndex(0)); //Centigrade
T2 = int(((T1*1.8)+32)-2);    // F
Blynk.virtualWrite(5, T2); // Round F  
float voltage = ESP.getVcc()/1072.43; // mess with this denominator to get accurate voltage
Blynk.virtualWrite(2, voltage); //battery voltage
Blynk.email("Mail", "You've got mail!");
//delay(1000);
Blynk.run();
 
ESP.deepSleep(sleepTimeS * 10000);
}
  
void loop()
{
}
1 Like

Thanks randobi99 for the help.
Please tell me how much your circuit consumes when it’s in deep sllep.

@toco What @Dave1829 had pointed out :wink:

@randobi99 The mailman(woman) hasn’t freaked and called in any bomb scares yet? :smiley: