vinitshahdeo / Water-Monitoring-System

Water Monitoring System is an IOT based Liquid Level Monitoring system that has mechanisms to keep the user alerted in case of liquid overflow or when tank depletes.
https://vinitshahdeo.github.io/Water-Monitoring-System/
MIT License
149 stars 263 forks source link

Optimized Deep Sleep Technique for AVR Hardware using Timer Wakeup #76

Open animeshsrivastava24 opened 4 years ago

animeshsrivastava24 commented 4 years ago

The optimum method to operate a device in real-time is based on Energy-Optimized Usage. The deep sleep technique is an available option for this purpose. For this Issue please can someone share views on the Timer method? Details: https://microchipdeveloper.com/8avr:avrsleep

animeshsrivastava24 commented 4 years ago

Hello @ramanaditya Can you please review this code:

/*
To use the timer wake up with ESP8266, we need to connect the RST pin to GPIO 16 which is labeled as D0, in a NodeMCU board
Code to be uploaded to ESP866
 */

void setup() {
  Serial.begin(115200);
  Serial.setTimeout(2000);

  // Wait for serial to initialize.
  while(!Serial) { }

  // Deep sleep mode for 30 seconds, the ESP8266 wakes up by itself when GPIO 16 (D0 in NodeMCU board) is connected to the RESET pin, the time can be changed as required
  Serial.println("I'm awake, but I'm going into deep sleep mode for 30 seconds");
  ESP.deepSleep(30e6); //30e6 corresponds to 30000000 microseconds which is equal to 30 seconds.

  // Deep sleep mode until RESET pin is connected to a LOW signal
  //Serial.println("I'm awake, but I'm going into deep sleep mode until RESET pin is connected to a LOW signal");

}

void loop() {
}
ramanaditya commented 4 years ago

https://github.com/vinitshahdeo/Water-Monitoring-System/issues/76#issuecomment-593240816 @animeshsrivastava24 , this depends on the theoretical calculations based on the practical information which you obtain from the microcontroller.

For the larger tank, the deep sleep time will be higher than smaller tanks and also it depends upon the inlet speed of water. These two factors will mostly affect the deep sleep.

For the size of tank, during registration of micro controller over our server, we will provide the details of size of tank and if required manually we need to find out the time for filling up the tank and using that time and volume, we can calculate the deep sleep time.

Initially I won't recommend using deep sleep. Since ultrasonic sensor doesn't consume much power, battery will easily last upto 2 months.

Can you perform some theoretical calculation of how much power it can consume? As far as I know ultrasonic sensors are quite low powered sensors.

animeshsrivastava24 commented 4 years ago

Hello @ramanaditya Sure I agree with this. I'll perform the calculation and revert back it to you.

animeshsrivastava24 commented 4 years ago

@ramanaditya Will it be possible to send documentation based PR that contain research work and description?

ramanaditya commented 4 years ago

@animeshsrivastava24 , I am not sure about this as this might get into copyright issues, cc: @vinitshahdeo please look into this

vinitshahdeo commented 4 years ago

@animeshsrivastava24 If you're sending the PR for literature survey:

animeshsrivastava24 commented 4 years ago

Hello, @vinitshahdeo @ramanaditya I'll keep in focus the necessary citations while doing the survey. Also, please can you guide me to Hardware related Issues for solving on which non-first timers can contribute.

animeshsrivastava24 commented 4 years ago

Hello @vinitshahdeo @ramanaditya here is the documentation on Ultrasonic Sensor Power Consumption and minimization. Should I send a PR, please review

Ultrasonic Power Consumption Research.pdf