Saturday, June 29, 2013

How to use the SteelSeries Gauges with the Xively API

Over the last months I've gotten compliments and questions on how I created the SteelSeries gauges and how I hooked them to the Xively (pachube -> cosm -> Xively) API.  First, let me give credit where credit is due.  I didn't create the SteelSeries gauges, Gerrit Grunwald did.  He has a great blog here <link> where he describes the various displays he's created.  I stumbled across them a while back and hooked them into my Xively data feed to display the last updates so I would have a nice display of current power usage and temperature.  They worked really well and look great.

It took a little work to get them going, but it was well worth it.  Basically, I query Xively for the last value, then give it to the gauge to display.  Here's the current (a minute ago) temperature at my house in the Arizona, USA desert.

Edit: This used to be a live gauge, but I replaced it with a picture.

So, the source to do this looks like this:

<head>
<title>Dave Testing</title>
</head>
<body onload=init()>
<canvas id=gaugeCanvas width=200 height=200>No canvas in your browser...sorry...</canvas>
</body>
<script>
function init()
{
// Initialzing gauge
    tempGauge = new steelseries.Radial('gaugeCanvas', {
             gaugeType: steelseries.GaugeType.TYPE4,
 minValue:0,
                  maxValue:150,
                  size: 200,
                  frameDesign: steelseries.FrameDesign.BRASS,
 knobStyle: steelseries.KnobStyle.BRASS,
         pointerType: steelseries.PointerType.TYPE6,
         lcdDecimals: 0,
                  section: null,
                  area: null,
                  titleString: 'Outside Temp',
                  unitString: '°F',
                  threshold: 100,
                  lcdVisible: true
                  });


  // Start the gauge update
setInterval(function(){
            var site = "http://api.pachube.com/v2/feeds/9511.json?&key=GtGuoMKJSqv2tzqGvWaITLhlEDUxrYXSixqPSmlyj-s&&datastreams=7";
//alert('going for ' + site);
$.ajax({
    type: 'GET',
    url: site,
    dataType: 'json',
cache: false,
data: {},
processData: true,
    async: false, // you have to have this so the data will arrive before display
    success: function(data_archive) {
  //alert("the url returned success");
//alert("got back " + data_archive.datastreams[0].current_value);
                        tempGauge.setValueAnimated(eval(data_archive.datastreams[0].current_value));
},
error: function(a){
//alert("here I am in the error routine");
}
});
//alert('after the get');
}, 10000);
}
</script>

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type=text/javascript src=http://dl.dropbox.com/u/128855213/SteelSeries/tween-min.js></script>
<script type=text/javascript src=http://dl.dropbox.com/u/128855213/SteelSeries/steelseries-min.js></script>


There's too much up there to try and explain each item; this blog post would go on forever.  However, there's lots of documentation on the web that can explain what I did and the SteelSeries library has enough in it to get you started there.

Good luck and have fun with it.  I'll be showing how I use the Google Graph API in an upcoming post as well.

Wednesday, June 26, 2013

Back to the Swimming Pool Acid Pump

A couple of folk have sent me notes pointing out that I have spent more money and time on the Acid Pump <link> than is justified.  They're right.  Totally, absolutely right.  That doesn't change the fact that I'm going to continue this project until I finally get a nice working device that maintains the Ph of my pool with minimal human intervention.  Yes, it's cost me more time than just pouring acid from a jug into the pool every few days and more money than many, many gallon jugs of acid.  But that's not the point to automating a house.

The latest problem is a failed check valve.  Originally, I had a problem finding a check valve that was acid resistant and had a pipe fitting on one end and a tubing barb on the other.  I finally got one from the people that supply the pump I'm currently using.  It has been in service for the last year and did a good job.  However, when I replaced the tubing as part of my twice yearly maintenance, the valve stuck and wouldn't open.  I had a spare and installed it to get things going but I wanted to know what went wrong.  This is the valve I'm talking about:

 Notice that the two ends seem to be removable.  Turns out they are.  That's how this manufacturer designed maximum versatility into the device.  You can specify the end pieces to any configuration you need (within reason).  That way special purpose valves can easily be created.  So, being the curious monkey I am, I took it apart to see what was wrong:
Notice it's a basic ball valve complete with a spring that is a simple effective design.  What happened in this case was the black seal failed in the acid and the black debris in the picture is parts of it that plugged up the ball mechanism.  The material is Viton, which has a high resistance to acid, but apparently, not enough for prolonged exposure in the hot desert sun.  Not a big problem, just keep a couple on hand and replace them each year to be sure they hold up over time. I can live with that since every other valve I tried died in less than a month.

The problem came when I tried to get a replacement.  There were lots of them out there in the marketplace, but suppliers wanted between $17 and $50 for these little plastic parts.  Frankly, that ridiculous.  I called the manufacturer and asked for advice.  A nice lady there found me the industrial number of the same device and a supplier of their valves in Colorado that I could call.  I called him and ordered six of them because that's all he had in stock.  The cost was $8.60 each, and the shipping was around $10.  Quite a savings going the industrial part route instead of a swimming pool repair part.  Especially since the swimming pool suppliers wanted from $15 to $18 for shipping and handling to get them to me.

Basically, I got six of the valves for the price of one of them as a swimming pool repair part.  That makes treating it as an expendable part reasonable.  So, now each year I replace the tubing with tubing I get from Home Depot, a piece of Tygon tubing that I order in five foot lengths, and a check valve I buy from this supplier.  Sure, that's a bunch of stuff to remember, but just write down in a book somewhere the part numbers and suppliers and there shouldn't be any problem, and I won't have to pay more than twice what it's worth.

When I get the new ones in I may sacrifice one of them to see what the Viton seal looks like and how it fits in place.  It may be possible to get a Viton seal and just replace it as a maintenance part.  There are places out there that make Viton and even Teflon seals and washers; it could be possible to build up a replacement that will last even longer, or be easily repaired.

I'm starting to understand why so many people buy from Chinese suppliers.

Tuesday, June 11, 2013

Power Washer - Frustration in Action

I've talked to my various neighbors and some other folks around my parts about power washers and they all agree, unless you get an expensive commercial or prosumer version, they fall apart too easily.  All but one of my neighbors have trouble with the basic consumer models for a number of reasons.  1. the stupid bayonet fittings wear out and start to leak.  2. hose connection to the washer leaks.  3. leave them out in the desert sun and the plastic lances get brittle and break.  4. the plastic nozzles wear out in a few months.  5. Hoses are stiff and hard to use.  We all like the electric models because of the small engine problems.  If you don't use a gasoline engine often, they develop problems and won't work when you need them.  Electric washers just work and give little trouble with the motor and pump.

Even with all the disadvantages, the $100 price tag (on sale) makes them too attractive to turn down if you need one, and in the desert with limited water, you need one.  For the past years I've bought one every two years because of the various problems.  Then I decided to just replace the various parts as they broke to see if it would save money.  It didn't.

The replacement lances don't fit well and fall apart faster than the factory original.  Even if you change brands, they are pure junk and work until you get about half way through a job then fall apart.  I had one turbo nozzle replacement blow apart the first time I turned the washer on.  Basically, the various manufacturers supply shoddy devices.

Notice how I keep running into this?  I know I'm not alone, but many people just put up with it or give up and hunt for some other solution to whatever device fails them.

I decided to see if I could overcome this problem.  Since most of the problems are with the lances and nozzles, suppose I got a good lance and put it on the washer?  The good lances are metal (brass and stainless), cost about the same as the factory replacement plastic, and are tough as nails.  So, after much research, I discovered that most power washers have a common fitting: an M22 female.  That means I can get a hose, pressure trigger (the gun part), extension and nozzle to replace the junk the manufacturers provide.  Since the lance and hose will last essentially forever, I should be able to move it from one washer to another as I wear the motors and pumps out.  The motors and pumps are too expensive to replace, cheaper to buy a new washer on sale and toss the old one; along with the junk plastic bayonet connected lances.  Here's the lance that blew apart the first time I tried it:
There are screw fittings on each end of the extension that you screw one of the various adapters on to match your existing pressure trigger and the turbo nozzle (big thing in the picture) screws into the other end.  In my experience, each connection leaked.  Yes, all of them.  The threads are plastic and not cast well so they leak a small amount, and the bayonet fittings almost match the device, but the small difference causes leaks.  When I put it together and attached it to my washer, the entire front of the turbo nozzle blew off across the yard.  Clearly, this device is not made to be used, just sold to unsuspecting folk like me.  And, no, it isn't because my power washer is to strong for this tool; I currently have a Powerwasher Weekender (google it) that I picked up for less than $100 at Home Depot on sale and it only gets up to around 1800 pounds on a good day.  Its one of those low pressure machines for consumer use.  Ever notice how they call us consumers?  It's like we don't contribute to society at all; we're just here to buy their somewhat inferior devices.  

A little searching on line and talking to a guy that has a huge commercial power washer, I thought I had a solution.  I'd buy a mid grade setup for everything from the connection on the washer to the nozzle on the end.  Then over time I may change the washer several times, but the hose, lance, and nozzle would work for many years.
This is the hose, pressure trigger, and extension.  Notice that the extension is stainless and has brass fittings on each end; they won't die in the sun or break if you drop them.  The pressure trigger (gun looking thing) is stainless and brass inside with a heavy plastic covering to keep hot water from burning you.  The hose has M22 fittings on both ends that mate to both the pressure trigger and the washer.  The really cool thing is that the extension has a 1/4 inch quick connect fitting on one end so nozzles can be changed easily.  That means I can get something like this:
These have various spray widths, from a stream (the red one) up to a nice wide fan.  No, I didn't have something like this before; isn't it great that now I can?  These have 1/4 quick connect fittings so they can be changed easily depending on what I want to do and can handle exceptionally heavy use.  Now, all I need is a good turbo nozzle for those hard to wash things like wheels and muddy bumpers on Jeeps.
This is the turbo nozzle I chose.  It is brass with a tough plastic covering to protect whatever you bump it into when working with it.  Notice the 1/4 inch quick connect?  Easy to change like the other nozzles.  Now, just because it would be really cool, I wanted some way to inject detergent into the high pressure spray so I could actually clean something.  It would also be good for bleach mixtures to clean off the mold from fences and maybe some other chemicals that might be useful.

This is a soap injector nozzle.  You drop one end in a soap bucket and put the other one on the end of the extension (yes, it has 1/4 inch quick connect fittings).  Using this you can wash away grease from your tractor transmission to find that stupid oil leak that's been bugging you for years.

So, everything except the turbo nozzle and the soap injector came in and I couldn't wait to try it out.  I assembled the hose, pressure trigger, and a fan nozzle and hooked it up to the little Powerwasher Weekender I have and away I went.

IT FREAKING LEAKED !!

Right where the M22 fitting entered the power washer, there was a constant stream of water that caused the washer to cycle.  This was really annoying, so I put the old hose back and it didn't leak.  Fine, what the heck is different?  It seems that the Powerwasher output fitting is .05 bigger than the specs for an M22 fitting.  This means that the thing will leak just enough to drive you nuts over time.  Since the M22 fitting has an o-ring to seal it, maybe if I changed the o-ring?  Nope, that didn't work, it was just too small, it would take a special o-ring that had a larger outside diameter while maintaining the internal size.  I could spend a month trying to find one and probably order a dozen wrong ones first or figure out something else.

I tried wrapping the male M22 fitting with teflon tape, but that was a waste of time because it just leaked around the tape.  I though about dragging out the epoxy and stuffing it full to seal it, but that would defeat the purpose I set out for.  I finally beat it a few minutes ago with a really simple trick.  The M22 fitting looks like this:
Notice the o-ring around the center?  That's the o-ring that I thought about changing to make it work, but I wanted to try something.  I took the o-ring out and wrapped teflon tape around the slot where the o-ring sets making it a little larger.  The idea is to stretch the o-ring out and  make it seal the fitting that is too large on the  Powerwasher Weekender that I have.  When I put the o-ring back on and greased it with a little o-ring lube that I keep around for the pool and acid pump, it was definitely larger.  I wiggled it a bit and made it fit into the fitting and tightened down the plastic covered nut.  It worked.  Full pressure and no leaks at all; I can drag it around the yard and bang it and it does fine.  You folks reading this, try this the next time you need a new o-ring but don't want to go to the store right now to get one; this little trick could hold you for several days until you can get a new one.  Obviously, some engineer decided that he would design a fitting that was almost to spec, but enough off to force us to buy a new washer because we couldn't make it work.  This kind of crap is what industry standards are designed to prevent.  But, we're just 'consumers' we don't count.

So, now I have a hose and lance assembly that I can change tips on easily, inject detergent, and turbo wash to my heart's content.  Even after the Powerwasher company put a non-standard fitting on their product just to mess up people that want to do what I did.

Take THAT Powerwasher.


Friday, May 31, 2013

The Minute You Turn Your Back

Last weekend I noticed an odd increase in power that shouldn't have happened.  Then, it happened again a couple of days ago.  Here's the graph:


Notice the two humps in the red graph, one around 12PM and the other at 2PM.  These shouldn't be there because all the heavy power using devices have been shut down during the afternoon peak usage period.

As I described on my Power Usage page <link>, this could easily drive my bill up by a hundred dollars or so.  Needless to say, I was concerned and started checking every appliance in the house to see if it could have come on during this period.  The length and duration looked suspiciously like the water heater assist coil could have been activated, but everything on that device checked out OK.

I scratched my head for a while and noticed that this was a recurring event during the heat of the day.  Here's a graph of the next day showing a few of the same kind of thing.


So, I went outside, looked at the meter for the demand level to see what I might have to pay come bill time and the peak level was at 1.5 kW, not the 3kW or so I expected.  This means that the humps in power usage aren't real, they're some kind of artifact of the power reading process.

Voltages checked out, things seemed ok until I flipped off the GFI that supplies the power monitor <link> and it wouldn't come back on when I tried.  A ton of troubleshooting later which included having to climb up on a ladder and disconnect the garage door opener and a partial dismantling of the mains box, I found the problem.

See, there were several problem that have been going on that I thought were unrelated.  The GFI I mentioned failed a week ago and seemed to be fine after I replaced it,  the freezer in my kitchen has had a problem with the interior lights flashing erratically when the door is open, electric tools in the garage have strangely shut off, and the garage light (on the door opener) comes on sometimes for no reason.  This phantom power usage indication was what got me off my butt and looking for the problem.

It was an arching circuit breaker in the mains panel.  These things can be easily removed and have a slide on connector to the power buss inside the panel.  Since my panel is full, I have a number of double breakers where two half size breakers can take the place of one full size.  One of these was arching where it connects to the power buss.  Here's the breaker that failed:


And here's a close up of the connection that was giving me the problem:


If you look closely there is charring on the spring connector in the slot.  There was charring on the post in the power panel as well. Replacing the breaker corrected the problem and all the other strange things inside the house settled right down.

OK, here's the disclaimer:  There's enough power inside the mains box to kill you, so if you're the least bit uncomfortable, don't mess with it; leave it to someone that thinks they're qualified to work on this.  Me, I took it apart without a second thought, but that's just me.

What was happening was that the connection was loosening when the heat inside the panel rose during the heat of the day.  That side of the house is in the direct afternoon desert sun and gets really hot; you can't put your hand on the panel in the heat of the day without gloves.  All the equipment is rated for this since I live in the desert, but the environment takes its toll over time, so this kind of thing can happen.

The loose connection arched, got some carbon deposits that caused it to arch some more, and created enough noise on the power lines that it drove the sensitive electronics of the power monitor nuts.  It also caused the lights to flicker in my freezer because the second switch on the breaker was hooked to the freezer in the kitchen.  My garage door and the GFI that failed are fed from the same circuit the power monitor is plugged into.  This little two circuit breaker was driving my house electronics crazy.

The really good thing about this is that the problem showed up as a bad reading on the power monitor.  This was before the breaker failed completely and shut down a critical part of my house...my freezer.  If I had been away and the thing failed, I would have lost the contents of my freezer and had a mess to clean up.  See, there's another good reason to automate and monitor my house.

So, if you have strange flickering lights, GFIs that don't work right, and garage doors that behave strangely, it may not be ghosts.

Friday, April 19, 2013

Pool Controller 2 for Goldline P4

No, I didn't take a month off; I've been off on other projects that aren't technical or related to power.  Stuff like fixing a chip in my motorcycle paint, equipping toy hauler to tow it, and spring pruning.  But, I started having some trouble with the transmissions from my pool controller.  I have a whole section on my swimming pool page <link> where I describe how I decoded the Goldline protocol and built a controller for my swimming pool.  Yes, there are remote controllers out there that allow you to change settings and such from the house, but mine hooks into the House Controller and allows me to change things from the internet.  Yes, I can turn my pool motor on from anywhere.

However, as I described, there are some problems.  First, it's based on an Arduino Uno which only has one serial port.  I need at least two, one for the XBee to transmit status and the other for the RS485 link to the Goldline pool controller.  It would be nice to have another one for debugging and testing commands as well.   I used SoftwareSerial code to handle the extra port needs, but there's the occasional over run and I'm really running the little Arduino on the edge with two high speed ports cranking away all the time.  Guess what, I have a Mega2560 that isn't doing anything.

So, I pulled the device off the fence and rebuilt it essentially from scratch.  I put the XBee on Serial3, the pool controller on Serial2, and use the regular Serial as my command and debugging port.  This is all possible because the watchdog timer and boot loader problems have been fixed as I detailed in several posts, and I discovered a new enclosure that I have already used on my Garage Controller <link> that gives me plenty of room and easy access.

Since it was going on a Mega2560, there would have to be software changes.  I decided to take the time to incorporate all that I've learned over the last couple of years and update the XBee and timer handling.  The device now uses the Arduino XBee library and is in API mode so the packets are handled well.  It knows what time it is by catching the House Clock <link> transmission, so it's possible to build in specific time of day alarms or do special things on the weekends.  There's room in memory and in the enclosure to incorporate the Acid Pump timer as well, freeing up a device.  I will also be able to hook in the float I installed in my septic tank so it can alarm when the tank filter gets clogged <link>.  Of course, it will be more than a Pool controller then, but what's in a name?  Besides, a septic tank is sort of a pool ... isn't it?

Here's a picture of the device after I mounted the boards into the enclosure:


And here it is on the fence working:

Here's the devices on that side of the house:

No, I didn't mount it crooked, the fence goes down hill at that point.

Naturally, I'll post the code on the Swimming Pool page, but I'll get to that in a day or two because I have to change a lot of stuff to illustrate it the way I want to.

Why aren't more people doing this kind of thing around their house?

Edit:  I had to turn off comments on this page...  Darn bots from all over were flooding this particular page with crap.  Don't ever have a page with a title line that has 'Gold" in it.

Monday, March 4, 2013

Water Heater and Solid State Relays Part 2


Part 1 of this is here <link>

I wandered out into the garage to admire my new SSR controlled water heater and noticed that the indicator led was on.  It was during the period when the water heater should have been turned off and that can't be allowed to happen.  I drug out the ladder, voltmeter, and screwdriver and dug into it.  There was no power getting to the SSR control circuit, so it shouldn't have been on, but the indicator led showed there was voltage on the output.  Sure enough, there was a little over 100V on the output.  Could this brand new SSR have failed already?  Fortunately, everything was fine.  I just didn't read enough about the devices.  They have transient suppression on them that is built right into the module.  This transient suppression will allow a little voltage to be seen on an open circuit.  So, the water heater had shut off by opening the switch that operates the heating element.  The SSR was off, but the suppression circuitry was allowing a little voltage through.  Nothing to worry about, but how to test it to be sure?

See, strange readings and unexpected results often happen when you're dealing with 240VAC circuits that use power at 15 - 25 amps.  Leakage of a few milliamps is expected and allowed for in this kind of circuitry for various suppression techniques.  The relay that used to do this job was a real mechanical open circuit, not a semiconductor.

Testing turned out to be simple; just drain enough hot water out of the tank to kick the mechanical heater switch, and then measure the voltage while the SSR was off.  Sure enough, when the element switch closed, the voltage on the output dropped to virtually nothing.  Everything was actually fine.  The little led indicator just doesn't draw enough current to suck it down to zero and will continue to glow.  I also noticed that the led was dim when the SSR was off and bright when the SSR allowed current through.  It's hard to tell the difference between the two levels, and I may look into the indicator at some point and see about correcting this.  It may just need a resistor in line or something.

No, I didn't waste the hot water.  I needed a bath anyway.

Saturday, March 2, 2013

Water Heater and Solid State Relays

A few times I mentioned the solar water heater I have.  It works great and keep me in free hot water most of the time.  Yes, it's the desert and during the summer the coldest the water gets is lukewarm, but I get 140F water out of the heater for zero continuing expense except for the few days where it is overcast.

Those overcast days present a problem.  A couple of times I turned the power on to the water heater and used the helper coil to heat the water because the sun just didn't come out.  Once, it pushed my power bill up because an X10 controller didn't react to the turn off command.  This prompted me to hook the water heater power to the garage controller I have.  This worked fine.  I'm able to send an XBee signal and turn on the water heater.  I also have code in the garage controller that shuts the heater down during peak periods. It's working really great except...

The contactor I have started to buzz.  It works fine, but there is a constant 60Hz buzz coming from it any time it's on.  The first time I heard it, I had to hunt for a while to figure out what it was.  Then, as the days went by, it got more and more annoying.  For those of you that have no idea what a contactor is, here's a picture of the one I have.


They're really nothing much more than a really big relay.  They have specially built contacts to survive high current switching and lots of places to hook wires.  They are probably all over your house and you don't know it.  Appliances have them, some fireplaces, environmental heating, etc.  Most of them run on a 24V coil and last a really long time.  In my particular case, I used a 110V coil because I was originally switching it with an X10 appliance module.  Unfortunately, the 110V units tend to make noise as they age.  They're not wearing out, they just start to rattle at 60Hz and drive you nuts.  There is a solution, use a solid state relay instead.

So, I got online and started looking for an SSR that could handle 25A at 240VAC.  There's a lot of them out there, but I need two of them, one for each leg of the power.  That made converting expensive, but I kept looking and found a SSR for 240 VAC three phase.  This gives me three of them in a package and I only have to use two of them.  I don't know if I'll ever need the spare, but it's there if I need it.  Here's the device I bought:


Notice that is has inputs for three circuits and one control for all of them.  This is exactly what I wanted.  So, when it came in, I took the entire control assembly off the wall and rebuilt it essentially from scratch.  Here's what it looks like on the wall:



Simple isn't it?  Just one device with the control signal coming in the top and hooking up on the left side.  It only takes a little over 4VDC to turn it on and it doesn't make any noise at all.  Since there are no contacts, it should last forever just sitting there working it's little heart out.  

I probably should have used one of these to begin with, but I didn't have a clue XBees even existed when I started out on these projects.  I was convinced by the advertising and various articles on the web that X10 would do the job.  

It's sad that I was that naive.

The followup to this posting is here <link>.