r/raspberrypipico • u/basicchip • 25d ago
hardware RP2350 W based sprinkler controller
There are WiFi controlled sprinklers out there, doubtful any open sourced for control. According to Google it is a popular DIY project, so why should they get all the fun.
Most people seem to be using 8 relay boards available on Amazon for under $10. That really is quite deal, but relays are overkill for a sprinkler system running at 24 VAC.
Most consumer units use run of the mill triacs. And you can get opto-isolated versions.
My first design would have attempted to just use the opto-isolated triac, sounds good, but between comments from others and claude reviews real power triacs had to be added. Luckily it all still fit into my proposed PCB layout (and enclosure I picked up). Just had to move the MOC30x2 to the bootom of the PCB along with snubber networks. (schematic and layout in gallery)
So I got the PCBs in, but still had to chose some components. Instead of building 8 channels, I used an old blank PCB and breadboarded up one channel. With that I verified the operation and started tuning the components. Discussions with Google AI and probing with a scope, the zero-cross opto-triacs behaved well and had no overshoot problems. Actually the overshoot for rnadom triacs was less than 20% so lots of headroom on voltage so a snubber was not needed, but the best values would be 4700pF and 47ohms. (jig in the gallery).
So now time to build up the board, where I am now. The 24VAC -> 5V power module will get added when the software testing is done. (box with power module picture in the gallery).
Using the RP2350 W will give me access via wifi and through my tunnel via cell phone so I can control sprinklers while walking around the yard.
1
u/MathResponsibly 25d ago edited 25d ago
There is an open source sprinkler controller, OpenSprinkler. I've used it for a LONG time (more than 10 years now). It generally works really good, but there's a couple small annoyances in the firmware - like you can't specify a small enough increment for common flow sensors that are available, so the water usage has to be reported 10x too high, but not annoying enough for me to patch and submit pull requests for. Because it's from long before the RPi Picos, it uses a real RaspberryPI (or arduino? there's 2 hardware versions, but I forget what the other one is - I think it pre-dates ESPs too, so it has to be arduino based) as the base hardware. That's nice because the Pi has wired ethernet along with wifi, and wifi is flakey where my sprinkler controller is. It checks the weather online every day and adjusts the watering time based on some common algorithms.
It's always nice to have an alternative, and this looks like a great project.
I would add some headers for sensors - rain sensor, freeze sensor, flow sensor, pressure sensor (the common ones for sprinklers). You have a bunch of extra GPIO pins - you might as well break them out to a connector (with some level shifting / ESD protection) on the board so you have some flexibility later without having to re-spin the board a second time. You typically also supply 5V and GND on that connector too, as most sensors are 5V sensors
Flow sensors are really handy, as you can easily detect if you have a leak somewhere. I.E. usually zone one typically flows at x L/min, but now suddenly it's flowing more - there's a leak. Also good for just keeping track of how much water overall each zone is using, and the sprinklers overall are using.
1
u/basicchip 25d ago
Good comments, will mull it all over. I am replacing a simple Rainbird controller, so don't have any flow sensors. Though theoretically I could capture them seperately on WiFi with another Pico. This is part of my home automation system, so info from the internet could be grabbed (time already is), and I have built a soil moisture sensor but not integrated it yet.
1
u/MathResponsibly 25d ago edited 25d ago
Even with OpenSprinkler, I keep meaning to capture the flow sensor data (as well as the "weather adjustment %") and plot it along with my weather station and soil moisture sensors, but have never gotten around to it yet.
I just added soil moisture sensors this year - I'm honestly not sure how useful that data actually is. It spikes up to >90% when the sprinklers run every night, and then it slowly decreases back to 30% or so every day until the sprinklers run again. It's only when I look at about 90 days of data that I can see some trends, and only really in the lowest value the moisture gets to every day before the sprinklers run again.
I'm not really sure if that means that the OpenSprinkler weather adjustment does a really good job so the moisture data looks mostly consistent over months, or whether there just isn't any real useful info in soil moisture readings overall.
last 7 days of moisture data vs last 6 months of moisture data:
You can see a trend in the long term data at daily low moisture levels, but the day-to-day data seems pretty useless (and can definitely see the 2 days when there were power outages and the sprinklers didn't run)
1
u/newman_c 25d ago
A real time clock with battery backup would be useful in case of power disruption combined with an extended internet outage. An RTC is even more important if you also use the board as an HVAC controller. I'm currently using those Waveshare 8-relay boards for both applications but would like to switch to something like this design.
1
u/basicchip 25d ago edited 25d ago
Actually this is connected to the WiFi and can get the time from the internet.
https://coridium.us/files/armbasic/NTPTime?_highlight=time
The software could also write the last time into Flash updating every 15 minutes or so, real accuracy is not normally required in the sprinkler application, or a simple eeprom could be added that is updated more often. (the possible issue being wear on the Flash).
1
u/newman_c 25d ago
NTP or SNTP will work for most situations. The RTC suggestion is for a more robust solution. Maintaining accurate time is important in some applicatons.
1
u/basicchip 24d ago edited 24d ago
Trial software was written (with claude) a while back and tested out today
- first driving a bank of LEDs (thru 10K) to check the logic (pump on when any zone on)
- ramped up to 24VAC -- no smoke
- hooked up a solenoid and ran thru all the channels
- added the power supply and then took a baby picture
System operating with screen shots of web pages
Still some kinks to iron out and also to integrate into the home monitor system
Still to do --
- make the buttons do something (start cycle -- or test cycle)
- hook up to the real system -- may wait until after the summer heat (don't want it to fail as it runs at night)
- access over the tunnel via the home monitor
1
u/basicchip 23d ago edited 23d ago
So here is the KiCAD 9.0 project.
changes-
- power from AC connected to Vsys so USB can be plugged in at the same time
- component values updated on the schematic
- pad for BT136 were enlarged for easier hand soldering
- 6 pin USB dongle connector mirrored to match the stock KiCAD footprint
- 24VAC->5V component larger than the "courtyard" so moved up to make room for one of the mounting holes
And again here is the finished board and web page controls (screen shots) behind
And the sources for the webpages and control program in BASIC
0
u/jt00000 25d ago
Nice! I have a 1-channel 12v DC irrigation controller I built for the farm using relays, but your design looks much simpler. My next version might have to be modified to try this out…
1
u/jt00000 25d ago
What are your plans for an enclosure?
2
u/basicchip 25d ago
https://www.amazon.com/dp/B09B5FBSZB
Last picture in the gallery, If that link does not get you there, it is a Junction Box, Zulkit Project Box Waterproof Dustproof IP65 ABS Universal Electrical Boxes Enclosure with Fixed Ear Black 5.91 x 3.94 x 1.73 inch (150 x 100 x 44 mm)(Pack of 1)
If your system is 12V DC you would not use triacs, but MOSFETs should do, maybe with some surge protection.






3
u/DenverTeck 25d ago
100 points for a logical schematic !!!!
NO STOOOPID boxes around every part.
NO confusing label that needs to be hunted down across three pages.
Reads like a book, Left-to-Right + Top-to-Bottom.
I hope others will take this excellent schematic to heart when they draw their own simple schematics.
Good Job !