BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Smart Irrigation System

Hello there. I water the plants at different times using the timer. While doing this, I use solar panels. I want it to sleep unless it approaches these watering times to save more battery. Is there a way to transfer the clock in the timer function to the code?

If there is a way how can I put this into code. For example, 1 minute is left for watering, don’t sleep for 10 minutes anymore.

If you’re using an ESP8266 then when it’s sleeping it can’t keep track of the time - because its sleeping.

The solution is for it to wake-up every so often and check if it should have started a watering cycle yet. Obviously the longer the device sleeps between waking-up and checking if it should be doing the watering,the less accurate the start times, and therefore the watering duration, will be. This assumes that the watering stop time is controlled by the app.
Also, while the device is sleeping it will show as being offline in the app.

If your device slept for 5 minutes before waking-up and checking-in with the Blynk server then it could be up to 5 minutes after the watering start time that the watering actually begins - but, if it happens to wake-up a few seconds after the start of the watering cycle then there will be almost no delay.
It’s a compromise between start-time accuracy and battery saving.

Also, when you’re doing Deep Sleep it’s not a good idea to use Blynk.begin as this is a blocking function. If the device cant connect to WiFi or Blynk then the code won’t progress any further and it will never sleep. Blynk.config and Blynk.connect are a better option.

Pete.

Thank you for the quick reply.

I may be asking wrong questions because I am not a software developer. Sorry if you come across such a question. :slight_smile:

Yes I use esp8266. The device is currently only looking at the battery status. I use timers for savings. I don’t send data to the blynk server very often. If the battery drops below a certain level, esp goes into sleep mode. He wakes up every 5 minutes to see if the battery condition has improved. Once charged, it can work for 26 hours. But things will change when the season is winter.

I try to extend this period much more with the help of sleep mode by getting information from the openweathermap site whether the weather is rainy and looking at the remaining time to water.

When I look at the advanced time setting, I can transfer irrigation start and end time information, and even more, to the device once I connect to the blynk server.

Link

For example (I haven’t checked how long esp8266 can sleep) wakes up every 5 minutes and looks at the remaining time. The advanced time setting tells us the start time and the end time. But I have no idea what kind of condition I can write with it. :slight_smile: How nice it would be if we could talk to the devices with a normal sentence as below :slight_smile:

Turn off sleep mode if there are 5 minutes to start time. If it is 5 minutes after the end time, sleep again … Good boy … Good boy …

Baris

You can have a look at

1 Like

The start time and end times of the Time Input Widget are in seconds since midnight.
If yo use the RTC widget, and sync it with the Blynk server after wake-up (which may happen automatically, I can’t remember) then you’ll know the current number of seconds since midnight. This allows you to know if the timer should be on already (its past the start time and before the end time) or if the start time is imminent (start time minus current time is less than 300 [which is 5 minutes in seconds]).

That’s how I talk to my devices, but they just ignore me - I think they are either cats or females (or both) :grinning:

Pete.

1 Like

Thanks @khoih. There is a lot of information in the sharing that can guide me.

Haha :slight_smile:
Thank you for your help and suggestions. I will continue reading and researching. There may be some questions that are asked a little early. But they will save me a lot of time.