Close

Zones?

A project log for Off-Grid Garden Watering System

Solar powered watering system controlled with a Raspberry Pi to deliver an exact metered water volume to your garden plot, on schedule

scott-feldmanScott Feldman 09/03/2022 at 18:360 Comments

The Raspberry Pi relay hat I used for this project has four relays, each tied to a GPIO pin.  I'm only using one relay to control a single ball valve.  The project could be extended with zones, each zone on a relay, for up to four zones.  Each zone would have its own schedule.  We'd also need to have a flow meter for each zone, so we need to use additional GPIO pins for each flow meter.

Design changes:

 into this structure:

type zone struct {
    StartTime   string
    StartDays   [7]bool
    Gallons     float64
    GallonsGoal uint
    Running     bool
}

type garden struct {
    // omitted fields
    Zones [4]zone
}

There would be other modifications to pass the zone number (0-3 for zero-based math) in the JSON messages that are passed around.  For example, the start time message would go from:

type msgStartTime struct {
    Msg   string
    Time  string
}

 to

type msgStartTime struct {
    Msg   string
    Zone  int
    Time  string
}

Discussions