ESP32 Automated Sprinklersystem Project - Page 1
Forum section: electronics / general

author: jcrubin
author_rank: Frequent Contributor
timestamp: April 24, 2021, 12:46:18 pm
content: After receiving a water bill for over $400 due to an under ground pipe rupture, I became motivated to re-design my outside irrigation system to ensure that such an incident would never again occur. A simple evaluation of the existing system quickly revealed the shortcomings of the design. It was an accident waiting to happen. I can't rely on city environmental services to monitor stuff like this, even though its their job. We can do better.An overall plan is designed for the replacement of the existing system with a new automated system controlled by an esp32 incorporating both an electric ball valve as well as a water meter. The basic plan is discussed. The project however will need to be broken into smaller projects as separate libraries will need to be made for the valve and meter.An electrical design is made for functionality of the valve as well as signaling for the ESP32 so that software can be written around it. A DPDT relay is employed, wired as a flip-flop for this unit. With this a quick program is assembled just to check functionality of the relay and then power supply through the relay. With this working, the valve is then tested.The library was built around the valve with features I felt would be beneficial toward the functionality if the valve. It has already been published to Arduino and PlatformIO library manager. Simply search for Ballvalve in the library manager of the respective IDE and install. Instructions are contained in the example code.Next Step will be development for the water meter.

author: jcrubin
author_rank: Frequent Contributor
timestamp: April 24, 2021, 12:47:22 pm
content: Were back in part two of the series continuing with the creation of a library that further supports hardware for the project and publishing it. This time it will be the water meter which uses a combination reed switch and magnet to generate a pulse for measurement.Understanding how this works means that I don't actually need the meter but can produce my own meter emulator to make this project easier. In its simplest form, a contact with two wires should get me out the gates.I start off with my usual library creation with a getVersion, but in addition to it, an interrupt that checks to see if the switch was closed and notifies accordingly. Dirty but effective for testing. With this working I can expand upon the arguments with more parameters to provide more context as to what it means when the switch closes as well as some functions that provide some basic readouts.Now with a readout of both gallons and liters, touching the wires shows the increment as specified in the object creation. This number is stored in memory but now we need the final feature and that s the ability to store the information to a file. For this spiffs will be employed.With spifffs a new function to initialize the file system is created, this is complimented with services to update that file for each event to align the mechanical value on the meter with that in the file itself. Final testing of this is done by pulling power.To test this all out a small project board is used with a DC motor and a few batteries along with a POT to generate this signal on a reed switch with a magnet to emulate the meter for software testing.

author: jcrubin
author_rank: Frequent Contributor
timestamp: April 24, 2021, 12:48:14 pm
content: We now arrive at the third chapter in the series. The first two were dedicated to the development of libraries for hardware needed for the project. With libraries completed for the water meter and the valve we can continue designing the architecture that ties everything together while incoperating the quad relay module into our to be developed sprinklersystem library a small support application will be written along with this activity. It stands to reason our sprinklersystem library and overarching project will depend upon the two libraries created in chapter one and two, they will be included in the library for sprinklersystem and compiled in.As there is no vectoring in esp32 an array will be created to store zone objects called storedzones, allowing for easy manipulation addition and removal of zones form the sprinklersystem object. the array can handle 30 zones which is way overkill but acceptable. Each zone has attributes that I mad add remove or change later in development, but this will get us off the ground. Attributes from the valve and meter are already defined and probably wont change much.Within the sprinklersystem class, the overarching object is the class Zone and its attributes, as well as the zone array itself with associated helper functions, open close remove, and whatnot. The is no function to add sprinklersystem the app were creating does that. The addzone function provides an opportunity to allow for any required validation of supplied parameters as demonstrated.The main program provided is simply a demonstration to create an object and demonstrate all of the functionality thus far. This includes bad data to demonstrate errors.

author: bingo600
author_rank: Super Contributor
timestamp: April 25, 2021, 06:08:15 am
content: While i think this might be an interesting project , if not for other then for the water waste detection.I'm much more of a"Webpage"guy than youtube guy.I have always lost interest fast in youtube videos describing a project,.I like "letters" for tech documentation , and being able to set my own read pace.But thank you for sharing/Bingo

author: ptricks
author_rank: Frequent Contributor
timestamp: April 30, 2021, 12:41:37 pm
content: You may want to add a normally open water valve on the main water input to the sprinkler system. I did a project similar to this and came home to find a small pond in the yard because a relay stuck in the ON position. Decided to use a NO valve connected to a separate controller that works as a watchdog for the system. If it doesn't receive regular OK input from the main controller it turns off all water to the system until reset. It should catch any issues with relays, sprinkler valves or controller issues.

author: jcrubin
author_rank: Frequent Contributor
timestamp: May 17, 2021, 12:07:22 pm
content: If by valve on the main at that point im assuming you mean a solenoid as a fail fase mechanism that drops down and throws an alarm.

author: sokoloff
author_rank: Super Contributor
timestamp: July 02, 2021, 01:49:16 am
content: Industry common (I won't go so far as to say "standard") practice is to have an additional normally-not-flowing valve to serve as a "master valve" for the entire system.More discussion here:https://www.irrigationtutorials.com/faq/master-valve.htmI elected to not install a master valve on my irrigation system to avoid the additional stretching cycles on the main line (multiple per day rather than approximately 2 per year).

author: jcrubin
author_rank: Frequent Contributor
timestamp: January 07, 2022, 11:09:30 pm
content: Today the project moves in a different direction as we hammer out a good share of the hardware work on the project. No code today... I have been planning this, and amassed some parts already for this project; collecting more as we move along.This begins with the outdoor rated liquitite case and materials used to make the inner cover and mounting. With the base fabrications completed, the first of the pieces are assembled onto the base. These pieces on the bottom layer are AC power, and AC/DC regulation. This along with the relay for the valve are put in place, the ESP32 breakout module sits on a level over the AC/DC Power. Another layer off to the left of the ESP32 board will be more standoffs for a layer in support of the solenoids relay board.Multi pin plugs will be installed on the bottom of the box in support of the valve and water meter. Room exists for another connector. A small antenna was installed for the ESP32 wifi. The board for the solenoids also has room to support a factory default button through the front cover.Careful measurements were taken to cut out the size needed for a 20x4 LCD screen, any mistakes means redoing the front cover. Plastic standoffs were used and cot off from the front to make a mount for the screen. I've also added an encode/button combo as this will add input value at the box.AC voltage has been routed to the Relays as well as the addition of a 2A breaker to the project. 30v AC lamps have been added to the relays as a good test indicator for development. The water meter emulator and the valve have been added to the connectors on the bottom.All components currently connected are added and checked and working which brings this chapter to an end.

author: jcrubin
author_rank: Frequent Contributor
timestamp: September 24, 2022, 02:17:42 am
content: Now in Part 5 we take a moment to demonstrate the functionality of the systems it currently exists with all current hardware and software installed. The system is first factory defaulted to start the demonstration from the very beginning. A good portion of the UI has been written though not completed. Also the rain sensor is not yet added to the project. A GPIO limitation will cause some changes in the next chapter.

author: rooppoorali
author_rank: Regular Contributor
timestamp: September 24, 2022, 03:24:16 pm
content: Thanks for sharing the video series.

author: jcrubin
author_rank: Frequent Contributor
timestamp: September 30, 2022, 03:07:59 am
content: I'm running out of IO ports the project may eventually be finished!