Deep sleep mode adding to code

Hi, i’m total beginner and i need help. I’m creating this project http://www.instructables.com/id/Pot2/ but i need modify code, beacuse power compsumption is so high and i can’t add more 18650 to design and etc… Simply i want modify code, so NODEMCU will wake up every 30 minuts, read values, send them to Blynk app and go to sleep mode again. Can someone help me and modife the code for me please? BTW I already included wifimanager and probably going totally drop LED

#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif
#define PIN            14 //D5
#define NUMPIXELS      1
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SPI.h>

#include <DHT.h>
#define DHTPIN 12   //D6
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);
float humidity, temp_f; 

int sensor_light = 13;  //D7
int value_light;
int sensor_water = A0;  //A0 analog input
int value_water;


char auth[] = "cad67fdd75414190bf8d05cae9adf943"; //enter blynk auth token

#include <SimpleTimer.h>
SimpleTimer timer;


#include <DNSServer.h>            //Local DNS Server used for redirecting all requests to the configuration portal
#include <ESP8266WebServer.h>     //Local WebServer used to serve the configuration portal
#include <WiFiManager.h>          //https://github.com/tzapu/WiFiManager WiFi Configuration Magic

void setup() {

    Serial.begin(9600);
    
    WiFiManager wifiManager;
    wifiManager.autoConnect("AutoConnectAP", "22061995");
    
    Blynk.config(auth);

    timer.setInterval(5000, water_light); //what is the best way of uploading this data.? the device does not need to be ON
    timer.setInterval(1000, temp_humid); 
    value_light = digitalRead(sensor_light);
    Blynk.virtualWrite(3, value_light);    //V3

}

void temp_humid(){
  float h = dht.readHumidity();
  float t = dht.readTemperature();
  Blynk.virtualWrite(1, t);        //V1
  Blynk.virtualWrite(2, h);        //V2
}

void water_light(){
  value_light = digitalRead(sensor_light);
  Blynk.virtualWrite(3, value_light);    //V3

  value_water = analogRead(sensor_water);
  Blynk.virtualWrite(4, value_water);    //V4
  if (value_water < 300) {
  Blynk.email("pavol.kukla@gmail.com", "ALARM", "Plant Thirsty");   //enter your email address
   for(int i=0;i<2;i++){
  strip.setPixelColor(0, 0, 0, 250);  //turn LEDs blue
  strip.setPixelColor(1, 0, 0, 250);  
  strip.show();
   }
  }else{
   for(int i=0;i<2;i++){
  strip.setPixelColor(0, 0, 250, 0);  //turn LEDs green
  strip.setPixelColor(1, 0, 250, 0);  
  strip.show();
    }        
  }
}
 

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

I fixed your code formatting, as requested in the instructions you deleted in order to post this :wink:

We help you learn Blynk here, not troubleshoot or “fix” your code. :stuck_out_tongue:

Deep Sleep is not a Blynk related process… You can search this forum for some info, as others have used it with Blynk, but you might be better to also search the internet for ESP deepsleep related options.

Yeah i checked it but i dont know how to use it

More than 50 different threads on this forum when you search for “deep sleep”, many with code examples and detailed info on how to use deep sleep mode:

https://community.blynk.cc/search?q=deep%20sleep

You’ve spend 26 minutes reading since you joined the forum. Spend a few hours reading some of these threads then come back with more specific questions and you’ll get much more help from the other forum members.

Pete.