From RAWiki
Jump to: navigation, search

As of August 2016

The well water management system is designed to provide inexpensive monitoring of domestic and livestock water level in storage tanks and automatic control of the well pump to maintain water levels.

The Original System


Our well system is a little unusual, however the farmers who built the system did it this way to provide a few distinct advantages over traditional systems.

Instead of a typical on-demand pump feeding a pressure tank, in this system the well pump feeds a central pipeline that serves as both the feed line to fill the tanks and the supply line, based on gravity, from the tanks to the rest of the farm. The system allows continuous gravity-based water supply to the whole farm (including pressured sections if filters are removed) despite temporary power cuts and can be adapted with the addition of solar water pumping to provide a continuous off-grid water supply.

The Problem

The well control has no way of knowing when the water tanks are full to shut off. The tanks, located on the highest point of the property, are very far from a power source and it's not practical to run a control wire all the way there to monitor water level as wth a float switch.

Additionally, the pump control is not located anywhere near an unpressurized water one where a sensor could be installed to read water pressure and calculate when the tanks are full.

The Solution

It is built using a pair of Particle Photon chipsets which communicate with each other via the farms wifi network, one that measures water pressure to determine how much water the tanks contain, the other one turns the pump on when water gets low and off when tanks get full.

Photon Water Pressure Sensor Diagram.png

This sensor was used with the following specs:

  • Input: 0-15 psi.
  • Output: 0.5V – 4.5V linear voltage output. 0 psi outputs 0.5V, 7.5 psi outputs 2.5V, 15 psi outputs 4.5V.
  • Works for oil, fuel, water or air pressure. Can be used in oil tank, gas tank, etc.
  • Accuracy: within 1.5% of reading (full scale).
  • Current draw: less than 4 mA.
  • Burst (over or max pressure) pressure: minimum 100 psi.
  • Thread: 1/8”-27 NPT. (see our fitting set for other thread size below).
  • Wiring connector: water sealed quick disconnect. Mating connector and wire harness (pigtail) is included.
  • Wiring: Red for +5V. Black for ground. Blue for signal output.
  • Our material is using top of line 316 stainless steel (not 304) and high temperature auto-graded plastic.
  • This is a high quality pressure sender, with ceramic pressure chip sensor inside.

Sensor was connected via a voltage divider of 1.5k and 4.7k ohms to drop maximum voltage output from 4.5v to 3.4v

Calibration Methodology

Once sensor was in place and functional on a basic level using the "tinker" firmware we filled tanks to the point where they begin to overflow (not quite full but close: water in big tank 70" deep) because of holes drilled in the side. and we took 20 readings to establish "full" (raw data below)

Then we drained the system entirely and took readings with no water in the system to establish "empty"

Then we repeatedly ran the pump for ten minutes increments each time stopping the pump an taking twenty readings (as fast as we could type and hit the refresh button on the sensor software.)

We then let the well recharge for 15 minutes to ensure no gaps and went again.

All this data was recorded in a spreadsheet with notes about where the water had reached.

This data can then be analyzed and used to try and parse out signal and noise to improve accuracy in reading and interpreting the data.


Sensor output (with original power supply) was found to be somewhat noisy, with readings swinging at quite a large range: 16 sets of 20 samples were taken wth the greatest variation being over a swing of 331 units (average deviation of 82.9) and the least being 124 (when empty: average deviation of 26.2) - swing greater when tanks are near full. However the power supply was found to be at least partly at fault for the noise - when we switched it with a more robust one noise dropped significantly. Both power supplies were rated at 5V, 1 amp - the second was a brand name. Wifi may use more power than the adaptor can supply without a voltage drop which may be negatively affecting the feed voltage to the sensor, which in turn may cause the output voltage to fluctuate. With the second supply, the variation being reduced to a swing of about 99 units (average deviation of 18.2 unts) while the tank was nearly full. Recommend trying a 1.5 amp or greater power supply.

A 100-115 point boost is observed in sensor output (at tank about half full) when pump is on. (making the water in the tank appear about 12 inches deeper than it actually is.)

10 minutes of pumping yields about 200-230 gallons of water (not counting times when pump is powered but is actually off due to float switch cutting out while well recharges)

3.5-4" of tank depth are yielded when pump is on for 10 minutes which changes the sensor reading by approximately 33 points. (well under the average deviation (due to noise in the sensor) of 54 points when taking 20 samples.)

From system totally empty to beginning to fill tank 1378 points of pressure differential were observed corresponding to about 11 feet of head or 4.8 psi and containing about 200 gallons of volume.

From beginning to fill to absolutely full (without planned improvements to top of tank plumbing) about 730 points differential on the sensor were observed corresponding to about 70 inches of head (5.8 feet) and 2,500+1,700 = 4,200 gallons of volume

Sept 21, 2016 at 10am smaller tank is at 766 gal 23" and larger is at 900 gal 30" reading of gauge is at 43 and roughly 2100

Set ponts and milestones

Predefined values are used in code using:

  • #define constantName value
  • #define ErrorValue 300 //readings under this number are likely to indicate that the pressure pump is on and causing low readings
  • #define TotallyEmpty 400 //readings under this number indicate a dry system (except)
  • #define TanksEmpty 1800 //readings under this number indicate the pipes are full but tans are empty
  • #define PumpOn 1900 //readings under this number should trigger the pump to turn on
  • #define PumpOff 2200 //readings over this number should trigger the pump to turn off
  • #define TanksFull 2500 //readings over this number indicate the tanks are overflowing


The sensor

2304.00 2198.00 2352.00 2122.00 2254.00 2288.00 2159.00 2116.00 2367.00 2270.00 2280.00 AVERAGE of 2246.36 - 55" 30 min later after draining

Chart of Data

can be found here [1]


The first attempt at building a system failed for a multitude of reasons.

1. The sensor connection on the water tank was broken as it was strung through the feed-through (the hole was too small for the RS9 connector, so the connector was jammed through, but it broke some of the connections). 2. The water tank sensor ran out of batteries. Something was wrong with the solar-battery charging setup. 3. The code on the pump controller may or may not have had a fail-safe for hearing from the water tanks (will need to check). 4. We were using the wrong type of controller for the power control of the pump. We were using a 10A relay, when in fact we need a 2 hp contactor. To use a relay, it should be rated for 50A of resistive load. Anything less, and you risk fusing the relay in the 'open' position, leaving the pump on. This happens because of the large influx of current during the pump startup, which overheats the relay. This may have happened to the relay that was out there.

I found this out by <a href="http://electronics.stackexchange.com/questions/196976/relay-ratings-at-120v-and-240v-can-i-use-a-20a-240v-relay-with-a-13a-120v-pump">asking the internet</a>.

The new system uses Particle Photon WIFI devices, but we still need a contactor to switch on and off the pump. The code for the water tanks and pump control is tested and works, although the battery on the tank sensors seems to be dropping:

State of charge of the tank measurement battery

so I upped the sleep time from 10 mins to 20 mins, and we'll see how it does.

Here's a contactor for $25: http://www.ebay.com/itm/like/272008316055?ul_noapp=true&chn=ps&lpid=82

A new 50A SSR is about $50: http://www.newark.com/crydom/cwu2450p-10/ssr-panel-24-280vac-50a-screw/dp/72W3889.

Here's a live view of some of the data:

<iframe width="450" height="260" style="border: 1px solid #cccccc;" src="http://api.thingspeak.com/channels/62130/charts/5?width=450&height=260&results=1000&dynamic=true" ></iframe>

And the thingspeak channel with the data: https://thingspeak.com/channels/62130