Saturday, December 15, 2012

Really Nice Gauges

Recently I was shown an extremely nice set of gauges by a fellow on the Arduino forum, graynomad.  They were metalic looking and had a great set of parameters to mess with.  Well, I couldn't resist, and decided to figure out how to use them and somehow get them on this site.

Well, I sort of got it working.  It seems that Google (Blogger) has a problem with iframes, and that's pretty much the only way to include one of these.  The problem is that it messes with the scrollbar in Chrome, their own browser.  I'm not sure how they show up in IE, except they won't show up at all in IE8 because it doesn't support canvas.  For something this complex, the canvas is the only practical solution short of using something like Flash.

So, if you're using Chrome, look over to the right where the scrollbar is, notice it doesn't look right?  If you put your mouse over there and click, you'll see that it actually works, but just doesn't look right.  I don't have a solution to this yet.

But, let's look at the gauge.  Notice it has an LCD display and a moving hand.  When my energy usage goes above the red indicator (it's on the dial), the little red LED will light up.  These are all parameters that can be set for the gauge.  I chose the brass look simply because it fit my taste, there are many, many combinations possible.  The gauge is sort of real time.  What I do is update it every 10 seconds from my datastore at Cosm which is updated every 60 seconds.  So, every minute or so, it will be updated to reflect the current power usage at my house.  I plan on working with these gauges quite a bit more; they're just too nice to leave alone.

So, if you want to use them also, or just admire the tremendous amount of work that went into creating them, they're known as the SteelSeries and apparently were initially designed for weather displays.  Just go to Google and start looking.  If I gave a URL, it would be the wrong one or outdated or something, so check it out yourself.

And, sorry about your scrollbar; it'll come back when you go leave this page.

Thursday, December 13, 2012

Let's Talk About Septic Tanks

Nice subject....right?  Since I live out in the sticks, there are no services here except power and phone.  I have my own well, propane tanks, and septic system.  Since it's a relatively new septic system, it has all the new and improved features.  This usually means there is more to worry about and take care of, and at least in my case, this is certainly true.

My first problem came a few years ago when sewage backed up into the house.  Since I had only a general idea where the tank was actually located, the service guy had to hunt a while to find the access ports on the tank.  See, newer septic tanks have two access points for different stages of sewage treatment and both of them have to be pumped out.  When he uncovered it, I found out I had a filter inside the tank.

Yes, there is a filter that stops solids from making their way out into the leach field.  The filter had plugged up and was not releasing fluid into the leach field.  That filled the tank and caused me to have a mess in the bathroom.  Nice.  So, obviously, the tank filter needed to be cleaned and the tank pumped out to restore service.  So, I had the service company install risers with nice green covers on them to allow (relatively) easy access to the septic tank so I could clean the filter.  Total bill, around $800.  Not something I wanted to repeat very often.  Here's a picture that illustrates the kind of thing I'm talking about:
All you see at ground level is the green plastic covers.  Just remove these to service the tank.  Here is what the filter looks like:
To clean it, just grab the blue handle, pull the filter out, and bang it around.  Once you knock the debris off, rinsing it is easy, just spray it down with a water hose.  Here is the basic configuration of the tank and the various parts inside:
Except I have a riser on both sides so each tank can be easily pumped out.  Notice the 'sanitary tee' on the inlet side?  That causes problems as well; more on that below.

Fast forward a year.  I had company with kids and the darn tank filled up again.  I opened the wonderful new access points, and sure enough, the tank was full again.  Called the same service company and they came out and cleaned it out for me again.  I chose this solution to get the house working again since I had company at the house that needed to use the bathroom.  Total bill, $340.

A couple of weeks ago, it happened again.  This time I didn't have company, so I went out and cleaned the filter.  The tank immediately started to drain into the leach field and drop the level, and by the next day, it was back to a normal level.  No costs, this is the way to do it.  However, about four days later the house backed up again.  When I opened the access point, the tank was at the proper level, and the filter was clean.  What the heck was up with that?

Seems when the tank was full, a clot of toilet paper formed on the inlet side and had turned to concrete.  See, what happens is that the 'sanitary tee' caught all the toilet paper and allowed a plug to form on the inlet.  When I lowered the level of the tank, the plug hardened and I had a new problem to deal with.  I spent most of the day with a water hose and jet nozzle breaking up the plug and restoring septic service to the house.  This needs some solution that doesn't require me to remember that the darn filter needs to be cleaned, and a way of clearing the pipes that doesn't entail a days work with a water hose.

So, I bought one of these:
This is a hose and special jet that you hook to your power washer and run through the sewer system to clear out clogs.  It won't work on tree roots or cave ins, but it will clear most clogs quite nicely.  Since I had never used one before, I was skeptical, but it did a great job.  It pulls itself along breaking up stuff and washing it down the sewer line.  If it stops at a bend or a clog, just pull it back a little bit and let it go; it will work its way through the clog and around the corner after a couple of tries.  Really nice tool.  Total time to clean out the pipes was around 30 minutes and most of that was figuring out how to hook the device up to the power washer.

But, to prevent the problem from sneaking up on me and flooding the bathroom was still a problem.  With a little searching I found out that there were floats that are specifically designed to tell you when the septic level rises.  I got one of these:
This is a normally closed float switch.  I chose normally closed so that I would know that the level was OK by a closure and it would open when the level got too high.  This way I knew the switch was OK and wouldn't have to wait for the sewer to back up to find out the switch was broken.

Total cost for both items: $150 including shipping.  I consider this a wise investment since now I can tell if the tank is rising and clean the filter long before it backs up into the house.  I also have a way of clearing the pipe easily each time I open up the tank to prevent the toilet-paper-turned-to-concrete-plug problem.  Sure, I could just clean the filter every six months or so, but who remembers that kind of thing?  Especially since this is probably the nastiest job one can take on around the house.  'Sanitary tee' ?  Who the heck thought of that name?

I haven't hooked the float into the house network yet, but that will come over the next month or so.  That's a problem that I already know how to deal with.  I plan on having a little light come on somewhere inside the house that I can't ignore; heck, I may have it send me email also.

I have the coolest septic tank in the area.


Friday, December 7, 2012

Alternatives to Cosm (Pachube), Part 2

(edited heavily on Dec 11, look below to see why)
Previously <link> I discussed the possible use of Sen.se as an alternative to Cosm.  This is becoming important to me because Cosm seems to be slowing down over time.  The users on their forum have brought this to the developers attention and there have been responses, but I'm having trouble loading a single day of data without a server error and failure to display the data.  So, I just tried out another offering emoncms.org.  It's pretty darn compelling.

The problem with most of the services that I've investigated though is there just isn't enough documentation on what it does, how it does it, where it stores the data, etc.  This is somewhat true of emoncms, but at least there's enough (including its forum) to actually use it.  It took me most of an afternoon to prowl through enough documentation and user comments to get it working.  The part that held me up the most was finding out how to get my data to the service.  It turns out that it's relatively easy to have an Arduino send the data to the service and then construct graphs and things using emoncms tools.

However, there are a number of odd problems relating to embedding their graphs into a blog page.  When I first put this page up I had a multigraph and a gauge that showed real time usage.  The problem was that using the scripts turned off the scroll bar for the page.  That's a bit unacceptable, so I edited the page to remove the visual display.  There are also a few display problems when using their dashboard, but it mostly works.  Here's the link to my dashboard with gauges and graphs that indicate real time data <link>.

Like I said, this is a very compelling site.  One problem may be that this site is open source and maintained by a community of interested users.  That means that it will grow quickly and capabilities will be added as they are thought of and users make the changes (unfortunately, it's the same for bugs).  That makes it somewhat unpredictable.

I can deal with that.


Like I said though, it's a bit tough to find out how to send data from an Arduino to the site.  I got it to work with minimal trouble after searching a lot on the site and its forum.  Here's a code snippet to illustrate how to do it:


The Arduino Sketch

void sendEmoncmsData(){
  char dataBuf[100];

  if(emoncms.connected()) // already trying to get data, just leave
    return;
  // construct the data buffer so we know how long it is
  strcpy_P(Dbuf2, PSTR("{RealPower:%d, PowerFactor:0.%d, PowerVoltage:%d.%02d, PowerFrequency:%d.%02d, InsideTemp:%d, OutsideTemp:%d}"));
  sprintf(dataBuf,Dbuf2,
    (int)round(realPower),
    (int)(powerFactor*100),
    (int)rmsVoltage,
    (int)(((rmsVoltage+0.005) - (int)rmsVoltage) * 100),
    (int)(frequency),
    (int)(((frequency+0.005) - (int)frequency) * 100),
    (ThermoData[0].currentTemp + ThermoData[1].currentTemp)/2,
    (int)round(outsideSensor.temp));
    Serial.println(dataBuf); // take this out when you've got it working
//    return;  // so you can see the buffer before you actually send it
  strcpy_P(Dbuf,PSTR("emoncms Connecting..."));
  Serial.print(Dbuf);
  if(emoncms.connect()){ // set a limit on how long the connect will wait
    strcpy_P(Dbuf,PSTR("OK..."));
    Serial.print(Dbuf);
    tNow = now();
    strcpy_P(Dbuf,PSTR("GET http://emoncms.org/input/post?apikey=secretnumbers &json="));
    emoncms.write(Dbuf);
    emoncms.write(dataBuf);
    emoncms.write("\n");
    emoncms.stop();
  }
  else {
    strcpy_P(Dbuf,PSTR("failed..."));
    Serial.print(Dbuf);
    emoncms.stop();
    while(emoncms.status() != 0){
      delay(5);
    }
  }
}

See, it's a simple json interaction that names the variable that you want to save data for.  emoncms will create the data store and name it for you.  All maintenance for the data can be done from their site.

This could well become my new cloud storage for data.