Thursday, August 2, 2012

Swimming Pool Controller

I have an entire page devoted to my swimming pool controller and other devices related to the pool here.  The device works pretty well, but since there are two protocols, (Goldline and my own) and they are real devices, there have been some annoying problems over the period I have been using it.  The problems all stem from the fact that there is no 'on' or 'off' command for the various functions.  They all work like a garage door, you push a button and something changes state.  Push a button, the valve opens, push it again, it closes.  This makes things like turning off the pool light a bit of a problem if you don't know if it is already on.  About a year ago a nice person gave me the command string he was using to turn his pool off, unfortunately it didn't work for my controller, but when I tried it I got an idea I should have come up with a year ago.  Simply look to see if the light is already off, and don't do anything if it is.

Obviously this was too simple an approach for me to come up with when I was developing the controller.  I was getting into loops where I would turn on the light, the delay before the various devices recorded that the light was on was erratic (real devices, remember) and I would issue the command again, thinking it got lost somewhere.  That would make the light turn on, wait a few seconds, turn off, wait a few seconds, turn on, etc.  Annoying at times.  Most of the time everything worked perfectly, but when it got into one of these loops, it might take 10 minutes or so to get out of it.  So simple code like: if (light already on) don't do anything, should fix the problem

Guess what?  It did.

I modified all my pool commands to work this way and the pool controller is very reliable now.  I got the idea when I started working on a controller for my garage doors.  I hate getting a few miles from home and suddenly starting to worry that I left the garage door open.  There is little risk of theft out here in the desert, but I hate having a squirrel move into the garage and a dozen or two cactus wrens deciding it's a nice place to live.  I had a squirrel cause some damage once and I don't want to repeat that.  So, I need to know if the door is open and close it.  I came up with a design where I'll put a magnetic switch on the door and that way I'll know when the door is open and can close it from far, far away.  This made me realize that I have the status of the various controls on the pool already, why not just use them.

There was also the problem of ambition, it worked mostly OK, why fix it?  This lethargy went away when my new, variable speed, permanent magnet, super motor died.  Yes, it died.  It developed some kind of fault and declared, "Emergency Stop in Effect."  Nice informative message.  I called Hayward and they said they'd have to send out a repairman.  The first comment out of my mouth was, "How much is that going to cost?"

"Nothing." was the reply.

Sure enough a nice guy came out, looked the problem over, and REPLACED THE ENTIRE PUMP.  Yes, I got an entirely new pump with zero hours on it as a warranty replacement.  How cool is that?  I hooked my controller up and was annoyed immediately by the toggle action.  That's how I came up with the idea and implementation.  While I was making the changes to the code, a couple of bugs turned up that I didn't encounter before and they got fixed as well; nice side benefit.

I'm waiting for parts to come in for the garage project, but thinking about it, there's a few lessons to learn here.  1. Never give up on an idea, let it percolate a while and a solution might appear.  2.  Don't be afraid to call the manufacturer for advice; you may get a really good response.  3.  some other project may suggest a better way to do something; don't ignore it.  4.  DIY projects are never really done, they just settle down for a while.

No comments:

Post a Comment