Sunday, January 11, 2015

Christmas Tree Watering

For our first Christmas in Washington, we purchased a real, live Christmas tree.  My wife loved it; it looked and smelled great, making our living room absolutely festival.  She feared for its health, though, during our trip out of town over the holiday weekend and asked if there was anything that could be done to ensure it was watered while we were away.  Of course there was; we've got technology for such things. With only a small amount of work, I had an Arduino-based system constructed and installed, ready to serve all our Christmas tree watering needs.

I took the timer code and hardware from the moth-balled daylight alarm clock and repurposed it to check the water level in the tree stand and the water level in the reservoir every day at noon.  If there wasn't enough water in the tree stand and there was water in the reservoir, the program would turn the pump on, checking every tenth of a second to see if the tree stand had filled up.  Once it had, the pump was turned off.

For water level sensors I used two wires glued down to the edge of the tree stand and reservoir. As you've probably heard, tap water is quite conductive so as long as both ends of the wires were in the water, the circuit would complete through a resistor divider network.

The pump was driven by a Darlington transistor feeding the coil of a 5V relay.  Much like in my root beer temperature controller project, I used the relay to control one pin of a 120V AC plug. This plug was mounted in an outlet box with a pig tail that was plugged into the wall.  This effectively created an Arduino programmable outlet which, in this case, was powering the pump.

Here is the complete schematic:

And here is a photo of the installed system, in all its bread-board glory.

The reservoir is a simple five gallon bucket; you can see the blue and white wires used to sense the water level in the bucket at the top of the photo.  The tube on the right provided a conduit  between the reservoir and the tree stand for the water.  The black cord going into the bucket is the power for the pump; the other end is plugged into the outlet.

On the right-hand side of the picture you can see another set of blue-and-white wires running under the tree; those were used to sense the water level in the tree stand.  The Arduino and DS1307 can be seen plugged into the bread-board along with the resistor divider network (hidden among the pine needles).  (You might notice the Arduino has a lot of extra hardware on the PCB; this is actually a Ruggeduino, a fully protected Arduino clone which I highly recommend.)

As to performance, the system worked just fine; there were only two minor hiccups.  Problem one: the DS1307 is known not to be terribly accurate and it wasn't. I checked the time on it when we were taking down the tree yesterday and over the course of a month or so, it had drifted about 20 minutes.  There are Arduino libraries out there that can be used to correct this (by putting in user-specified drift constants) but I didn't bother to implement them.  In this application, whether the tree was watered at 12:00 or 12:05 didn't really matter.

The second problem was result of me not thinking about the placement of the tube in the tree stand. On my first test, I placed the end of the tube as low in the stand as I could.  When the pump turned on, the water flowed smoothly into the stand and when the pump turned off... the water continued to flow.  I verified the pump was off but the water continue to come, slowly overfilling the tree stand.  I lifted the tube out of the tree stand and the water stopped.

By placing the tube outlet so low in the tree stand, I had managed to accidentally use a trick common to flood-irrigation farming.  If you place the outlet of a tube lower than the inlet, and can somehow get the water started flowing all the way through the tube, no external energy is needed for the water to continue to flow.  By turning the pump on I had started the system flowing and by placing the outlet of the tube low in the tree stand, I had ensured once it started, even turning the pump off wouldn't stop it.  Simply positioning the outlet of the tube higher along the trunk with the outlet pointed down solved this problem.


Thursday, September 18, 2014

What I'm Learning About Insurance - Part 3

Its close to a year after I started writing about it and now that my case is settled and I have a tiny bit of free time, I've decided I'm going to try to close out my mini-series on what I've been learning about insurance. Let's pick things back up and discuss a little weirdness with liability insurance.

When I introduced liability insurance, I framed it as protection for you, the policy holder, when you do something that causes damage to somebody else.We buy this insurance because, particularly in the case of driving automobiles, it is very easy to cause a lot of damage to somebody or their property. Rather than being financially obligated to directly pay for all of the damage directly out of your pocket, liability insurance comes in and covers those payments for you (up to a certain amount).  Insurance companies do this in exchange for a relatively small monthly fee which, according to the big piles of data they have after doing this a long time, is big enough to allow them to make a profit even after paying out for all this destruction that people cause with their cars.

There are a few tricks they use to make this work. One, they are relatively selective about the type of people they insure.  There are a bunch of people at insurance companies (or people the insurance companies contract out to) called actuaries, whose job it is to figure out what kinds of things are indicators of bad and good drivers.  Past auto insurance claims?  Tickets?  Age?  This type of information allows them to asses just how risky it would be to enter this kind of liability agreement.  Furthermore, using even more data and math, they are able to make an educated guess at how much they should charge you for your monthly payment to them (your premium) in exchange for taking on this risky.  The riskier a bet you are (because maybe you've told them you always drive two times the speed limit), the higher your monthly premium will be.

The second trick to making this whole insurance thing work is to insure tons of people.  Lots and lots and lots of people, hopefully people who always signal, drive the speed limit, and have never gotten a ticket.  By being selective and pooling all those monthly premiums together, it is possible to pay for whatever destruction is caused and still make money at it. Its all statistics, a numbers game. There are no guarantees but with a good screening process and lots of people, the actuaries can find a way to make it work.

(Until recently, health insurance worked the same way.  In fact, some health insurance companies were such sticklers about only letting in healthy people that if you did end up seriously sick, they worked very hard to find a way to weasel out of the contract they made with you.  This is called "recidivism"and its one the things Obamacare  has been trying to fix.  This sneakiness and legal legerdemain on the part of the health insurance companies would be unnecessary if we had a single-payer system where there was only one insurance company; everybody would be covered by default.  Requiring everybody to have health insurance is a step in that direction but still provides some incentives for health insurance companies to try to off-load their sickest policy-holders to somebody else.)

Liability coverage is the most fundamental type of insurance and it extends to more than auto liability insurance. Ice skating rinks, home-owners, water parks, schools, fast-food restaurants, everybody has liability insurance because anybody can sue anybody at any time for causing harm or damage.  Liability insurance makes it possible for businesses to not have to hoard a huge stockpile of cash just in case they get sued for damage they may or may not have caused. During the process of transferring our home and auto insurance during our move we were asked if we wanted a general liability policy, covering our whole lives, essentially.  When I briefly owned my own legitimate window-washing business I had liability insurance in case, you know, I dropped a squeegee on somebody's head or something. Liability insurance gives us all the ability to sue for damages while allowing businesses to not exist one lawsuit away from bankruptcy.

So liability insurance is a good thing for us auto-drivers. But what happens if I have a $100,000 liability policy but I drive into an art museum and destroy their $100 million Van Gogh?  The agreement I have with the insurance company says they will pay the first $100,000 (ignoring the deductible) and the rest is on me.  Things are looking bad because, even after the my insurance company pays out the full policy limit, I will still have approximately $100 milllion to pay.

There is another catch in the law that can prevent my life from being one of poverty henceforth and this is the concept of recoverable assets.  Even though I am still on the hook for $100 million and the museum can sue me to try to recover their losses due to my careless driving, they are not able to take all of my worldly wealth to do so.  There are only certain assets which can be recovered by the museum in a lawsuit. In Kansas (working from memory of what my lawyer told me), the museum could not take:
  • My home (primary residence)
  • One car per adult in my household
  • My retirement savings
For most adults, most of their earthly treasure falls into these categories.  If the museum were to sue me, the amount of money they might win is probably going to be relatively small, even by the standards of a typical household. If the museum has some reason to believe I have a bunch of money, they can search the public records and find out what property I own and how many cars I have registered in my name but they can't look at my bank accounts or ask to go through my house to see if I happen to have any Van Goghs. Based on whatever information is publicly available, they have to decide if it would be worth the time and expense to sue me.  

In the the case of the person who hit me, though I don't believe we did a public records search, we had good reason to believe she was a normal person that probably didn't have piles of cash laying around, at least not $100,000 worth.  What about her salary? There is a possibility of garnishing wages (legally forcing part of her future income to be sent to me) but enforcement is tricky.  Its a lot like child support in that even though I might be legally obligated to that income, enforcing those payments can literally be more expensive than they are worth. Even though she was 100% at fault, the cost of personally suing here would in all likelihood result in lower compensation for me.

It kind of stinks. The combination of a Kansas' low liability requirement ($25,000) and the lack of recoverable assets most of us have means that it is very easy to be completely without fault in a collision and still receive very little compensation for the damage caused.  I could have lost much more than the ability to walk pain-free and the payment I would have received in compensation for my losses (and to pay for future medical care) would have been unaffected.  This is why having uninsured and underinsured policies are so important, particularly in Kansas.  They set a lower limit to the payment amount regardless of the other party's insurance policy.  

To be clear, I really like the idea of protecting what you might call "essential assets" from lawsuits.  Even if I had been able to, I would not have felt good about taking a house, car, or life savings from the gal who hit me. I am very convinced that there was no negligence on her part and that this was entirely an accident.  Unfortunately for me, I am bearing most of the consequence for her mistake but this is exactly why liability insurance should exist.  And this is also why requiring so little liability coverage in Kansas is such a tragedy.  The people who really make out well in this situation are the insurance companies.  They are only on the hook for $25,000, assuming their client buys the state minimum.  If it weren't for the under-insured policy with MY insurance company, everybody but me would have been happy with how things turned out.  That policy made the pool of money in play big enough that lawyers and insurance companies paid attention.

In case it is not clear, here are my recommendations for buying auto insurance:
  • Be responsible and buy a lot of liability insurance.  You may be able to skate by with less but this is the primary mechanism by which people are made whole by the damage you cause.  The amount of havoc that can be wrought by a car is tremendous and as such, your liability coverage should be high.  You don't want to be responsible for any unpaid moral debt.
  • Buy as much uninsured/under-insured coverage as you can afford.  With my insurance company, this was less than 10% of the yearly premium I pay. This extra policy ensures that you won't be left out to dry when somebody else makes a mistake and doesn't have the appropriate amount of insurance.

Thursday, September 11, 2014

One Year Anniversary

A year ago today I was hit by a car while riding into school on my motorcycle.  Today, I can walk and though there is pain in every step, most days it is not much more than what you might experience with a sprained ankle or pulled muscle: annoying but not debilitating.

Thankfully most of what I do is with my mind and and not my body because if the former was the case, things would not be so cheerful. As I have been fixing up our new house, I have found that the flurry of home improvement on Saturday has consequences on Sunday.  I take an ibuprofen and do as Christians have done for centuries; I rest.

I am fragile.  I have always heard those older than me talk about youth and their invincibility.  It wasn't true; how could they say that? It is true. This injury has prematurely aged me and made it clear that this is not simply a statement of the carelessness of youth but more specifically, the lack of necessary care, the lack of premeditation in every step, jump, sprint and turn.  When I approach a large step I become an old man, carefully easing my way down the twelve, fourteen, twenty inches. I remember when I would have eagerly jumped off and landed in a sprint. Now this step is a reverse Himalaya for me, the seasoned mountain climber.  I have history and knowledge that I can conquer this but not without effort and the outcome is uncertain.  There will be pain. I will persist.

I am not young, closer to forty than thirty. About a decade ago I injured my back and over the many months of treatment I was able to more-or-less recover to my pre-injury state.  The physical therapist told me that though I was asymptomatic, I would only stay that way through regular exercise.  The injury would never heal and the pain of my nerve impingement was only millimeters away.  I was young and I generally ignored her.  I have had several minor "re-injuries" since then and still don't do the exercises as often as I should.  My muscles get soft and fail to keep my back in line; I hurt.

Life changes quickly.  I was putting up a picture of Katie and I and it was clear to see they were taken when we were younger, several years ago.  It doesn't seem that like we should look so different.  How long ago did we get married?

This has been a full year for us.  The injury lead to three months of bedrest and three months of physical therapy destroying any plans I had of graduating in May. By mid-June I had a job offer and the process of relocating our lives has filled so many of the days since then. I managed to complete my degree somewhere in there.  It feels like every day from that first phone interview was full with the seeds and fruition of this move; the days feel like weeks. My mind tells me it has been a year since we left Wichita for good.

A legal settlement between all the relevant parties was reached shortly before we left and I do intend to finish my "series" on insurance and what I've learned of the legal system through this incident.  The money was helpful in buying this house but I would trade it back for the ability to run and hike without care again. The only basketball I can play on the huge concrete pad in our backyard is free throw practice.

I write all of this to affirm the platitude: life goes fast and we are not promised tomorrow.  There are many, many who have more than my share of difficulty and trouble through no fault of their own. What I write is not statement of pain and pity but one of grief for the ways things were and never will be again. In the same we that funerals remind us of our mortality and motivate us to consider our life choices, let this short eulogy of my days of youth push all of us to make the most of every day in which we wake up. It is a gift.

Let me end with this. These are words commonly attributed to the Biblical King Solomon of Israel, a man whose life was extravagant, impressive, and devastating enough for our modern media tastes, a man who knew the pleasure and pain of this world so well:

"You who are young, be happy while you are young, and let your heart give you joy in the days of your youth. Follow the ways of your heart and whatever your eyes see, but know that for all these things God will bring you into judgment."

Amen. May it be so.

Thursday, August 14, 2014

Household Detritus

When the mover's had completed their job, our house was virtually empty with only the items we ourselves were taking in our car remaining.  By that Friday afternoon when we were leaving town, the house was virtually bare: the only things we knowingly left behind were paint for the rooms and exterior and the extra tile we had used in the kitchen and bathroom.  And a few air fresheners.

The house we have purchased and have been moving into these past few days was not so thoroughly expunged.  Here are just a few of the abandoned items of which we have recently gained custody.

Anti-stress medication for a cat.

Art used to decorate one of the bathrooms.

Fish candle decorating the same bathroom.

Mystery key.

Very large first-aid kit.

Art decorating the kitchen.

Tiny wrench.

Dog-bone keychain.

There's more, such as the drawer littered with cough drops, the 90's vintage radio and cd player in the garage, and a half-bottle of rubbing alcohol. Most of this will go away but if the fish watercolor is not a print, I think I'm going to fight for it. I don't know where I would put it.

Monday, June 30, 2014

Life Change

Today I successfully defended my PhD dissertation defense.  Except for some administrative paperwork, I have matriculated here at Wichita State University.

Today is also the day my wife gave notice at work.

Both of these events have been driven by the fact that a few weeks ago, I accepted a full-time position at Pacific Northwest National Lab in Richland, Washington.  The work I expect to do there is very similar to what I've been doing at Wichita State: research on the power grid.  Beyond that it is hard to say what my daily work will look like.

Landing the job at PNNL has been a series of divine interventions.  My relationship with the lab began during a class I took several years ago in which I ended up using a simulator they had been developing.  I emailed a number of times seeking help on using the software and ended up arranging a face-to-face with the developers during a conference we both attended that summer.  When I began looking for a job late this last spring, I emailed the developers and they pointed me towards a position that would be opening soon.  I applied, did a phone interview, and in just a few weeks, was flying up for an on-site interview.  Less than two weeks after that, I was told I had the job.

Life since then has been very full.  With a full-time position secured, I was highly motivated to finish up my dissertation.  My wife and I began scheduling all the various tasks and trips that needed to be taken before my start date in late August: moving company survey, house repairs before putting our house on the market, a house-hunting trip in Washington, camping trips with both sides of the family, moving company packing all our goods.... Some of these have taken place already, some haven't and the logistics never seem to end.

But there's been enough break in the action for me to write these few paragraphs. I'm incredibly grateful and thankful for the job and am glad that I'll be able to put my degree to use. My wife is thankful to be done working at her current company and looking forward to a new, job-free life.  We're both looking forward to the change in climate and the proximity to much more interesting geography.

In those regards, the change is good. Even without all the stress of the move, though, leaving is hard.  We have good friends and a strong community here.  Neither of us are extroverts and making new friends will be difficult for us.  There's a new town to get used to, a new way of life to establish, a new home to settle into. The accumulation of these challenges is not trivial and can be overwhelming to contemplate. So we don't.  By the grace of God, we've made it this far and I expect He'll carry us through the remaining difficulties. Its clear something is going on and we'll just have to wait to find out how it all plays out.

Monday, June 16, 2014

Ain't No Amazon

We've needed to replace our stall shower door handle since we bought this house.  It has been broken and corroded; barely functional and not pretty. Katie found a replacement at and to get free shipping we ordered a few other items were planning on picking up from one of there brick and mortar locations.  The order was placed with an expected delivery date on the upcoming Friday.  Not Amazon Prime but plenty fast enough.

The first sign of trouble came when I noticed the credit card transactions related to this purchase: five charges, one for each item.

When a package showed up Thursday I was impressed.  That is until I lifted it off the porch and realized that it did not contain my order, at least not all of it.  Inside that toaster-oven-sized box was one of the five items I had ordered: five fuses.  These fuses could have been sent in a padded envelope but they were instead bubble wrapped to fill the much-too-large box and shipped out to me.

Friday three boxes arrived and today, Monday, the final box showed up.  Five items, five boxes, five shipping charges that I didn't have to pay.  There is no way they made money on this transaction unless they have incredibly favorable shipping arrangements. My guess is that until they get their logistics more stream-lined, they are going to be losing money for quite a while with their online transactions.

Tuesday, June 03, 2014

Upgrading the Power Supply

In my dabbling in hobby electronics, my primary power supply is the one that I built in my third semester of my undergraduate education.  Building this supply was the primary task in Electronics Lab I (required at the time for all engineering students of every stripe) and it took around half the semester to complete.  The power supply was purchased as a kit that had been designed in-house for this course, making it simple enough to understand while we assembled it.  We soldered and screwed the supply together and then tediously measured its performance by the metrics we had been learning in class.

The supply itself is nothing fancy.  Its a linear supply with three independent outputs, two of them variable and one fixed at five volts. I've had to replace the transformer in the past and the paint is chipping off in many places. It still works fine and I no intention of replacing it any time soon.

The biggest pain in using it, though, is that it contains no displays indicating the voltage of the variable outputs.  Historically, I've used a voltage meter to set them. In searching for a simple digital voltmeter for another project, I realized I could use the same item to add displays to my power supply. For just a few bucks, I found the part on eBay and was able to graft them onto the supply.

There are a few more things I'd like to do in the future: add a 3.3V fixed output and add the current draw from each supply. I don't know if I have front panel real-estate but there is still plenty of room inside for such improvements.  Adding it to the list of things I'll probably never get around to...