Saturday, August 31, 2013

Finally got a Raspberry Pi

OK, I broke down and took the plunge to a different kind of little computer; I went out and bought myself a Raspberry Pi <link>.  Nice little machine.  It wasn't an easy decision on my part since I can finally make the little Arduinos do most anything I want to with hardware, but I got a bug up my butt.

I was corresponding with a person working on garage door control and he was pushing the door state out to his cell phone.  So, when the door opened, it sent a message to his phone and told him.  I decided that would be a really great way to keep track of things around the house.  Besides the garage door, it would be nice to know that the power was too high while I was away so I can log into the house and turn something off, that kind of thing.  The problem is that that stuff can get hard to do on an Arduino.  When you get into the internet realm, the Arduino doesn't shine.  What was needed was a machine that didn't use much power, and had plenty of support for ethernet and internet.  A laptop would do the job, but that costs way too much and relies on something that can take too much time to boot up and run.  The Raspberry Pi sounded like the perfect solution.  It has a serial port and an ethernet port built right in and runs Linux; how cool is that?

It came in, and I started looking at how to get started with the thing.  Let me tell you , there are hundreds of tutorials out there and they all leave something out that is necessary.  This is because you actually need a console for the little device to get it going.  I stepped through the process of creating an SD card with the operating system, then plugged it into my home ethernet network.  I downloaded a terminal program and  used ssh to talk to it, did the various configuration items and finally got it to work in a reasonable fashion.  So, I actually got it working without hooking it to my TV and going out to buy a bluetooth keyboard and mouse.

Yes, the inventors said they wanted people to be able to use the board without having to buy anything, but how many of us have a bluetooth keyboard around the house?  Sure we have a TV, it's mounted in an entertainment center and turning it around to get to the video ports is a pain, but doable.  They have a nice little port on there that can be a serial console, but who has an old fashion terminal anymore?  Besides, it 3.3 volts, not 12 like the old rs232 terminals; you have to buy a special adapter to use it.  And, I'm here to tell you the power supply you use matters ... a lot.  These things use a lot of power for a tiny little computer, and many of the wall warts out there can't do it.  See, not only does it need several hundred milliamps, it needs it highly regulated.  I had one wall wart that would supply 1.5 amps, but the regulation wasn't good enough and when the ethernet came up, it would fail because the voltage dropped a bit before the regulator kicked in and brought it back up.  There was another one that just didn't live up to its rating, a third that wasn't filtered enough.  But, like I said, I have a bunch of them and a couple of them worked just fine; they had enough capacity and were properly regulated and filtered.  See, wall warts are mostly made to charge batteries, not run little power hungry computers.  I'll probably be looking into power supplies for these little things in the future.

But I got it to work.  When you try it, look for 'Raspberry Pi headless' on bing or google and there are a few thousand examples of how to proceed.  None of the examples I found were perfect, but bouncing from one to the other I was able to get it going.

The little device came up, set the time, started all of the processes and just worked.  Now I had to do something with it.  I chose to use python as the language instead of C because I'm getting tired of having to do every little thing necessary and wanted some more sophisticated abilities.  Sure, each of the languages has it's strong point, but might as well start somewhere.  Loaded the libraries I thought I needed and wrote a little code to talk to my two air conditioner thermostats.  IT WORKED FIRST TRY.  Well, not exactly first try, I had some syntax errors and such to fix, but it worked.  Then I wanted to be able to schedule things like polling the thermostats every minute, so I loaded another library and it worked.

The Raspberry Pi Script
import time
from apscheduler.scheduler import Scheduler
import urllib2

NThermoUrl = "HTTP://192.168.0.202"
SThermoUrl = "HTTP://192.168.0.203"

NthermoStatus = []
SthermoStatus = []

def openSite(Url):
        try:
                webHandle = urllib2.urlopen(Url)
        except urllib2.HTTPError, e:
                errorDesc = BaseHTTPServer.BaseHTTPRequestHandler.responses[e.code][0]
                print "Cannot retrieve URL: " + str(e.code) + ": " + errorDesc
                sys.exit(1);
        except urllib2.URLError, e:
                print "cannot retrieve URL: " + e.reason[1]
        except:
                print "Cannot retrieve URL: Unknown error"
                sys.exit (1)
        return webHandle

def getThermoStatus(whichOne):
        if whichOne == "North":
                website = openSite(NThermoUrl + "/status")
        else:
                website = openSite(SThermoUrl + "/status")
        # now read the status that came back from it
        websiteHtml = website.read()
        # After getting the status from the little web server on
        # the arduino thermostat, strip off the trailing cr,lf
        # and separate the values into a list that can
        # be used to tell what is going on
        return  websiteHtml.rstrip().split(",")

def ThermostatStatus():
        print(time.strftime("%A, %B %d at %H:%M"))
        NThermoStatus = getThermoStatus("North")
        print "North reports: " + str(NThermoStatus)

        SThermoStatus = getThermoStatus("South")
        print "South reports: " + str(SThermoStatus)

        print

sched = Scheduler()
sched.start()
sched.add_interval_job(ThermostatStatus, minutes=1)

ThermostatStatus()
while 1:
        time.sleep(1)


Frankly, I'm impressed.  Here's a little bitty board that can be made to do the things I need to do around the house.  Sure, it needs the support of intelligent devices out there to do the actual work, but this little guy can coordinate activity and report things to me over various devices.

I still have a lot of work to do before it can take over the house, I have to get an XBee working on it, experiment with a web server, figure out where to put it and what to put it in, that kind of thing.  I've gotten used to my House controller having flashing lights to tell me things are happening and a special light to let me know something is wrong, so those things have to be considered.  I'll have to experiment with my cloud data store at Xively, I like having my data available there.  It took a long time and a lot of experimentation to get the current house controller working, this will be roughly the same.

However, this little guy has a real operating system on it and can truly multitask.  This could be fun.

Saturday, August 24, 2013

Waterco Multicyclone Filter for My Swimming Pool part 2

Part one of this is here <link>.

It's been a week with the new pre-filter on my pool and I can actually say that I'm satisfied.  No leaks and it works as advertised; nice device.  Here's what it accumulated in the reservoir:

Yes, this is a weeks worth of the sand and stuff that would have been starting to plug up my cartridge filter already.

The white layer on top is the calcium carbonate and calcium sulfate that is created by my salt generator.  That's the stuff they call 'snow' that accumulates in the corners of the pool and annoys the heck out of me.  This filter catches that stuff and keeps it from getting into the cartridges...nice.

Now I feel comfortable recommending this device for other folks to use on their pools.  I don't have enough experience with how much it will save me in the longer term, but if it keeps me from having to clean the cartridges every couple of weeks in the stormy season, it's worth every penny I paid.  Cleaning the filters tears them up over time forcing me to have to buy new ones.  At almost 90 dollars a cartridge and having 4 of them in the filter, it adds up in a real hurry.  Just saving me just one purchase of replacement cartridges will pay for the cyclone filter.

The fact that it's capable of filtering out the 'snow' gives me an idea.  If I put another one in the path of the chlorine generator, it should remove the snow before it gets to the pool to annoy me.  This would also lower the calcium level in the water because I would be constantly removing it after the generator formed it into the snow.  That would be good if it didn't lower the calcium level enough to cause leaching from the walls of the pool.  I don't have enough money to experiment with that right now, but maybe in a year or so I could get another one and install it to remove that stuff.  Heck, two of them might be enough to get rid of the cartridge filter entirely, or scale it back to a much smaller device that doesn't cost so much to maintain.  I have to worry about flow rate though, smaller filters may not have enough flow.

At any rate, if you live in a dirty area and have to clean your filter unreasonably often, this is a good device that just may relieve some of the burden and expense.  I really like it.

Edit: 7/12/2015 :

It's been a while now that I've had this in operation and a reader asked me for an update. First, there has been exactly zero problems with the construction or operation of the device. However, last year I had a flood and the pool filled up with muddy water that washed in. This completely filled the Waterco filter and the cartridge filter I have down line from it. This pushed the water pressure up so high it blew the fitting on the top of the filter off. That, in turn, stripped the threads so the union fitting wouldn't hold unless the pressure was less than 15 pounds.

I called Waterco and they helped me get the fitting I needed, and after replacing it, all was well again. I still get a nice pile of debris in the bottom of the filter from the sand and such that blows into the pool, but the stuff that floats cannot be caught by the filter. It's only for sand and such, so I still have to clean the cartridges.

So, for me, it's a welcome addition to the pool and cuts down on the number of times I have to clean the cartridge filter (a lot). It's still as easy to clean out as it was on day 5 or so when I got to try it the first time. It survived being totally filled with fine clay from the flood, and only suffered because I went way past the specs in pressure pumping muddy water around.

Therefore, if the trash you're trying to get rid of is mostly heavy inorganic material, it should do a great job for you. If the trash is mostly light weight, floating organics, you'll get less obvious results.

Mechanically, it's great, just don't expect it to handle flood water that is filled with sand and clay.

Saturday, August 17, 2013

Waterco Multicyclone Filter for My Swimming Pool

I have had nothing but trouble with my pool since about a month after it was installed.  Sure, it's fun to laze about in it on the hot summer days; it makes desert life bearable, but darn it's hard to take care of.  I have a salt water pool as mentioned several times in the tab above labeled "Swimming Pool" <link> and that generates its own chlorine, but that creates "Ph creep", which I deal with by pumping acid into the pool at regular intervals using  an Acid Pump <link> that I created.  However, there's still problems.

See, I have a cartridge filter instead of the more traditional diatomaceous or sand filter.  These things require cleaning and replacement.  Cleaning can be as often as every couple of weeks in dirty weather or a few months when there's no sand storms, bug migration, tree blooms, or dirty dogs to mess it up.  However, this year I've been pestered by caterpillars, crickets, beetles, frogs, sandstorms, and tree blooms such that I've had to clean the cartridges several times.  Add to that the calcium carbonate snow that accumulates due to the chlorine generation and summer has been a pain in the pool department.

I decided to get a pre-filter to get rid of some of the crap to keep the work load down.  I got one of these:
This is the Waterco Multicyclone 16.  Basically, it's a Dyson vacuum cleaner that works for your pool.  It goes after the motor and before the big pool filter and removes most of the crap before it gets into the filter.  Theoretically it should keep me from having to clean the cartridges as often, maybe as little as once a year.

Frankly, I'm skeptical.  However, after looking at the various videos and hunting around for honest reviews of the thing (I couldn't find one), I took the plunge and bought one.  I just installed it today, so I don't have a history to call on, but I can say that it wasn't hard to install and looks like it's doing what they say it does.  Here's the installation:

Yes, it's tall.  I could have mounted it closer to the pump, but then I would have had to get a new drain faucet and it would have only been six inches shorter.  I used two 45 degree fittings because 90 degree fittings impede flow and I wanted all the flow I could get.  The idea of the pump is that the water goes up through a pipe in the middle, swirls around through 16 cyclone fixtures inside where centrifugal force removes debris allowing it to fall to the bottom of the clear area where it can be discharged using the red valve at the bottom.  The cleaner water then goes to the cartridge pump and gets 'polished' before discharging into the pool.

I used the glue technique I learned when I was working on the solar heater.  I found out that to get the absolute best seal, forget the normal PVC cement and purple primer, go directly to the blue 'Red Hot' cement and forget the primer.  That little trick took me almost a week and calls to the pipe manufacturer to discover.  Here's a picture of the filter in action:
No leaks !!  You really can't tell from this picture that there is water in there, but I expected it to be swirling around; it didn't.  The cyclone action is all in the top section and the relatively serene clear bowl at the bottom is just clear water.  At least it was clear at first.  Over the next 20 minutes particles started to appear in the bowl, then a bug, then some of the white snow created by the chlorinator.  After about 20 minutes, I purged it by opening the valve and everything that had accumulated shot out the pipe to the side.  So far, it is doing exactly what they claimed.  Just before I purged it, I took this picture of the bowl:
See the accumulation at the bottom and in the discharge pipe?  That's after 20 minutes !  Yes, that's the kind and amount of crap that is getting into the cartridge filters and clogging them up.  I suspect I'll be purging this thing every couple of days during the dirty season.  That is after the new wears off; right now I purge it every time I go out there because it's cool to watch the debris shoot out.

In all honesty, I can't recommend this device for other people yet, I haven't had enough experience with it yet.  However, if the accumulation of particulates is any indication, this thing works.  I'm going to watch it like a hawk for the next week or so (naturally, it's new and cool) then determine if it is actually doing the job it's advertised to do.  I'll hook up the vacuum head and clean the pool and see what happens when I flood it with the stuff that hangs around on the bottom of a pool in the desert; that should be a good test.

At any rate, stay tuned, I should know more in a few weeks.

Edit: I've had some experience with it now, more information here <link>