Saturday, August 19, 2017

Paradise ponders: dead deer, first measurements, wet earth, and sickness at home edition...

Paradise ponders: dead deer, first measurements, wet earth, and sickness at home edition...  Yesterday afternoon, Debbie and I ran up to Aggie's Creamery for an ice cream cone (and, as usual, they were delicious!).  Across the street from our driveway, we saw a dead deer lying, obviously killed by a car.  We stopped at our vet's office on the way up, to drop off some cat food we were donating, and I took the opportunity to ask if there was a government agency that picked up road kill.  Nope.  So when we got home I started up my tractor and picked it up (using my fork).  I took the body of the young buck (a four-pointer) up the road about a half-mile to an old disused quarry where people pile brush to be burned.  I put it on top of that burn pile, so the next time it gets fired off it will make a pyre for the deer.  What a sad job that was...

I've been plugging away on the software for my irrigation supervisor, and making great progress.  As of this morning I have temperature, humidity, barometric pressure, and the four water pressure sensors all working.  I'm almost ready to make a case for this thing, and install it in the shed!

The sprinkler guys were here yesterday and again today, also making steady progress.  We now have 10 zones in the back yard installed and tested.  One of the valves malfunctioned, so that will have to be replaced – but otherwise, it's all up and running!  The sprinklers in the middle of the back yard are currently capped off, because we're going to be soaking the back yard to get it to settle.  After that, they'll spread more topsoil to get the levels right, then install the remaining sprinklers.  It feels like we're dangerously close to getting sod put down.

Meanwhile, a couple days ago Debbie came down with some kind of awful cold.  It started with a sore throat and escalated into fever, sneezing, coughing, runny nose, and scratchy eyes.  She got a sinus infection, too; we made an amazingly fast visit to the local clinic and she got a prescription for Amoxicillin.  The good news from that is that the infection is already knocked down by this afternoon, just 24 hours later.  Good stuff!  In the past couple hours, I've developed a sore throat.  I'm not too happy about that...

Friday, August 18, 2017

Paradise ponders: funny signs, bountiful hay, migraines, and concrete-cutting edition...

Paradise ponders: funny signs, bountiful hay, migraines, and concrete-cutting edition...  When I first saw the sign at right, from some distance, I thought someone had framed one of those Hollywood ransom letters made from newspaper clippings.  It's actually an advertisement hanging in our local drug store.  When I took this photo, two of the women working there came over to see what I was doing.  Apparently the resemblance had never occurred to them, but when I mentioned it they got a good laugh out of it!  :)

The last couple of days haven't seen much progress on our great sprinkler project – but today we've got all sorts of action once again.  The problem before today was a migraine (on the part of my main contractor), and his main employee got sick on top of that!  But today they're back, and things are happening.  One of the things that happened is a fellow showed up to cut both ends of a 20' long stretch of ugly concrete sidewalk, freeing it to be removed.  We're going to put a flagstone walkway in its place.  Another thing that's still happening: large quantities of topsoil are being moved from piles into all the low places in our yard.  It already looks vastly better than it did, and they've only moved roughly half the dirt.  Progress!

Yesterday Scott N. (the guy who leases our south field, 12 acres, for alfalfa) baled up the third cutting for the year.  His yield was 362 bales, a record for that particular field (despite the fact that I took one acre out of production three years ago, to make a play area for our neighbor's kids).  Scott's been leasing this field for 12 years, so he's got a bit of history on it.  There's a couple views of that field below, when he was roughly 1/2 way through baling it.

I'm making nice progress on the software for my irrigation supervisor computer.  This morning I moved it all over to the computer you see in the photo at right (the pen is there to give you a sense for just how small that computer is).  The large board is the Raspberry Pi 3B computer, and the little board to the left is a temperature, barometric pressure, and relative humidity sensor.  I have two other similarly small boards to hook up after I get this one working.  I now have a complete debugging environment up on the Pi, and everything I built on my laptop is now running just fine on the Pi as well.  I figured that process would take me a couple of days, as there were many steps along the way that were new things to me.  Instead it took just five hours.  Not bad at all!

Many moons ago, back in the late '70s and early '80s, I designed and built quite a few prototypes of small, single-board computers that could be used for embedded systems (my irrigation supervisor is an example of an embedded system).  Only one of them actually made it into production.  Those were nearly all based on Z80 CPUs, though I did one with a 6502, and another with a 68000.  The smallest of those was a Z80 design the size of an ordinary shoe box, and I thought that was a miracle of miniaturization.  Though it was small, it required a fan – a rather powerful fan – to cool it off.  I don't remember the exact power consumption, but it must have been around 50 watts.  This little Pi, running my program, consumes just 2.5 watts – and even without a fan those little heat sinks are just barely above room temperature.  The processor on it is millions of times more powerful than that Z80, and it's got 15,000 times as much RAM.  That Z80 had a few kilobytes of ROM (the Pi has 16 megabytes), and no disk (while the Pi has 32GB of solid state disk).  The Z80 prototype probably had a couple hundred dollars worth of parts in it; the Pi was $39.  I never seem to lose my sense of wonder at the pace of advancement in digital systems...

Wednesday, August 16, 2017

Paradise ponders: anniversaries, culverts and muddy yard edition...

Paradise ponders: anniversaries, culverts and muddy yard edition...  Today is our 36th wedding anniversary.  I'm a lucky guy to have my beautiful bride put up with me for that long! 

The funny-looking guy at right is Mark T., my sprinkler contractor.  A big part of the job he's doing is to fix the problems in our yard that would prevent a nice, attractive lawn from being installed.  One of those problems was a giant steel culvert-to-nowhere that was about 3/4 buried near the southern end of our yard.  We have utterly no idea why this ugly steel culvert was there – there's no purpose for it that I could even imagine.  My best guess is that some former owner of our property decided to dispose of it there.  At a guess, it weighs between two and three tons, mainly because of all the wet soil that's nearly filling it.  It's so heavy that neither his skid-steer nor my tractor can lift it – all either of us can do is roll it around.  So he's going to have one of his employees cut it into sections (we'll try two, and if that's not small enough then four), tip them up on end, and get the dirt to fall out.  Mark had an ear-to-ear smile pasted on when he told me of his success – this because the evening before I had voice my skepticism that he could do it. :)

Our back yard has now been leveled and raked with a machine called a Harley rake (much like the one in the photo at right).  One of his employees is fixing a leak right now, but when he's done we're going to light off all the sprinklers in the back yard and soak it really well.  Then we wait for things to settle, and Mark will start hauling dirt to adjust the level to our liking.  Then we soak it again, fix any settling issues, and lay sod.  When that sod goes down, it will be the first time this year our back yard looked green!

This ain't your mama's JavaScript...

This ain't your mama's JavaScript...  Working on the irrigation supervisor software has me doing some JavaScript development again.  It's been a few years since the last time I tried doing anything non-trivial in the web browser environment, so I've been being careful in my assumptions.  It's a darned good thing I'm doing so, because JavaScript has changed so much I can hardly recognize it.  It's all good, too!

I could list lots of changes that I've noticed, but I can convey the flavor of it with a single example.  I wanted to do a SHA-256 digest (of a password) in the browser.  In the past, I'd do a web search for someone's library, download it, and incorporate it in my project.  This time when I did the web search, I discovered the Web Cryptography API, which I'd never even heard of before.  It's supported in every browser I can ever imagine being concerned with, it's open source, and it's been reviewed.  As just one of its bazillion capabilities, it has a digest function that supports SHA-256.  Awesome!

Taken as a whole, the new stuff that's widely supported looks a awful lot like the kind of rich library environment I'm used to in Java programming.  Furthermore, the browsers have moved far closer to a universal standard than they were even just a few years ago.  These changes make JavaScript a vastly more pleasant programming environment that I am quite enjoying...

Dictionary dad...

Dictionary dad...  My sister Holly emailed me this morning, and something she said triggered this memory.  My dad had a larger vocabulary than you'd expect from a farmer – much larger, actually.  His spelling was nearly perfect, too.  These served him well in our word games (Scrabble, Boggle, etc.), which our family played a lot of.

When I was learning to read, I often ran into words I didn't know.  If I asked my mom about those words, most of the time she would give me an explanation, and only occasionally would she send me to the dictionary.  My dad was just the opposite, often sending me to go look up the word and then come back and tell him what it meant as a way of testing my comprehension.

As I worked my way into more adult books, I'd start running into words that the dictionaries we owned at the time didn't list – or listed with definitions that didn't make any sense in the context I was reading them.  This was happening because I had started reading older books that we had on our shelves, and those books were written in an older style, sometimes using words that had fallen out of common use.  I remember particularly running into this with some of Mark Twain's books, and with translations of Jules Verne.  My dad explained that to me, but without any more complete dictionaries the only source of information was my dad's memory – and often these would be words that he didn't know, either.

Then one day dad came home with a new dictionary, a gift for me.  I call it “new” because it was new for our household, but it was actually a lovingly used volume.  Lots of pages were dog-eared, there was marginalia, and a little stick-figure drawing on the inside back cover.  Most likely my dad picked it up at a yard sale somewhere, or perhaps a used book store.  Unfortunately I don't remember who the publisher was, or which edition.  I do remember, though, what it looked like: it was a hardback, with a bright red cover and embossed gold letters on the cover.  And it was huge – so thick and so heavy that at my then-age I could scarcely lift the thing.  The best part, though, was that it was a descriptive dictionary, like the OED, showing how words were actually used rather than laying out a “correct” definition.  I can't recall ever stumping that dictionary.  It became my “word bible” as my reading took me into more and more challenging texts.  It was also the start of a life-long relationship with dictionaries for me!  :)

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...

Sunday, August 13, 2017

Envious, you should be!

Envious, you should be!  We just finished another fantastic meal.  First course was fresh corn on the cob, grown locally.  Next up was Debbie's signature sea scallops from Oregon, broiled in a lemon garlic sauce, topped with dill and lemon zest.  For dessert we had another Galia melon, grown just over the Wellsville Mountains, north of Ogden.  My tipple was Pelligrino sparkling water.  Oh, what a fine meal!

And we've got another one lined up for tomorrow: prime ribeye steak, local (Idaho) baked potatoes, and asparagus from Washington state...