Water Tank Level Indicator with Low Level Warning Notifications

Great idea GG07 to put a wind turbine on the system!

I look forward seeing your DeepSleep code!

Thank you!

Ok so basically my deep sleep project was to run a temperature, humidity sensor and also had a voltage divider chip in amongst all to monitor power consumption etc. Do your research because you need to connect two pins on the esp8266 MCU to enable to chip to exit deep sleep at your defined interval.

I also had a button widget on screen and when pressed would prevent the MCU from going into deep sleep mode in the case I need to update the code via OTA (very simple ‘if’ statement.) My MCU would awake every 15min send temp data etc then go back to deep sleep after 30sec. The following is an extract from my project to hopefully get you on track.

        int sleeping;

        BLYNK_WRITE(V0){sleeping = (param.asInt());}

            void sleepMode(){
              if (sleeping == 1) {
                 ESP.deepSleep(900e6); //15 min  sleep
                }
            }


                void setup(){
                   Serial.begin(115200);
                   Blynk.begin(auth, ssid, pass);

                    timer.setTimeout(30000, [](){
                       timer.setInterval(2000L, sleepMode);
                       });
                   }

With regards to the ultrasonic sensor, perhaps if you had it connected to a relay (NO) then when your MCU wakes up activates the relay to turn the ultrasonic on obtain some readings, send the data before turning off and going back to sleep.

1 Like

HI @PeteKnight, It still doesn’t look like I can edit initial post. I can edit title but that looks like it. Any ideas?

Are you clicking the three dots at the bottom of the first post to show the pencil icon?
If that’s not available then PM me the updated version and I’ll drop it in.

Pete.

Hi @GG07 , do you find this approach works? I have adapted this idea. It works fine to stop the sleep but for some reason the device doesn’t show up on my OTA ports. (Yes I have tried Bonjour browser) :grinning: Most of my deep sleep code is in the setup but I do have the following 3 lines in the loop so I would think it should work.

void loop()
{
  Blynk.run(); // Initiates Blynk
  timer.run();
  ArduinoOTA.handle(); 
}

Personally, I don’t like using timers with deep sleep, it’s quite inefficient.
When the code runs in a wake/sleep cycle, there’s no point in using a timer to call a function once. Timers are best used to call the same code on a regular basis, but with deep sleep you just need to call you code once.

In @GG07’s example code, the deep sleep call was at the end of the void setup, so unless you’ve moved this then the ArduinoOTA.handle() command will never be reached.

I also don’t like Blynk.begin with deep sleep, because it’s a blocking function and if a connection to either Wi-Fi or the Blynk server can’t be established the code will never progress to the deep sleep command so the device will be constantly awake and drain the battery.

I did quite a bit of work with @christophebl on getting a consistent deep sleep setup with Blynk for this project:

The code was originally written for NodeMCU, but this example cas been switched over to an ESP32.
The code doesn’t include OTA, but it would be simple to add a flag triggered via a virtual pin and if that was set the the Deep_Sleep_Now() function wouldn’t be called.

Pete.

Hi @PeteKnight & @daveblynk, I’ve tested the way I have my deep sleep coded with the added feature of the keep awake button widget and yes it does work. It does disappear from my OTA listed devices when asleep and re-appears in the OTA listed devices when I keep it awake (I do have to close aduino IDE and re-open it to see it listed).

I think most of my OTA troubles are the second last version issues. Testing 2.7 IDE.

@daveblynk if you’re still having OTA issues you might want to read this:

Pete.

I’ll take look at it but with 2.7.1 and the downloaded IDE it’s working. The IDE from the App Store was the problem. Right now it is working.

1 Like

Could this be used for a tank of water that holds only around 16oz?

Probably not, the ultrasonic sensors are fairly large so physically it might be a challenge to get useable readings.

Pete.

hi mr. pete …
please give me a schematic of the circuit

Is this not enough…?

Pete.


how about this, I can’t compiling

Looks like its time to sort-out that mess of wires behind your monitor :grinning:

As far as the error message is concerned, the code in Post #1 of this topic compiles fine for me, so I assume that you have a problem with the way that your Blynk library is installed, or you have an old version (older than 0.6.1) of the Blynk library installed.

BTW, Ctrl-Alt-PrtScn is a better way of copying the active window so that it can be pasted into your post, rather than taking a photo of the screen (and the wiring behind).

Pete.

thank you sir, I have successfully uploaded this coding. one more, how do you make this blynk? I have trouble making it, I beg you to teach me to make this blynk ,? Thank you, Mr. Pete

I don’t understand the question.

Pete.

I can’t make blynk, please tell me the tutorial

I have absolutely no idea what it is that you are asking me to help you with.
Explain what the issue is, in words other than “I can’t make blynk”, and I’ll try to point you in the right direction.

Pete.