Tank Farm is a water management system that uses a Raspberry Pi 2 B to perform irrigation, water storage and well management. The Pi is running Windows 10 core with C# code. Associated interface hardware along with the Pi are mounted in a weather proof case. The current prototype supports 4 water valves, 4 input sensors, 4 switch/control memory relays, triple voltage power supply, numeric keypad input, lighted push button switches, text to speech, touch panel display and voice recognition.
The Pi currently supports 12 digital IO pins. I wanted to evaluate whether a stock pi (no shields or expansion) could provide a full featured system. In order to stay within the 12 digital IO line constraint a 4 valve system was chosen. The pins are configured in 3 groups:
- 4 pins - Output for device toggle
- 4 pins - Input for device status
- 4 pins - Input for sensor status
TankFarm Windows 10 core operating system runs autonomous operations independent of other CPU's. Autonomous operations include:
- valve-pump dependencies
- overflow shutoff protection
- dry well pump shutoff protection
- sensor device triggers
- on delay timers
- max duration timers
- timed event triggers
- alerts and announcements
- speech recognition engine
System will function in full autonomous mode with or without screen interface. Adding a touch screen at one of the main control stations allows for configuration of the entire controller network. Code originally written for C# Windows Forms apps has been converted to the more mobile and micro controller friendly Universal Windows Application interface.
UWA XAML interface when using optional display
Tank Farm software uses time of day, duration and rain conditions in order to activate irrigation zones. Rain collection storage tank and well levels are monitored to prevent low well conditions causing pump damage and ensuring storage tank is always full. Irrigation zones receive water from well pressure or from tank gravity drain (fields at lower elevation)
All system parameters are set using xml configuration files loaded at startup. Heuristics for for all functions including; pin mappings, delay parameters, timers, defaults and calibrations can be set for each pin, function or device without re-compiling.
Microsoft's support for IoT platform continues to advance. Once reserved for full systems, speech recognition now works from micro controllers such as the Raspberry Pi2. A few gotcha's to overcome. The Raspberry Pi's audio connector only supports audio out. A USB based microphone must be used in order to hear commands. Not all USB mics work. Some will bog down CPU and cause system restarts. Simple embedded USB mics work ok (not much distance or sensitivity). MIC's from USB camera's work best but may cause power issues with the Pi's USB bus. The UWA speech recognition engine is very accurate and fast. In the following field test video, commands were 100% reliable up to 20ft.Connections
The Pi's 40 pin header is connected to daughter board for minor signal conditioning including 4 x 1k resistor pull ups for sensor inputs and 4 x 12v to 3v level converters for remote switches. Connection to devices is provided via screw terminals conveniently placed along one side of the daughter board (connector strip). The connector strip supports connections for power supply input, relay triggers, relay status, remote switch input, panel push button switch, panel lamps, supply voltages and input sensors.
Valve connection schematic
The irrigation controller framework was designed so that all capabilities of the Pi can be integrated into the field test unit as they become ready and stable. In order to run a live system still under development, two Pi's are used. One in the field and one on the test bench. Updates and additions can be tested on bench unit while software is running in simulation mode. This allows testing of operational logic without Pi being physically connected to the panel. Once a build has been tested, it can be pushed to the field unit. Simulation mode logic is fairly simple. All calls to the GPIO pass through a single function that can be set to convert requests and control to simulated pin logic data. In this mode, input output behaviors can be tested without concern for creating additional simulation code.
The physical size of the main panel is large enough so that expansion, updates and general maintenance can be performed safely and reliably. Sub panels with specific functionality will be considerably smaller and less complicated.
- Zone control switches and valves operate in manual mode in the event of micro controller issue
- Remote switches located at garden areas allow remote activation
- Accurate speech recognition control up to 20 feet
- Speech to text feedback
- Adaptable to 120vac, 24vac, 12vdc and 5vdc devices
- Max 240v, 16amp relay contacts
- Low well condition automatically shuts down pumps and waits for ready state
- Rain and wet conditions automatically cancel timed irrigation events
- Runs with or without display monitor
- Integrated touch screen dispaly
- System events and sensor data log to data file
- System attributes, control settings and pin mappings saved in XML config files
- Multiple control panels can be meshed into one control network
Future additions include:
- 8 x valve/pump controls
- Email/text/sms alert status
- Integrated touch panel display - Competed
- Voice recognition - Completed
- Temp/humidity/moisture conditions
- Full featured WEB service
- Solar powered remote stations
- Station intercom, music and announcement network