Raspi Driven Irrigation Controller

From NebarnixWiki
Jump to: navigation, search

Problem Statement

Irrigation controllers are expensive and for some reason they all have counter-intuitive interfaces and are overly complicated in ways I never need and never complicated enough in ways I always need. I have a simple drip line that goes from a single 8 port manifold to the various parts of my yard and needs about 45 minutes worth of watering every day in the summer. It would be neat to be able to monitor the process and have a scheduler that was internet or at least network accessible.

System Overview

A quick browse of amazon yielded a very cheap 12V and prime eligible solenoid valve for $9.55. More problems... the valve uses 1/4" fittings which don't match my garden hose or my 1/2" manifold and probably needlessly restricts flow. But parts can be made and drip systems can run for ages! Perfect!

ABS fittings were designed and 3D printed to convert garden hose thread to 1/4" NPT and 1/4" NPT back to 1/2" NPT. These parts work well, which surprised me because I've never tried to print threads this fine before.

A circuit was designed to pulse the solenoid and move the valve diaphragm to the on state, then relax to a somewhere comfortably above the holding current but nowhere near the opening current.

Finally, a Raspberry Pi was interfaced with the circuit which runs a python script through the cron scheduler daemon and provides web access to the logfiles and watering schedule.

Valve and Fittings

The Amazon procured valve uses 1/4" NPT fittings on both sides. This is problematic because I don't have 1/4" hardware anywhere else in the system. Fittings were designed in CAD then printed from ABS and uploaded to thingiverse for posterity.

Let's print stuff!!

1/4" NPT to 1/2" NPT

Garden Hose Thread to 1/4" NPT

Valve Driver

If run at the full rated current if ~1.4A, the valve gets really really hot. The purpose of the driver is to provide an opening pulse of 1.2A for approximately 0.5 seconds in duration to the valve in order to actuate, then to drop to a more reasonable current level of around 190mA for the rest of the cycle. The tested values are 800mA for actuation and 100mA for drop-out, so we have nice margin on either side to assure functionality. The circuit was simulated in LTSpice first, and operates as simulated. The 3.3V power rail IS the GPIO from the raspi, so the circuit is effectively disarmed when the IO pin is low.

The red line is the control voltage (U1 + pin), which actually attempts to push the valve up to 2.7A (but can't due to the power supply only being 12V).

The green line is the simulated valve (R11) current.

The blue line is the R1/C1 RC circuit charging up and leveling off once Q1 is tripped.

IrrigationDriverSchematic.png IrrigationDriverSim.png

PCB Design

Irrigation controller PCB.png Irrigation controller PCB mask.png

Raspi Scripts

Results

Good:

  • The system works well overall and waters my plants!
  • The valve opens nicely but doesn't even get warm to the touch as the holding current is well below the rated current
  • Standard cheap $13 home depot valves rated for 24V also seem to work just fine with the same circuit!
  • The Raspi provides insight into watering so that I don't return home to dead plants after traveling.

Bad:

  • The ABS fittings are of unknown durability, especially in the AZ sunlight. Burst main side fittings could make for embarrassing waterworks in the front yard....
  • The main transistor reaches temperatures around 80-90 degrees C after several minutes. A larger heatsink should be employed but it is rated to 150C so it can wait.
  • Parts can fail because there is no feedback on water flowrates or soil moistures. Adding these sensors into the mix would be a good idea.