-->
Page 1 of 1

ESP.deepSleep mode

PostPosted: Wed Dec 14, 2016 11:23 am
by Eternyt
Can anyone tell me what are the differences between the four deep sleep mode (WAKE_RF_DEFAULT, WAKE_RFCAL, WAKE_NO_RFCAL, WAKE_RF_DISABLED)?
Thanks!

Re: ESP.deepSleep mode

PostPosted: Wed Dec 14, 2016 3:08 pm
by AcmeUK

Re: ESP.deepSleep mode

PostPosted: Thu Dec 15, 2016 9:01 am
by Eternyt
So, if I have understood well the mode not affect the sleep but when the module wake up again:
-WAKE_RF_DEFAULT(aka deepsleepsetoption0): do or not do the radio calibration depending on the init byte 108.
-WAKE_RFCAL(aka deepsleepsetoption1): do the radio calibration every time.
-WAKE_NO_RFCAL(aka deepsleepsetoption2): do NOT the radio calibration on wake up.
-WAKE_RF_DISABLED(aka deepsleepsetoption3): on wake up DISABLE the modem. So for example I can't connect the esp to wifi.
Is it correct?

Other two question:
-What is the radio calibration, and what is the pro/cons of do the calibration every wake-up?
-How much current drain the calibration?

Thanks!

Re: ESP.deepSleep mode

PostPosted: Sun Apr 16, 2017 2:00 pm
by helpfinder
Hi there, I am quite new with ESP and microcontrollers,
I have running ESP8266-12e with DHT22 and it is working well. I am using this code

Code: Select all/**************************************************************
 * Blynk is a platform with iOS and Android apps to control
 * Arduino, Raspberry Pi and the likes over the Internet.
 * You can easily build graphic interfaces for all your
 * projects by simply dragging and dropping widgets.
 *
 *   Downloads, docs, tutorials: http://www.blynk.cc
 *   Blynk community:            http://community.blynk.cc
 *   Social networks:            http://www.fb.com/blynkapp
 *                               http://twitter.com/blynk_app
 *
 * Blynk library is licensed under MIT license
 *
 *
 **************************************************************
 *
 *
 *
 * WARNING :
 * For this example you'll need SimpleTimer library:
 *   https://github.com/jfturcot/SimpleTimer
 * Visit this page for more information:
 *   http://playground.arduino.cc/Code/SimpleTimer
 *
 *
 *   DHT22 ----gpio12
 *
 **************************************************************/

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
#include <DHT.h>
#define DHTPIN 12 //pin gpio 12 in sensor
#define DHTTYPE DHT22   // DHT 22 Change this if you have a DHT11
DHT dht(DHTPIN, DHTTYPE);

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "xxxxxxxxxxxxx";  // Put your Auth Token here. (see Step 3 above)

SimpleTimer timer;

void setup()
{
  Serial.begin(9600); // See the connection status in Serial Monitor
   Blynk.begin(auth, "xxx", "xxx"); //insert here your SSID and password
 
  // Setup a function to be called every second
  timer.setInterval(1000L, sendUptime);
}

void sendUptime()
{
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
   //Read the Temp and Humidity from DHT
  float h = dht.readHumidity();
  float t = dht.readTemperature();
 
  Blynk.virtualWrite(10, t); // virtual pin
  Blynk.virtualWrite(11, h); // virtual pin
}

void loop()
{
  Blynk.run();
  timer.run();
}


I have 2 questions here:
1. where is the best to put ESP.deepSleep(300000000); to sleep ESP for 5 minutes?
2. what to do if I need to stop ESP deepSleep, e.g. I need to upload new code into it etc. Is it enough just disconnect RST and GPIO16 or something else. I want to know what are the steps before I use deepSleep in the code to avoid "brick" my ESP

Many thanks for your help