I need some guidance on how to code an arduino pro mini to water my living room plants. I want to make something similar to other projects I have seen online, yet I can't manage to do a failsafe check for not watering again during the next 2-3 days (a certain period of time defined in hours or days). I have a ds3231 rtc, soil moisture sensors and water level sensors to measure run-off (another fail-safe). As an extra fail-safe the arduino and pump will be run on an UPS.
Basicaly, before a watering happens the arduino needs to check:
--that no watering happened less than x days/hours ago. (This is what i need help with)
--there's no water in the saucer of the pot
--soil moisture is under threshold
Can't figure it out, so any ideea on how to do it will help.
Why do you need to know if watering has happened x days ago.
Surely, if the soil moisture sensor is showing inadequate moisture, then you need to water.
Because i plan to group multiple plants on same pump, water when the first one dries up, but not overwater. Also, if a soil moisture meter gets out of the soil the reading will be 0 moisture and plants will get watered till the tank is empty. And i got pretty expensive flooring.. That is why i need it to be failsafe.
I had to edit first post a bit cause i realised i was't clear enaugh with the "checks before watering". Thank you for helping me see that.
You still need a failsafe system , regardless of when the last watering happened.
What happens if the Arduino crashes whilst the water pump is running.
Do the ouputs remain high in case of a crash? If that’s the case yes, i need help with that too.
After thinking more about this set-up I figured i need to store the past watering schedule. This way i can keep logs and also make sure it won’t water more than once every 3 days even if arduino resets.
Still haven’t figured out how to time the 3 days interval in arduino code, but i remembered that a fellow forum member told me that my rtc can output date as second passed since 1970 or something like this (may be millis and not seconds, can’t remember.) But i would need help on how to access that data. I have not managed to learn more than basic time commands so far.
As far as the failsafe “watchdog” that mauried pointed out, I’m thinking I need another master arduino to keep an eye on the arduinos that do the actual watering of the plants. Is this a good path to take? Any suggestions?
Big thanks to all the users that helped me so far.
Still haven't figured out how to time the 3 days interval in arduino code, but i remembered that a fellow forum member told me that my rtc can output date as second passed since 1970 or something like this (may be millis and not seconds, can't remember.) But i would need help on how to access that data. I have not managed to learn more than basic time commands so far.
I read more on it and I realised I'm referring to the time_t, now() function, yet this doesn't work with the ds3231 rtc i have connected via I2C. Is there a reason for this to not work on I2C or maybe I don't use the function correctly? Can anyone provide an example on hou to use the now(); command to get valid data?
Maybe you aren't interested, or maybe you don't know, but you can water plants without the need of any electricity. Google "Tropf Blumat".
I'm using this ingenious thing since a few years and it's working perfectly
I do know about blumats, but they are not enaugh for my needs. And it's more fun and cheaper in the long run to use electricity. Another advantage of using arduino is that it can provide logs and respond to both human and sensors input. Also, I don't want to change plant watering and feeding regime to suit the method of watering I use. It needs to be the other way round.
Thank you very much for your input tho, I do see how your reply could have been a godsend if my needs were different.