Friday, June 2, 2017

My Well, A Parody of Problems Part 4 (Plumbing)

Now, I'm going to talk about the plumbing on the well. Let's start off with something that was simply annoying. Every well needs a vent; you have to let some air in when you take the water out. Around here, it's a simple curved pipe with a screen on the end of it that screws into the well head. Here's a picture of the one that used to be on my well:


To get it off and have access to pour disinfectant into the well, I had to unscrew this thing. Notice what happens when you turn it counter clockwise to remove it? Yes, it slams into the well controller and won't go any further. I could remove the well controller and run the risk of losing the bottom pump wiring down the well, or cut the darn vent pipe. I went and got the reciprocating saw and cut it in half. Terrible waste of a $20 piece of specialized pipe, but I wasn't willing to pull the controller.

When I replaced it I just used some PVC pipe shaped into an inverted 'J' with a hose screen stuffed into the end.


Notice I made it plenty long enough to get off, I also put threaded fittings in the middle so I can unscrew the top and stick in a funnel for pouring disinfectant down the well. I wanted to put a faucet on the well head as well so I could pump disinfectant in a circle through the well and the perfect place to put it was to remove the pipe plug at the location labeled 'A' in the picture below:


But, of course, the pipe plug had merged at the atomic level with the tee fitting below it. I had a 36 inch pipe wrench in there and couldn't get it to budge. The problem with a wrench that large is the risk of actually breaking a pipe. I really, really didn't want to break a pipe, so I opted to change out the fitting at location B with a tee and put the faucet there. It worked out pretty nicely:


I used a union to connect the new fittings to the old pipe because you never know when you might have to service something here and I didn't want to have to dig it out at some really inconvenient time. Also, it's too tempting for someone that wants to hook up to the water to use that faucet for a hose which will let air into the system when the bottom pump isn't on. Also, if there isn't any water there because the bottom pump isn't on, they might start messing with stuff to get water. I really didn't want that, so I replaced the faucet with a piece of pipe for day to day use. If I want to use the faucet, I just unscrew the pipe and put the faucet in place.


Those two items were done now, so I turned the system on and immediately ran into problems. The pump was cavitating which means that it was sucking air somewhere. I tried the trick of Saran Wrap around the various fittings to try and find the leak and couldn't; it must be sucking air somewhere. Maybe the underground pipe got messed up somehow.

I went and got a shovel and started digging along the pipe that leads from the well head to the tank and found this:


Well, not exactly this. It wasn't cut and plugged when I found it. Someone had taken the easy way out again and just used a tee to connect to the bottom tank pipe to get the water from the well into the tank. That meant that the surface pump would suck from the well anytime the well pump happened to be on at the same time. That presents problems because it could suck air from the well, not the tank. It would also mean that the water from the well wouldn't have time to settle and sand could be shoved out the lines to the houses plugging things up.

Not only that, notice the concrete around the base of the elbow fitting? The pipes had been put in before the wall was built and they had covered the pipes with concrete. Since there was no 110 VAC at the well, I couldn't use my jack hammer, so I used a hammer and chisel to break up the concrete to expose enough of the fittings to work with. This picture is after I had removed the concrete and separated the line to the bottom of the tank from the well head.

Remember, this is our source of water and the surface jet pump was cavitating this whole time. I didn't stop to take pictures of the mess at first. After I plugged the tee fitting off, the surface pump forced the air out of the house line and stopped having trouble. The houses had water, albeit only as much as was in the tank since the open pipe led to the well. I was stuck finishing the job to get us back in service; no time to throw a fit and storm around. that would have to wait 'til later.

In retrospect, I should have realized there was a problem here. There was no pipe going into the holding tank at the top fitting. Remember this picture from a previous post:


It pretty obvious that there should have been a pipe going into the tank right where the white pipe plug is. There's even a pipe to direct the water down into the well.

I started digging a trench over to the well and kept hitting the pipe that led to the bottom of the tank, so it was a shallow trench. I don't feel a bit guilty about only digging a shallow trench; I was fighting what was already there. I got the trench in and installed a couple of 45 degree fittings:


Then I completed the water run over the existing tank top fitting to get the well head connected to the tank where it should have been for the last many years.


I turned on the well pump (actually, I twisted a couple of wires together) and gritted my teeth just in case, but it worked fine. The water came up, went through  the new pipe, and filled the tank. Everything was working again and water was restored. This time a bit more correctly than it had been in years.

Now, there was time to throw a fit and storm around. I took out my frustration of someone screwing up this simple step and covering it with concrete on the loose dirt as I put it back in the trench. It raised quite the dust cloud.

Notice that the ground is dry? After the first day of dealing with a muddy mess, I realized that hooking a water hose to the system allowed me to run the water without having it puddle up right where I was working. I could also stick the hose in the top of the well and save the water. I never had problems with leaks in the various pipes, I may have finally gained enough skill to join pipes correctly the first time, or maybe I just got lucky.

Probably should put some stepping stones over the barely covered pipes though.

End of part 4.


Wednesday, May 31, 2017

My Well, A Parody of Problems Part 3 (Wiring)

Part 1 of this series is here <link>

Now that I had the float setup, it was time to attack the rest of the wiring on the pump. Let's start off with a picture:


The connection box A is where the float connects at the left hand side, on the right is 220 VAC coming in from the main panel, and both go down the bottom conduit over to the pump controller box labeled B. The connection to the bottom pump is inside the controller box where the yellow wires are. Then there is a conduit to a box that is attached to two pipes coming out of the concrete labeled C. This piece of flexible weatherproof conduit literally bends around the well vent pipe and was actually crushed. I'll talk more about that vent pipe when I get to the plumbing fiasco. From box C a conduit runs to a pressure switch labeled D, continues through the switch to ANOTHER pressure switch on the lower right.

The pump controller (B in the picture above) is a pretty normal pump controller that has the start and run circuitry for the bottom pump. This is a normal configuration since you don't want the capacitors or relay several hundred feet below ground when they fail. Here's a down view of the controller circuitry:


Notice the the lamp cord actually travels into the controller on the lower end. When I had everything open, it was a bit frustrating because the main source of 220 for the bottom pump was carried through those wires. Motors don't like big voltage drops across the wiring, it tends to make them run hot.

The box labeled C above was a mystery. It had unterminated wires coming in from the bottom and a 220 pair from the controller that was wired around to the
first pressure switch.


After checking with the neighbors and reviewing the history of our houses, it turns out that those wires were from the original house on the land. There was only one house and the wires went up to the main panel on the house. There was no need for the wiring any longer, but it was still connected at that house. Someone just used the conduit path through the box for wires because it was too much work to move the conduit. Notice the cover on the lower right. This cover used to be on the box held carefully in place with duct tape that had rotted in the sun. There were no outlets under the cover even though there were outlet lids on the cover.

This has a bit of history to it. Once upon a time, when my house was being built, the contractors would sneak an extension cord down to the well and plug into an outlet that was in this box. The folk paying the bill got tired of that and removed the outlet. I guess they lost the screws and just grabbed some duct tape to hold things in place. Inside the box, on one of the active connections, I found this:


Yep, the wires had gotten hot. I pulled on the wires and one of the fell out. Let this be a lesson to you, make darn sure the wire nuts actually connect to all the wires. Eventually this would have arced enough to fail and I would have been out there, in the dark, probably when it was either super hot or raining, fixing this stupid connection. It wouldn't have caused a fire unless the dried and crumbling duct tape happened to catch. Just an annoyance.

Now, about the pressure switches. Notice I used the plural. There were two pressure switches in series on the system. One was attached to the surface pump and the other was fed water pressure by the house supply line. Why two? Isn't it obvious? The pumps often come with a pressure switch attached, but since the system already had one reading the house supply line, and it was too hard to remove one of them, they wired them in series. Jerks.

I call them jerks because the switch attached to the pump was completely burned out and wired together inside:


If you look closely you'll notice that one terminal set for the wiring is completely gone and the wires have been hooked together under the screws. When the extra pressure switch failed, they just used it as a connection point for the wiring. I actually remember when this happened. A random ant got into the switch and was crushed by the contacts. That left the smell of crushed, cooked ant for other ants to follow. The switch was filled with ants looking around, and in short order more of them got killed by the action of the switch. The formic acid in the ants ate the contacts and serious arcing destroyed the internals of the switch.

Yes, the guy in charge of the well called out a repairman, but the repairman took the easy way out. To actually remove that switch I had to clamp off the water feed tube (that black tube on the left of the pump), and put in a 1/4 inch pipe plug. How many of us have a 1/4 inch pipe plug in our junk box out in the garage? That was another trip to Home Depot; I'd already been there for a box to contain the connections that would replace the extra pressure switch.

Over a few days, I rewired almost every connection. I ran in a 110 VAC pair to power outlets for tools, took the conduit with the kink completely out, rerouted the wiring for the pressure switch (singular now) and put in new electrical boxes to handle all of it. Towards the end of the project I got a neighbor down to help pulling wires and another one came over to see what was going on and got enlisted to help. I made all the major connections in a box I put on the wall and ran 220 wire pairs down to the controller. Every single box has a ground leading back to the panel, something that was in short supply before. I also put in two 220 VAC switches to control the two pumps. This is a really nice feature when you need to work on part of the well. It was really nice having a couple of extra sets of hands during that part of the project.

For example, here's the electrical box I replaced the failed pressure switch with:


Over on the left is the box that is wired to one of the houses. It's closed off and labeled. I wrapped metal tape around the top of it because I didn't trust the seal on the box; a little extra sealing is never a bad thing out in the weather. Also, notice that there are a lot less conduits with circular wiring. In the top center is the pressure switch that runs the surface pump. It must have been a real problem trying to set the water pressure back when both pressure switches were active. One would interfere with the other and you wouldn't be able to tell which one was causing problems. Now, setting the single switch is simple.

Of course, I wasn't just working on the electrical, during this process I was also attacking some pretty serious screw ups in the plumbing.

That's in the next post.

Tuesday, May 30, 2017

My Well, A Parody of Problems Part 2 (Holding tank)

Part 1 to this project is here <link>

In part one I talked about replacing one of my well pressure tanks and discovering that there were some other problems that needed fixing. This is the continuation. I'm certain that the things wrong were not the result of incompetence, instead they are the result of having to fix something that HAS to be working. Often, we kludge something together to get it working, and then never get back to straightening out the problem completely. For example, right this second my Jeep has stop leak in the coolant. It was too hot to take apart and fix. I promise I'll get to it someday ...

One of the first things I noticed was that the holding tank float was set too low in the tank. This is usually an easy problem to fix, just take the top off the holding tank and pull the float up a little. You may have to adjust the weight or support of the float, but that's easy. It does take a little time though to get it right and you may be walking back and forth from the well over several days getting to the satisfactory setting. OR, wasting a bunch of  water dumping and refilling the tank. Not a very good solution.

I opened the tank up and took a close look at the float. First thing I noticed was that the wire on the float was taped. What? Why would anyone tape a wire that was suspended in water and carried 220 VAC through it? I was really careful with it and followed the wire to a piece of conduit that came through the side of the tank.

Think about this a minute, there was no box to connect the float, the wire from it ran directly into conduit. Following the conduit it led to a box on the wall surrounding the well. I opened the box and didn't see the wire from the float, instead there was a piece of 18 gauge stranded double cord in there. That's exactly the same wire that your bedside lamp would use. Hardly the right wire for a float switch that carries 10 amps of 220 VAC around a well.

OK, I admit it, I was a bit angry, so I ripped the conduit out of the ground, disconnected it from the holding tank and it broke in my hand. This is flexible conduit designed for wet conditions, it shouldn't break. Here's some pictures to help you understand:


This is the (supposedly flexible) conduit. Notice that it snapped in half in two places. Didn't take much force, I'm a little skinny guy.


This is looking down into one of the breaks. What I intended to do was pull the wire out and see what was going on; I couldn't. The wire had burned and the inside of the conduit was destroyed.


This is the other end of the wire. Notice the tiny lamp cord that is coming out the other end of the conduit?

What a mess. I took the entire conduit out, and once again, headed off to Home Depot for parts. After I got back, I installed a new conduit, put a box on the side of the well for connecting the float, and fished new wire from the origin to the box. Here's what the box on the tank looks like:


Sorry, the conduit was already buried when I took this picture. Let's look a little more closely at the float now.


The gray cylinder at the end of the wire is the actual float switch, the other cylinder at the right is the weight that holds it down in the water. Notice the shiny part of the wire near the center of the picture? That's electrical tape that hooks a replacement float to the old wire.

See, the problem is that no one was able to pull the wire out of the conduit, so they took the easy way out; they cut the wire and spliced in a new float. I'm not sure how long this has been going on, but the float has failed twice since I've been out here. No, I wasn't in charge of the well back then. Remember, this float switch carries 1.5 horsepower worth of current at 220 VAC; not a safe situation. I have to give credit to the last person that worked on this though. The tape has held up well and didn't leak. That person was good with tape.

Now, when you replace the float, you do it inside the box and wind up a little slack in there also in case you have to do some adjustments in the future.

The way this works is the weight holds the float at some level inside the well. When the water is low, the float hangs down a closes a switch inside to turn on the well bottom pump. As the pump fills the holding tank, the float rises and at some point, determined by the position of the weight, the float tilts and turns off the current. A very simple circuit that is used in wells all over the world. The water is drawn from the tank at the bottom by a jet pump on the surface and sent to the houses it serves. We'll get to the problems I had with that in a future post.

I still haven't replaced the float. I had to order it because it was much, much cheaper online than out in town. Also, the one that was in there was only for a single horsepower. That may be the reason the floats have failed in the past; they were under rated. Only time will tell, these things may fail faster than the other parts of the well.

Yes, I'm very, very careful with the float; water could get through the tape at any time, especially with me dragging it in and out of the well. No, I didn't open up the conduit to find the splice inside where it went from the float cord to the lamp cord. It just wasn't worth the time to hunt it down. Actually, to prevent my curiosity causing me to waste a bunch of time finding it, I threw the conduit away. I'm a little OCD about this kind of stuff and would have been cutting on the conduit for hours with a Dremel tool.

End of part two.

Monday, May 29, 2017

My Well, A Parody of Problems Part 1 (Pressure tank)

I've mentioned a few times that I live in a desert foothill region north of Phoenix, AZ, and I have a water well. Actually, I share the well with two neighbors. Recently we had a well inspection and two things turned up, one of the pressure tanks was 'waterlogged' and there was coliform in the water. Neither of these are earth shattering, just replace the pressure tank and treat the well and get on with life.

But ...

Man I hate it that every thing I get into has a 'but' in there somewhere. I went down to double check the fact that one of the pressure tanks had failed and used the technique that the inspector had used, tap on the side to see where the water level is. Frankly, that's crap. Tapping on the side sounded exactly the same to me at the top bottom and middle of the tank. Actually, all the tanks sounded the same at the top bottom and middle. I got on the phone and called a few companies that service wells to both, check the price of replacement and find out how to test the tank to see if it was bad.

Let's look at what a well pressure tank is. This is what they look like:

This is from Home Depot and appears a little shorter than it actually is. This thing has plumbing fittings on the bottom and a shrader valve on the top. Inside it has a rubber diaphragm designed to hold air above and water below. The idea is that you pressurize the top with air, and incoming water at the bottom will compress the air and give you a water pressure reserve to keep your pump from having to respond every time you rinse something off. Inside, it looks something like this:


Up on the top, under a black plastic cover is the schrader valve; that's where you check the air pressure. Since the inspector said the tank was waterlogged, if I pushed the little pin inside the schrader valve, I should get water out ... right?

No water came out of any tank and the air pressure read about the same as the water pressure on our water pressure gauge, 30 pounds. I didn't have any idea if a tank was bad or if the inspector was wrong. When I brought this up with one of the well contractors, he told me you have to turn off the water and check it, and that makes sense, but to drain the water from three pressure tanks not only makes a huge mess of mud to deal with, but also takes fifteen minutes or so.

I just gritted my teeth, turned the power to the system off and opened the faucet in the line and let the water drain. I got tired of waiting, pulled one of the pipes loose to hasten the process, and got drenched like everyone else that does this kind of thing, but finally I had the system at zero pounds. Now, check the air pressure on the three tanks, 28 pounds, 26 pounds, 0 pounds. Yep, one of the pressure tanks was bad; it has a hole in the bladder and won't hold air.

The inspector had said that his company could replace the pressure tank for $700, so I called a couple of other companies in the area and they all estimated about the same price for doing the work. Being a cheap sucker, I started pricing the tanks to see if it would save me money to replace it myself. A little while later I pulled up beside the well with a new pressure tank strapped on my trailer ready to do some plumbing. The pressure tank cost me less than $380 (taxes and all) at the local Home Depot.

It took some doing and a 36 inch pipe wrench backed up by a 24 inch pipe wrench to get the old tank out. This is one inch galvanized pipe with unions at each tank to make replacement somewhat easier, so it's tough to work with. Of course, putting the new one in was much easier since teflon tape makes the fittings go together pretty easily, but there were two more trips to Home Depot because you never, ever get the right fittings the first time. Things like the new pressure tank was a little wider than the old one, a galvanized elbow was rusted solid and I couldn't get it loose at all, the usual things that crop up when working with plumbing. This is why plumbers have bin after bin of fittings on their truck; you never know what you need until you start the job.

The new tank's installed, but now I have to check the air pressure on it. This is one of those things that the web will mislead you on. Most of the posts on this say to set the pressure on the tank a couple of pounds less than the water pressure is set for. Fine, what the heck is the water set for? I didn't check it closely enough to be able to estimate two pounds less; I just looked for the pressure to go up a ways, not exactly what the pressure was. Also, one of the gauges is a water pressure gauge, the other is an air pressure gauge, and those things are usually accurate to around 10%. At roughly sixty pounds, the inaccuracy could be as much as 12 pounds off between the two of them.

How the heck do you set the air pressure at 2 pounds less than something that can vary that much? Back on the phone, the most friendly well serviceman laughed out loud at me. "Set it for 28 pounds," was his answer. Seems he went through the same process back when he was starting out and experimented until he got a number that works well in most circumstances, 28 pounds. I set the air pressure at 28 pounds and cranked the system up.

Here's the new tank installed:


And, the old tank:


(The plan for the old tank is to use my plasma cutter, cut the tank in two, make a fire pit out of the bottom and a bell out of the top. No one realizes that it will be a HUGE wind chime someday. Don't tell the neighbors.)

No leaks, surface pump ran until the water pressure reached 60 pounds and shut off. Wow, I fixed the well and saved us close to $350. I wanted to be sure that everything else was OK though so I decided to cycle the system a bit and opened the various electrical boxes to see how to control the equipment.

There was a total mess of marginal and downright wrong connections, old wiring that was loose, and circuitry that circled back on itself for no apparent reason. There were even things that should have been power sockets, that had nothing under them and wires that were hot that didn't seem to go anywhere on the pump system and came from somewhere other than the main panel from the pump.

Crap ... this needed to be fixed. Over the years, various people had done repair work to the well as things failed, and apparently, they did the very least they had to do to get it working and never got back to fix it right. This just compounded the possible problems over time until I had a mess to fix for the community well.

Fine, lets fix the darn thing.

End of part 1.

Friday, December 30, 2016

More Adventures With My Freezer

Last post I described how I managed to screw up my freezer defrost controller <link>. This is the latest chapter in that escapade.

I started up Eagle and created a board to hold a higher power relay and XBee to overcome the problems with the small relays that are generally available for Arduinos. The board got overly complicated and the cost of the various parts got to the point where it was just silly to continue. Then I got a brainstorm: why not just use a relay board as a module similar to what I did with the XBee.

I started up Eagle again and took that tactic; it worked really well --- at least on paper. Here's the schematic I came up with:


For those of you that aren't used to Eagle schematics, each of the signal lines has a name and you just match up the names to see where things hook together. It makes for a really simple looking schematic that is a bit hard to follow. The idea is that the set of plugs on the right are the pins on an Arduino, the two modules in the middle are an XBee and a relay module that is readily available all over the place:
These little boards are available for less than $5.00 and can handle motors. It should be exactly what I need for this project. Where I ran into trouble was all the parts necessary to support one of the relays. Things like buffer transistors, optoisolators, LEDs and such are a real pain to keep stock of and you can't really order just a couple. I'd have parts piled all over the place if I tried to build up everything necessary; so I took the easy way out and just mounted the relay on a board I designed along with the pins for the temperature sensor, XBee, some lights and some buttons. Basically, my new board would be a holding device for the stuff I needed for this project.

Cool huh? This is the board layout I came up with:


I added some LEDs at the front of the board so I could see that it was alive at a glance, matched holes on the board to the holes on the relay module and added a couple of buttons to control reset and defrost for testing. Heck, I even put a Saguaro cactus on it as a kind of indicator that it was designed by me.

I sent the gerber files to Seeed Fusion because I haven't used them before. About 4 weeks later the boards arrived. I say boards because you get 10 of them for the same price, but the shipping was high. To offset the shipping I included the rest of the temperature sensors I need for my house monitoring project. So, for around $38 I got ten of the defrost controller boards and ten more of the room sensor boards for later.

Here's what the boards look like:


I chose yellow because I've never messed with a yellow board before. I labeled every stinking thing because I can't ever remember where stuff goes after a few weeks of not looking at it. I also stuck the LEDs on the front of the board so they could be seen by peeking through a vent area on the freezer. My way of showing off that I modified the freezer.

Here's the board assembled:


I pulled the screw connectors for the digital signals off the board and replaced them with pins so I could plug the relay module into the board. I bent the LEDs over for that day when I actually make an enclosure for the board. I used Arduino-like pins for connecting to an Arduino, but that was a mistake. Somehow I thought I might someday mount something above this board. Notice that's not possible. Oh well, they may serve as test points some day.

Here it is mounted to the Arduino:


Yep, it's bigger than the Arduino. I considered using one of the really tiny Arduino devices and just having a board that connects the various modules together, but decided to just use what I already had. It won't matter when I get it into an enclosure because only the wires going in and the LEDs will be visible.

I powered it up and everything worked first try. Amazing. I actually got something like this to work without another hitch.

Some tricks you can use if you decide to do something like this: Print the board on paper and try the various parts on the paper. This is how I managed to get the holes for mounting the relay module in the right spot. First I measured them as close as I could, then I printed the board and put the module on top of it to be sure the holes lined up correctly; they didn't. I was a tenth of an inch off. A little moving of stuff and they lined up perfectly. I did the same thing for the pins for the digital signals to the relay module also. I used the same technique to be sure the Arduino pins lined up as well. When I got the boards in I was almost afraid to try it out for real, but it worked perfectly.

Lining up something like this is a real pain, but using the printed version of the board takes almost all of the anxiety out of the process. Another trick is to label every thing in sight. The values of the components, the direction things point, which way a diode goes in, these are the things you forget while you wait for the board to arrive. Just label them in the silk screen so you don't have to wonder what goes in that hole and which way it points.

This is the third board I've had made for one of my projects and I think I'll do more over time. It's just too easy to mess up a tiny wire from one component to another and it makes the end result very fragile. The other thing I learned is just using the inexpensive components that are available to us for projects. I could use multiple relay modules like this in a project and have a board made to mount and wire all of them making the end result pretty and easier to work with. It should make troubleshooting easier as well; I won't have to follow a wire from place to place to see what went wrong.

Now to install it and watch it work for a while. I also have to figure out what to do with the other nine boards I don't really need.

Edit: After it was installed and tested once, it failed. Seems the relay wouldn't close; it got the signal to close just fine, but the relay just wouldn't activate. I chased the problem to the power line going from the wall wart to the Arduino, and changing that cord fixed the problem.

A lot of us have encountered this problem. We get a USB cable from somewhere and they use tiny wires that can't even carry a half amp three feet; it can drive you nuts trying to troubleshoot the problem because it looks just fine until you try to drive a relay or a set of LEDs. When you try and pull power, the voltage drop through the cable shuts things down.

Anyway, it's working just fine now and the stupid cable has been labeled so I'll know next time.

Sunday, December 4, 2016

Adventures With My Freezer (the one in the house)

Over the years I've been doing modifications to the freezer in my kitchen. It all started way back in 2014 when I decided to not only measure the power usage of this device <link>, but to also control when the defroster runs <link>.

A tiny bit of background for folk that haven't been following my silliness for very long: I'm trying to lower my electricity bills here in the Arizona desert, and have a power company that offers a lower rate during off hours. What I do is try to keep all my major usage in the non-peak hours, and having the defroster run whenever it wants to sometimes leads to defrosting in the middle of the peak period. Also, I bought this freezer because it is simple, really simple. There's no huge electronic package in there that is designed to save power, hook to the internet, take pictures, call my Mom, etc. It's just the basic freezer, albeit a high capability, and repairable model that looks really good.

I also added the ability to monitor the temperature inside the freezer <link> after my 'wonderful' defrost controller crapped out. While I was fixing that I decided to combine the two relays on the Arduino shield I was using to parallel the contacts, hoping to extend the life of the relays.

Don't ever do that !!

I totally forgot that doubling the number of components also doubles the possibility of failure, as well as doubling the ways they can fail. This is a great story of doing the wrong thing, so I'm going to teach you a bit about the defrost cycle on a freezer so you understand what I got myself into. Since I have the ability to chart the actual action of my freezer, you get to have real examples of my (seemingly infinite) ability to screw up.

This is what a normal defrost cycle looks like when you can observe both temperature and power usage.


Ignore point A, that's the icemaker running to dump ice in the tray, and the tiny bump next to it is the lights in there when I open the door.

Point B is the start of the defrost cycle, this happens on a timer that closed a SPDT set of contacts that shuts off the compressor and kicks on a heater that is actually attached to the evaporator at the bottom of my fridge.

Point C is where the heater is running, and it will run until a temperature sensor (also mounted on the evaporator) reaches a built-in temperature that the manufacturer thinks is the best to clear the frost away. In my particular case this thermostat is 37F.

Point D is where the heater shut off and the freezer just sits there until the timer runs out after 30 minutes. This is to allow the water to drain out the bottom into an evaporation tray and away from the freezing area of the freezer.

Point E is where the compressor kicks back on, the spike is the usual one you get from the run capacitor letting a lot of power through to get things going.

Point F is the normal compressor run cycle. It runs until the Freezer gets to operating temperature and then shuts off. On freezers the compressor runs a long time, but that's OK because these things only use around 100W. In the days before LED lights in appliances, the lights used a lot more power than the compressor did.

So, the heater pulls around 400W, but should only run for around 15 minutes, however once in a while it because of high local humidity, someone holding the door open too long, trying to freeze a gallon of hot water, or something like that, the heater will run the entire 30 minute cycle time. When this happens, the next defrost cycle will take care of the left over buildup.

Unless something is broken, or you've got someone in the house that messed things up.

I noticed that the temperature in my freezer was gradually rising and the compressor seemed to be running too long. Here's a chart of what I saw when I looked at it:


Once again, the sharp peaks are the icemaker doing its thing, but let me step through the other parts I pointed out:

A is where the defrost heater started. This part appears perfectly normal.

B is where the defrost heater should have leveled off at around 400 watts. Notice it's up around six hundred and climbs after that.

C is the defrost heater shutting off after the full thirty minutes of time allowed by the timer. It didn't shut off early and coast.

D the big spike of power should have shown up, it didn't. The spike there is the ice maker dumping ice.

What was happening? After a bunch of troubleshooting and scratching of my head, I figured it out; one of the relays had a frozen up contact and the compressor was running during the defrost cycle. The other relay was working just fine, but it couldn't stop the compressor with the other one bad.

I gutted the relays to double check (sorry I forgot to get a picture) and one of them had the contacts welded together and was the culprit in this mystery. I pulled it loose and let it go. About two days later, the remaining relay gave up the ghost as well. So much for those relays. I've got my eyes on one of the 30 amp relays now and have an order off for a circuit board that will hold it and an XBEE in my own designed Arduino shield.

Yes, I feel a bit stupid. But, isn't the ability to chart the performance of my freezer cool? Looking at the database of freezer data I was able to tell exactly which day it happened and how much the temperature rose over time as the defroster competed unsuccessfully with the compressor. Even the fancy internet connected freezers can't do that.

Right now, the freezer has the old mechanical defrost control in it that has had to be replaced twice because the mechanical clock in it doesn't hold up over time, and the defroster turns on whenever it feels like it. I had to get out the heat gun and melt the frost off of the evaporator by hand to give it a head start, that wasn't hard, but it did let the ice cream get soft.

More later, I'm not giving up on this.


Friday, December 2, 2016

Amazon Dot: Oops, Forgot Something

Just when I thought I could put this series of posts on the Amazon Dot and using it at my house aside for a while, I realized I forgot something last time <link>. I didn't show what a session with the example code I gave you last time looked like and what it was doing. So:

pi@housemonitor:~/src/alexa$ alexaIllustration.py
did the connect to AWSIoT
mqtt loop started
Alexa Handling started
mqtt connection to AWSIoT returned result: 0
Variable states:  79.1 1234.5 on
On Tick:  { "state" : { "reported": {"temp": "79", "barometer": "1235", "eastPatioLight": "on", "lastEntry": "isHere" } } }
Variable states:  79.1 1234.5 on
On Tick:  { "state" : { "reported": {"temp": "79", "barometer": "1235", "eastPatioLight": "on", "lastEntry": "isHere" } } }
{ u'eastPatioLight': u'off'}
got a delta
{ u'eastPatioLight': u'off'}
got command for east patio light:  off
Variable states:  79.1 1234.5 off
On Tick:  { "state" : { "reported": {"temp": "79", "barometer": "1235", "eastPatioLight": "off", "lastEntry": "isHere" } } }
{ u'eastPatioLight': u'off'}
found left over desire at eastPatioLight
sending: { "state" : { "desired": {"eastPatioLight": null} } }
Variable states:  79.1 1234.5 off
On Tick:  { "state" : { "reported": {"temp": "79", "barometer": "1235", "eastPatioLight": "off", "lastEntry": "isHere" } } }


Above is a session where I start the process and give it a command. The first thing that happens is that a connection to AWSIot is established. This is really a normal ol' mqtt connect, and then an mqtt loop is started. This is an asynchronous loop that will return control back to the code so other things can be done.

When the connection calls back the code subscribes to the two topics and prints the connection message, "mqtt connection to AWSIoT returned result: 0." This means that we are all set up and ready to receive messages from Amazon. I printed the starting state of the variables next and the interesting one is the eastPatioLight which I initialized to 'on'.

The 'On Tick' messages are the reports we're sending up to Amazon. I have this set up for every ten seconds so we don't have to wait long to see something. Scan down a bit and look for, "got a delta," because that is the point where a command came in from Amazon. In this case it's a command to turn the eastPatioLight off.

The next 'On Tick' message says that the light is now 'off' and should change the Shadow document to reflect that. Then, the code sees another delta message and checks to see if it has already been satisfied and decides that it's simply a leftover desire and sends back a JSON string:

{ "desired": {"eastPatioLight": null} } }

This will remove the desired entry from the Shadow and therefore, the delta message will stop.

And it's done. The variable has been changed to 'off' and if you had code there to turn off your lights, so would be the light.

After you work with the interaction a bit, it will all make sense and will be MUCH easier to modify for your particular use and add stuff to.

Have fun.