Tuesday, August 15, 2017

Paradise ponders: puppies, sunflowers, cedar, and ridiculous amounts of copper edition...

Paradise ponders: puppies, sunflowers, cedar, and ridiculous amounts of copper edition...  In this mornings soft light, the wild sunflowers growing around my barn are particularly cheerful.  The bees are on them already!

When our dogs are out in our back yard, a walk between our house and our barn guarantees that you will be accosted by canines – most especially our two youngest, Cabo and Mako.  This morning as I approached the fence, these faces greeted me:

The trenches you see in the background are part of the great sprinkler project. That's Cabo in the first two photos, Mako in the second two.

Yesterday morning I tackled the hardest part of the remaining wiring on the sprinkler project: pulling 14 wires (each 14 gauge solid copper) through a 2" conduit that already had 15 such wires in it.  After that, wove the same 14 wires through a dozen or so hangers inside the cedar shed until they all come out neatly at the irrigation controller.  That's all done now.  Whew!  Once the sprinkler guys have all the back yard valves hooked up, I'll ring out those wires and install them into the irrigation controller.  At that point, all the sprinkler system wiring will be complete. 

The amount of heavy wire in the sprinkler system is kind of amazing.  If I kept track of the spools of wire correctly, there are about 7,000' of 14 gauge solid copper wire in the system.  The trenches containing big bunches of wires look like some kind of industrial installation.  If you haven't purchased copper wire recently, you might also be surprised at how expensive that stuff is.  I'm told that some larger construction projects have been put on hold until either the price of copper comes down or parts compatible with aluminum wire (very cheap by comparison with copper) become available.  Electricians in general don't like working with aluminum wire, as it has to be substantially bigger (in diameter) than copper to handle the same current safely.  The rule-of-thumb for this is to go up two gauges for aluminum wire.  In other words, where you might have used 12 gauge copper wire, you'd need to use 10 gauge aluminum.

Shortly after I completed that wiring, I called the vendor who is supposed to get the tongue-and-groove cedar for our deck ceiling.  My plan was to pester him every couple of days until he got it done.  No need!  It was done!  Woo hoo!  I called my brother Scott looking for some help (as he's got the pickup with a nice roof rack), and before noon we were at the vendor loading up 1,800 linear feet of 5" wide western red cedar (tight knots) tongue-and-groove.  That works out to 750 square feet, and my deck is about 630 square feet, so I'll be able to pick and choose the best pieces – and still have a bunch of usable wood left over.  This is awfully pretty wood, and a darned big pile of it on our deck!  Smells great, too, though that won't last too long outdoors.

Calibrating sensors...

Calibrating sensors...  My irrigation supervisory system has four pressure sensors that measure water pressure at various points in the system.  Those sensors have a 0.5% absolute accuracy over the full range of the sensor (0 - 150 psi), and over the full temperature range (-40 to 105 °C).  At normal operating pressures of around 40 psi, the maximum absolute error is therefore about 0.2 psi.  However, because sensors could be off in different directions, the maximum absolute error between two sensors is about 0.4 psi.

That's still a small error, and not really significant for my system's purposes – but I got to wondering if I could do better.  There are two places in the system where I'm measuring the pressure difference between two gauges (to sense how dirty a filter is), and there I'm looking at pressure differences as small as a few psi.  The 0.4 psi error looms more significantly there then you might think at first blush.

The obvious way to correct the sensor error would be to calibrate each sensor against a “gold standard”.  One could imagine, then, simply making an equivalence table for each sensor, showing the actual pressure that corresponds to each reading.  You could make a few calibrated readings and then linearly interpolate for intermediate pressures.  Simple!  Except, that is, for one slight little problem: the lowest-cost pressure calibrator I could find is nearly $500!  That's way more than this problem is worth to me (and several times the cost of all four of my pressure sensors!).  I can't think of anyone who might have one of these little beasties laying around, either.

So we need another approach.  One thing occurred to me that might lead to a solution: the sensors' intrinsic absolute accuracy is more than sufficient – what I need to improve is the relative accuracy.  What if ... I took one of these sensors and called it my gold standard?  Then I could calibrate the other three sensors against that one, and then my differential pressure measurements should be more accurate.  I have an easy way to have all four sensors simultaneously measure the exact same pressure (whatever the Paradise Irrigation system happens to be providing at that moment, which varies from 0 psi to about 45 psi over time): I just close the outlet valve from my pump shed, which guarantees there's no flow through the system (and therefore all the pressures are identical).  I can also easily get absolute zero pressure to all four gauges by closing the inlet and the outlet valves, then draining the pump.

I know a bit about these sensors from past experience.  If P is the absolute pressure, then the sensor's measured pressure S can be approximated by
    AP + B,
where A is the scale coefficient (generally very close to one), and B is the offset (generally very close to zero).  If you take a series of measurements at different pressures for a sensor you're calibrating, while your gold standard is measuring the same pressure, you can get a series of pairs of measurements.  That series can then be used as the input to a linear regression, the output of which is A and B for the sensor you're calibrating.  Then you've got that sensor's equation relative to your gold standard sensor.

At that point it's just some simple math to “correct” the sensor you're calibrating.  It's equation is  
    S = AP + B
The gold standard's equation is  
    S = P
(by definition).  The difference between them (the error, or E) is
    E = (A-1)P + B
Therefore the corrected pressure  
    C = S - ((A-1)P + B)
That's not so bad!  I'm implementing a class that does this right now.  The most challenging bit of that is the user interface: a way to let the user (me!) click a button to capture a new set of data.  The irrigation supervisor can't do that on its own, because it doesn't know when all the sensors should be showing the same pressure – it needs a human assist for that...