Friday, October 25, 2019

Naturally, Blogger Changed Something

Of course blogger changed how the blog appears ! That led to a mess of my background image tileing and messing things up in the appearance. After some messing around I managed to get it appearing somewhat reasonable, but had to change the background picture. I've used the same one for years and years now, but so be it; I can update with the times ... sort of.

I kind of like the look, and will stay with it for while, or until google gets a bug up their butt and changes things again.

Yes, I'm still alive. I haven't been blogging because I got myself involved with local politics and have been up to my ears in that effort for many months. I do get in a technical project once in a while, but haven't had the time to write them up.

I'll put them on the blog at some point, since they may be interesting to some people out there. Here's a quick list off the top of my head of the things I've been into that haven't surfaced here yet.

1. A horrible problem with my XBee network. My end devices would leave the network and not rejoin. That meant that some of the critical ones that controlled the AIR CONDITIONING didn't update the thermostats that control the temperature. Hot house or cold house depending on where it quit working. The thermostats protected me against using power during the Peak period, so the power bill didn't get out of hand, however it was painful to deal with. I have it mostly fixed, there's still one strangeness that I have to work on to get everything back to working reliably though.

2. I still have the parts for monitoring my 220V devices piled up with an enclosure, and haven't done anything else with them. They stare at me mournfully each time I walk through the garage. I'll get to them as soon as I can. To see that project's beginnings look here <link>.

3. Stumbled across a really cool phone from the crank-to-call days. I fully plan to put this thing in service. I may have to update a few parts, but maybe I can hide them inside. There's a lot of these out there, so I'm not going to worry much about the value afterwards, but I do want to keep it as original as possible. Here's some pictures of the phone; notice it has a BRASS earpiece !

It's an Australian model, but the parts are easily found to update it. This phone was updated over the years that it was in service. The crank was disconnected and the handle lost (or taken by the phone guy that did the work) the earpiece and mouthpiece elements were changed and finally the dial was added. It is really fun to play around with. I hope I can get the ringer to work; that would be great.

Might want a switch though.

3. Stupid AcuRite 5n1 weather station channel A died. Now I have to set it up for channel C since I that's the only way it will work. Sigh, don't happen to know what the frequency is for channel C would you? If you want to look at this project, it's all under 'Weather' in the list on the right side top of the page.

4. The battery life of my XBee end device temperature sensors has been a little over 5 months consistently. That's not as much as I calculated, but it's still pretty good. I'm getting tired of buying AA cells though. They're not expensive, but when you have a half dozen devices that run on three of them each, it can get annoying replacing them. I always seem to be out of the darn things.

So, I'm looking at those Li-Ion cells that sell pretty cheaply on Amazon. They seem to last forever, have close to 4 VDC output when full and are really fast to recharge. I have a bunch that I use in flashlights around the house and one installed in a sensor being tested (for months, these things take time). I suspect I'll be switching over to them on all the battery devices; they're just great since you can always have one charged up for replacement and don't have to run to Walmart because the AC crapped out.

And Etc. See, I'm still at it, just don't have the time to gather the graphs, pictures, measurements and such that it takes to make a coherent blog post about these things.

But, like the Terminator, "I'll be back."

Friday, March 1, 2019

I Finally Gave Up On My Hayward Variable Speed Pool Pump.

Several times over the years I've mentioned my Hayward Variable Speed Pump. When I got it, it was a dream come true. Here was something that could filter my pool and save me money doing it. I could control the speed and pretty much design my pool filtering around the power company's lowest rate requirements.
But, right off the bat, it failed. Hayward fixed it and all was well with the world. Then, it failed again. Hayward fixed it again. Then, you guessed it, it failed again. This time Hayward told me it was out of warranty and would cost me $550 to get the new 'drive' unit. I bought one, but from a supplier on ebay because I didn't want to pay the required installation fee they wanted to hook up the wires that replacement would require. I'm perfectly fine with hooking up wires.

It failed again a few days ago. At that particular time it was actually snowing here in the Arizona desert. Surprisingly, we had about four inches of snow on the ground that morning. No, it wasn't frozen, I checked and the darn thing failed before the temperature dropped below freezing. Remember, I record the power usage of the house and monitor the status of the pool as well. The way I discovered the pump had failed was noticing a thin layer of ice on the pool. That has never happened because the no freeze controls on the pool keep the water moving.

Looking at it, there was an error message, "Motor Stalled". I actually believed that message and took the pump loose from the plumbing (yes, in the snow) and turned the impeller. The motor was not frozen. It did cog a bit from the magnets, but it turned freely. Next, I pulled the wiring loose and took it to the patio table (out of the snow) and pulled it further apart. There was nothing mechanically wrong. Fine, look on the internet.

There was story after story about this pump. "Drive Error," and "Motor Stalled" were the two that most often occurred. I asked around, and a friend recommended a place that specialized in pool pumps. I called them. and they were very nice to me, consoling me on the problems with that pump, but didn't offer much in the way of suggestions other than replacing the electronics for $650 plus a small labor charge.


I asked about just replacing the dog gone thing. For a little over $500 I could get a 2.6 HP two speed pump motor installed on the existing impeller housing. Really? You can do that? Yes. I'll be down tomorrow morning. Here's the pieces sitting on the garage floor waiting for me to do something else to it:

I loaded up the Hayward VSP pieces into the Jeep and took it in. True to their word, they fitted the motor to the impeller housing and replaced all the gaskets and worn parts as well. These folk actually did it while I waited, and I got to talk to several people that came in for various problems and parts. 

I noticed on their outgoing shelf waiting for pickup were three pumps just like mine. All of them waiting for pickup after having some similar problem. Of course the "doctor" analogy applies. I'm at a doctor's office so everyone I see is sick, but it certainly made me feel better because, "Misery loves Company."

Here's what it looks like with the old impeller housing and new motor.

I'm sure someone wants to know what the motor is, so here's a picture of the label on the side of the motor. Thinking about it, I need to put clear packing tape over that so I'll be able to read it in a year or two.

And, here are the pieces that should go in the trash, but I want to play with that motor some. I suspect I may be able to used a three phase converter from some ebay supplier and turn this into a variable speed motor for my drill press. A three horsepower variable speed drill press !  Sweet.

So, the only piece that is going in the trash (after I see if there's anything inside worth keeping) is the part with the heat sink on it.

I brought the new assembly home and have it sort of installed. I didn't have to change the plumbing at all since it was the same impeller housing. I do have to add a wire for low speed, but (surprise) I want to change some things.

I want to add multicolor wiring for the various line power items. I had a heck of a time chasing down which wires went where and it was a real pain walking back and forth from the power panel each time I wanted to shut off the power to the pump. So, since the controller housing has facilities for breakers, I'll add breakers right where I can get to them and multicolor wiring so I can tell which things hook to what. That should make it much easier to work on next time.

But, since the motor technology is over a hundred years old, all I'll need is bearings, seals and an occasional start capacitor. If the motor wears out entirely, there will be plenty of choices on what I can stick in its place.

Heck, for that matter the Goldline controller I use is not made anymore and I probably can't get parts for it when it fails, so next time it fails, I'll gut it, keeping the power supply, power relays and tossing everything else. That complex, ever failing, mess will be replaced with a simple XBee, Arduino, and the power relays that the controller already has.

Yes, the VSP was a cool piece of technology, and did save me money on power usage. However it simply didn't save me as much as I spent on it to keep it working. Where's the fun in that?

And, yes, that means all the research I did on the protocol and operation of the motor won't ever be used by me. Others have leveraged that work and I know there are some control systems for this motor out there based in part on that work, plus it was fun to work on.

But what about saving energy? I have friends that are energy conscious, and they don't understand my motives. I'm not energy conscious as much as I'm MONEY conscious. The latest rate increase my power company put into place played right into my hands. Without thinking about it, they gave me the periods of greatest need at the lowest rate. I need to run the motor while the sun is at its peak, around noon or so, so the solar heater can have maximum impact. That's also the time for sitting by the pool and cooling off from the intense summer sun. The (idiotic) power company in their infinite greed made the peak sun period part of the "off-peak" period so they could screw over the solar installations since that is also peak solar production hours and they get to credit the solar folk less.

That played right into my miserly little hands. I can run the pump at any speed I want to from 8 PM until 3PM the next day. Sure, that falls right across dinner hours, but I can easily work around that little problem.

And while we're at it, take that Hayward. You charged me a small fortune for the pump, and due to your own bad engineering, had to fix it twice (which must have eaten up the profit). I had to fix it once, but learned my lesson, and used part of your mess and created my own custom pump arrangement.

Soon, I'll be looking for a three phase converter to try on that fancy motor.

Wednesday, February 27, 2019

Yes, I'm Still Writing About My Power Company

I've been battling my power company since 2009 or so. It started off with a bad meter and eventually wound up with my giving testimony at a hearing about their slopping and greedy way of doing business. It also directly led to me working on lower my power bills, and to this blog.

I guess I sort of owe them for that.

However, with the filing mentioned in previous posts, and an election where we the voters booted out one of the commissioners that was sympathetic to APS, Forese, things are happening a little differently. There have been two dockets opened directly against APS and the way they handle themselves.

E-01345A-19-0003 - In the matter of the rate review and examination of the books and records of Arizona Public Service Company and its affiliates, subsidiaries and Pinnacle West Corporation.

E-01345A-19-0005 - In the matter of the Commission's Inquiry/Investigation into the Campaign Expenditures and Political Participation of Arizona Public Service Company and its Affiliates, Subsidiaries and Pinnacle West Capitol Corporation in the Election Periods of 2012, 2014 and 2016.

In the fhe first one, the Arizona Corporation Commisssion ordered its staff members to audit APS and its recent profits after the rate increase. This IS A DIRECT RESULT of citizen action over the last many months.

First protests about the initial filing for the rate increase, then the lawsuit I posted many times about, then the election where Tom Forese was not re-elected (he used to chair the commission), then the two crowning touches: Tom Forese after losing, asked for APS to explain the excessive increases people were seeing, AND Bob Burns was appointed chairman of the board. Bob Burns has opposed this increase and the handling of the APS contributions in the previous election; he even brought a law suit to expose it.

Take a closer look at the second one. Yes, you read it right, they're investigating (or at least trying) the political hanky panky that was reported and suspected in past elections. You know, spend enough money to get your own people elected, then get your way with whatever you want to charge?

Then, since I'm registered to receive updates on these items, I received the following announcement headline:

"Sandra Kennedy (our new Commissioner on the Arizona Corporation Commission) has ordered a subpoena issued to APS to disclose their 'Dark Money' political contributions."

Yes, someone actually did it. Of course there will be a huge court fight at some point, but someone had the courage to actually do it. Bob Burns tried last year, but couldn't get the other commissioners to actually let it happen. This time, I bet it goes out since we fired a major roadblock in the last election.

Since most of y'all aren't on that particular mailing list, here's the significant text of the press release that I received and came out on 2/26/2019:

"Commissioner Sandra Kennedy has finalized and docketed a letter to Matthew Neubert, executive director of the Arizona Corporation Commission, directing him to prepare a subpoena to Arizona Public Service (APS) and its parent company, Pinnacle West Capital Corporation, regarding its spending on political races, lobbying, advertising, and contributions to 501 c 3 and 501 c 4 organizations for the calendar years 2013 through 2018. (Contributions to 501 c 3 and 501 c 4 organizations can be used to mask dark money spending.)

The subpoena effort has been fueled by concerns about millions of dollars of dark money spent in Arizona elections starting in 2014, and APS’ refusal to provide that information. About 30 million dollars were openly spent by APS to defeat Proposition 127 in the 2018 election, but the issue of other political spending by APS in other races is still an unknown. Commissioner Kennedy supports full transparency and looks forward to providing the subpoena results to the public.

Commissioner Kennedy promised in her successful 2018 Corporation Commission campaign to sign a subpoena to finally allow transparency regarding APS’ political spending, and she will be inviting her fellow Commissioners an opportunity to sign the subpoena as well."

The actual letter that was filed is at and makes for some fine reading.

Additionally the next day (today for me), there was an additional announcement:

"Commissioners Seek Information from APS on Political Spending
Chairman Burns and Commissioner Dunn issue joint request seeking transparency"

As with all things political, the two additional Commissioners drafted their own paperwork. They created another docket, E-01345A-19-0043, and their own letter. This letter has places for all Commissioners signature and a very bold letter. If you're interested (for a political science paper when mid-terms are looming) it's at <link>.  It has a wonderful line in a couple of pages that I actually cheered when I read it:


If anyone ever thought that voting didn't matter, think again. The first docket was filed by Bob Burns, and the second was filed by  Sandra Kennedy. This all happened after Forese was not re-elected. Of course, there were many people like me following this closely and myself and other spoke at various hearings. Money was donated, charges were filed, hearing were held.

And, we're not done yet. This will take more months and more hearings before anything of any substance happens. But, the people have actually started something.

What's coming to the world? There actually are some politicians (well sort of politicians) that keep their campaign promises. 

Sunday, December 30, 2018

Have You Ever Thought About Tire Inflation?

Well, neither had I. At least not much more than topping of a tire once in a while. However, I got new rear tires on my big tractor and after a while of just sitting, one of the tires was very low. Getting the new tires was an interesting experience. Those things weight a lot and I didn't want to spend hours trying to break the bead and leverage the tire off using long tire irons, so I just called in a mobile tire service and let them do it for me.

They came out in a big truck with a crane installed in the middle of it. They didn't even have to remove the wheels from the tractor; they simply pulled the tires off of it and put the new ones on. I sat in a lawn chair and watched. That's the 21st century way to get tractor tires changed.

Anyway, the brand new tire was flat and I had to air it up. I grabbed my trusty tire inflator and about ten minutes later I was still messing with it. I have a pretty good compressor, but putting air in a tire as big as the ones on my tractor through a hole a little more than an eighth of an inch was going to take some time. Plus, holding it up to the valve stem was getting tiring. You all must have either owned or used one of these over the years:

I had another one to try out that I picked up at Tractor Supply a few months back, so I gave it a try and it didn't work much better.

The little assembly that was supposed to hold the hose on the valve either leaked or popped off each time I tried to use it.  I did eventually get it to fill the tire, but it was an experience that I didn't want to repeat.

Off to Amazon I went and found an inflator that had many good reviews and looked like it could do the job because it was substantially better made than the one I had. There were rave reviews that indicated that it would tell me the tire pressure as I filled the tire, it filled fast, was accurate, all the hype one should have learned to expect and disregard. I ordered it. When it came in, I drove the tractor (with a flat naturally) in front of the garage and tried the new device out.

Although the clip on part that should hold it to the tire worked better, it leaked if moved even a little bit in any direction. Since the valve stem was on the inside of the wheel that meant I had to lean over the tire and hold it in place. All was not lost though, it had a screw on fitting that could actually be put on the valve and would allow me to relax a little bit while filling the tire. But I couldn't figure out how to hook it to the inflator hose.

I used this inflator to fill the tire, but it wasn't a very satisfactory experience since, even though the clip on was better, I still had to make sure it stayed straight on the tire.

I went looking for another one based on about $40 spent so far and several hours direct experience and ordered this one.

It had exactly the same valve assembly as the last one with exactly the same screw on adapter, but this one had a hose that I could use the screw on with. I installed the 'hands free' adapter and hooked it up. No leaks and I didn't have to hold the hose totally straight to use it. The problem with this one was the same as all the others I had to lean over the tire to hold the stupid lever that released the air.

Fishing around my drawers of junk I found a piece of velcro (you can see it above) that I could wrap around the valve to hold it open so the tire would fill unattended. I was totally set up now. I could attach the fitting, fill the tire while checking fluids and such, then put everything away for later. Of course the eventual goal was to get the leak fixed, but I hadn't been able to find where it was.

I did notice a few things I want to share about these simple devices that don't work as well as they should. First, these days it's actually getting harder to find inflators that aren't digital. They all tout how wonderful they are because they are 'easy to read'. That is a simple lie not only will the batteries be dead when you need it, you can only see the numbers when they are oriented correctly. And, who the heck cares about a half pound resolution in a tire's pressure? As soon as you disconnect the device and the air warms up a bit whatever reading you had will change. My bet is that the accuracy is around ten percent or so and a digital reading just isn't necessary. It will also save you time, money and frustration with an old fashioned analog gauge.

None of them read the pressure of the tire, they all read the hose pressure. Think about it, it's a hose transferring air, the only pressure it actually can read is the pressure in the hose. That's neither the compressor pressure nor the tire pressure. This all means that you have to stop the flow of air to actually get a reading. I checked it every couple minutes (yes minutes) to see how it was going. Usually, I over inflated it and had to drop it down to the right pressure by hand, but that didn't take too long.

The high end devices cost from $25 up to over a hundred and they're all basically the exact same device with different names stuck on the outside. Take a look:

Lastly, don't believe the comments and advertising. If you have big tanks or tires to fill, get a screw on adapter and use it. It won't speed things up much, but you won't be holding the hose a certain way to keep it working while having to hold the lever down.

Heck, the first inflator I tried that had been my buddy for years and years would have worked with the adapter and I would have saved roughly fifty bucks and weeks of frustration.

Oh, I finally did find the leak. After washing the tire down six times with soapy water and turning it slowly in the sun and finding nothing, I was under the tractor working on a simple drain valve and happened to think that I hadn't checked the valve on the tire. The valves on the tractor are all on the inside to prevent rocks from ripping them off and they are a bit hard to check. Sure enough, the valve was not tight in the wheel and leaked. A few minutes with some soapy water and a wrench and the problem was fixed.

So, learn from my mistakes.

Saturday, July 14, 2018

Thermostats, Location, Location, Location

When I was researching supercooling as a way of limiting my power bill I kept getting readings and such that just didn't make sense. One side of my house was comfortable, the other ... not so much. Sure it was the sunny side this time of year, but it has really good windows and good curtains. The only two major problem areas were a couple of windows that faced directly into the after noon sun.

I fixed those years ago with reflective insulation that I put in for the summer and (sometimes) take out for the winter. It's easy to work with and will last forever if I just give them a little attention every once in a while. I wandered around the room and noticed that the interior walls were about 2 degrees warmer than the rest of the house and there was heat getting in through the foundation.

The sun bearing down on the exposed slab foundation would heat up the concrete slab and transmit heat inside the house. That's something that might go unnoticed if I had carpeting, but the tile felt warmer as you approached the wall.

So, basically, it was like any other house on the sunny side. Why was my AC running all the time and having little impact on that room?

A little background: I have a house shaped like an "L" and two AC units. The one on the north is a 3 ton and the one on the south is a 5 ton. Both of them going could cool the house, but when they cycle, it doesn't seem to handle it. I had two thermostats that were located by the AC 'experts' that did my house and were in the top middle of the price range. I replaced them with highly programmable thermostats that were in the high range of prices. These wouldn't do the job of handling peak periods well, so I got a high priced "learning' version. It was crap.

The learning thermostats only learn what the programmer wants them to learn, and it was great at anticipating my needs. It decided I liked the AC on at 07:00 and off at night ... exactly the opposite of what I wanted. They tried to predict what temperature I wanted the house at and must have been born in Nova Scotia because they wanted to keep it at around 65F.

I sent those things back before the 30 day refund period was up. What a waste.

Then, I built my own <link>; I could control them any way I wanted to. Over the years I tried recirculating the air around the house with them, experimented with differing hysteresis curves, used various smoothing algorithms on the temperature readings, etc. Basically, I tried everything I could think of to get the environment the way I wanted it.

Nothing worked very well. I would still wake up with the bedroom running around 85F at night.

But, during my experimenting with supercooling the house (look at the posts on supercooling by using the contents search on the top right of the page) I noticed a whole bunch of things that really shouldn't be happening. First the south AC unit was short cycling. Short cycling is where the AC comes on and then shuts off in seconds or minutes. This is NOT a good thing.

Cycling like this can radically shorten the lifetime of any motor driven device. It causes undue wear on the bearings to be jammed up by the quick start of the motors. It can cause fan blades to slip and that scores the shaft. The air start up can loosen vents and cause rattles. Basically all the things that destroy devices like this. This behavior can also cause a room to be too cold and then too hot within minutes.

The very most expensive AC units start slow and ramp up to speed, they will run slowly to keep the air moving, they even open and close vents based on the need for cooling in a particular area. But, I'm not Bill Gates; these things are way out of my price range.

So, I started looking for the cause of this situation on my south AC. TLDR (too long didn't read) the thermostat was in the wrong place. The thermostat was in a hallway like most of the thermostats in the world close to an overhead air return for the AC. Over half the air for the house went through that return. The temperature would drop rapidly in that location when the AC turned on and cause shut off in a matter of a couple of minutes. Then it would rise rapidly back up because it was only the breeze that cooled it off and repeat the cycle.

Another factor was that I run in and out of the garage a lot. Each time warm air would hit the thermostat and cause the same problem. Add to that the garage is on the other side of the wall and it doesn't have AC. When it heated up, the wall was warmer than the air in the house; cycle started all over again. Obviously, the thermostat had to be moved to get better performance.

Based on this research, I modified the house code to save the activity of the two AC units and looked at them for a day to see how bad it was. It was pretty bad. Here's a chart of my findings on the first day for the south AC unit:

The tall vertical stripes are when the compressor was running, and the jagged line down the middle was the temperature the thermostat was reading. Each shaded long vertical strip is the compressor chewing up power and wearing itself out. Here's a closeup of a couple of them from the middle of the chart:

The stair steps in the temperature is due to the granularity of my recording the data. I only mess with one degree changes, so it comes out like this. So, you can easily tell that the hysteresis is three degrees and it takes very little time to overcome that with the AC unit essentially blowing down the hallway from all the rooms. Similarly, the temperature will shoot back up in a similar fashion because that short a cooling interval doesn't really cool anything except the air the it is blowing around. The gap in the middle is because the cumulative impact of a series of cooling cycles finally does cool things down a little.

When I looked at the North thermostat, it was a different set of environmental factors that added up to a different problem. This thermostat was in a short hallway outside the master bedroom (my room darn it) while the AC unit was venting into that room. There were also a couple of vents that dumped air into the rest of the house to aid there as well. When I looked at it, it looked like this:

Same things on the graph, compressor run period and temperature recorded by the thermostat. Notice the compressor runs a lot even though the temperature isn't changing? Part of that problem is that the thermostat isn't really looking at the AC activity, it's looking at a completely different area. The rest of the problem is that the two vents into the rest of the house are letting almost a great a volume of air get out there as it allows inside MY ROOM.

Fine ! I gotta move the thermostats, but where the heck am I going to put them? Also, it's a real pain to move a thermostat. I don't have a real attic, it's an area that is totally filled with insulation about two feet tall. I really, really don't want to go up there --- ever. I could carve out the wall and move the thermostat and then patch up the wall. That's equally unlikely to happen. Instead I experimented with really long hysteresis values. I was up to 10 degrees at one point. That solution was not satisfactory. I also tried running the fan longer to make sure the air got moved. That didn't work well either; it actually made the problem worse.

Then, I thought about it a bit. I had these temperature sensors <link> all over the house, why couldn't I just use them instead of the temperature sensor inside the thermostat? There wasn't a single reason why not except I would have to change some code in a few places. I took all the code out of the south thermostat related to reading temperature and reorganized it a bit. Now, it would receive the temperature forwarded by the house controller from any of the temperature sensors around the house.  I chose a room where the sensor was on an inside wall away from any breeze from the AC directly. The sensor gets air circulation, it just wasn't directly in the cool air path.

Now, I was ready to test the newly modified south thermostat. The one that was banging the compressor to death with short cycles. Let's see what this accomplished:

Now, that's more like it. Granted, it was a stormy day and not our usual 100+ temperatures, but look, it wasn't short cycling any more. There are long periods of AC activity and the temperature rises slowly instead of a few seconds at a time. This may look like I'm actually using more power, but I'm not. It's actually about the same because the gaps are longer as well. the big thing was that I wasn't tearing the guts out of my AC.

I did the same thing with similar results to the North AC, except I also closed off the vents to the rest of the house. Now my bedroom cools down pretty quickly and stays that way for a while.

Notice that it isn't on all the stinking time blowing air where it isn't needed? The big gap is the 'demand' period where the AC isn't allowed to run 15:00 to 20:00. After the down time, it kicked on and recovered a little after midnight.

The beauty of this is that I can build a couple of temperature sensors specifically for the AC units and put them anywhere I want. If I want priority in the bedroom, put the sensor by the bed. If I want it for the shower, put it just outside; you get the idea. Basically, this is a priority system now that allows me to carry the priority anywhere I want.

I hereby copyright this idea !! Anyone is welcome to do anything similar; heck steal my code if you want, but you commercial shark guys out there better get permission to use this. It's real annoying when you find your code, stolen right off the site and only perfunctorily changed in a book that sells for $35 a copy at a book store. I'm looking for new ideas and find my old ones on the shelf...sigh. I have found my code and ideas all over the web and almost every single time it's attributed; that makes me feel good. When someone is selling it, not so much. This stuff is supposed to be free dog gone it.

Anyway, the jury is still out on this idea. I need to watch it over time and see if there are problems with the devices talking to each other, getting out of hand unexpectedly, actually working the same way over time. That kind of thing. One thing I did notice though is that a web only version where there is no control station nearby sucks. It's really nice to be able to lower or raise the temperature by pushing a button on the wall instead of starting up a browser and working through pages to get to it. Now, this could be a cheap tablet, and old phone, or something like that if you want to get fancy, but a nearby control is nice. I like buttons.

Also, it's a good thing to have a display that shows everything is working OK. I'm currently using the display on the thermostats, but it could be anything that you can see when wandering aimlessly around the house looking for the car keys. This also helps with the, "It's too hot." comments. You can point to the thermostat and show them that it's only 80 and not hot at all. Folk visiting from the East do this all the time.

Another thing I learned is that AC 'experts' are not to be trusted. These things were professionally installed and came highly recommended. They put one thermostat outside the room it was needed in and the other in a breezy hallway next to the air intake and a garage door. In retrospect, I may be to blame somewhat for not asking enough questions, but these were experts hired for their knowledge and experience. I don't have a suggestion on how to handle this problem except to get two or three experts to present proposals and pick their brains. If you are Bill Gates and can afford to do that kind of thing. I even blogged about the unreliability of 'experts' a couple of times; my experiences are not good with them. Of course, now that I can put the temperature sensor anywhere I want, it doesn't matter as much.

See what happens when you start automating your house? Ideas may come slowly, but actually doing them is entirely possible.

Oh, this is another post that will attract attention from the spammers. If you post advertising in a comment, it will be quietly deleted. Usually the same day. So, don't bother advertising your AC repair company here.

Tuesday, July 10, 2018

Local Power Politics: APS, AZCC and Things to Think About...Continued

No, this isn't turning into a political blog, although, it would be fun, but this relates directly to my continuing annoyance with my power company Arizona Public Service. I have a few previous posts about how poorly (in my opinion) it's run and how they are using the power of the dollars we pay in rate fees to control local politics and raise rates. In the last post about this <link> I specifically mentioned a particular rate increase that is being contested right now. I'll leave the long description of that item to the reader; simply check out the link I just left you.

What I want to recap here is one particular item that is turning out to be fun. Briefly, an APS customer, Stacey Champion, is petitioning to have the latest rate increase revisited. She contends, and I agree with her, that APS dealt improperly in their presentation of data and impact of the rate increase. A lot of people are behind her in this effort, and two individuals have joined directly in the proceedings to help out and also get some of their own particular opinions aired.

Naturally, this is becoming an interesting problem for the members of our regulatory commission, Arizona Corporation Commission. Basically, the AZCC is the equivalent of a Public Utility Commission in other states. They have commissioners that vote to control rate increases and act in the public's behalf. Many contend that APS owns some of the commissioners, and it's hard to deny when millions of dollars have been spent by APS on political campaigns locally.

So, this particular 'Docket' is a hot button right now since some of the commissioners are up for reelection in November.
Now, to the fun part. One of the commissioners Tom Forese sent a note to the people handling the Docket asking for the inclusion of 'Staff':

Dear Commissioners and Interested Parties,
I would like to request that Staff participate in the matter of Stacey Champion, et al vs. Arizona Public Service. Staff was a party to the rate case, and Staffs [sic] participation will assist me in making my final decision. 
I would like Staff to respond by close of business June 29, 2018.
My first question was who is this 'Staff' person? Is there a Joe Staff that works there or what? Well, it turns out that 'Staff' is the commission's legal staff. Forese is actually trying to inject more lawyers into the mess. These lawyers are the same ones that worked on the previous Docket that is being contested right now.
'Staff' replied with another note:

Because this proceeding has been underway since mid-February 2018, Staff respectfully requests that a procedural conference be scheduled at the earliest possible date to discuss Staffs participation in this case and to consider this proposed procedural schedule to accommodate Staffs involvement 

I only quoted the last paragraph because the rest of it is legalese, and you can see it all by following the link above. Below this is a strawman schedule that is proposed so the lawyers can get all their poop in one sock and not look like a bunch of dweebs.

Notice that the lawyers ask for a conference. In this case it means that a judge presides, and all the folk directly involved have to attend and have their lawyers there. It's really a hearing; you know how lawyers love a hearing. The administrative judge involved, Jane L. Rodda called for a conference (hearing) to be held on July 11th to discuss this and other matters.

OK, this sounds a little weird on the surface. The commissioners have not attended any of the hearings so far, and have had little obvious involvement. This has been between normal folk and APS's plethora of lawyers. Now, one of the commissioners, actually the chairman of the commission, wants to inject lawyers to tell him what is going on. Initially, I wondered, "Why hasn't he been following this already?"

Turns out that I wasn't the only one wondering this. Warren Woodward, one of the normal folk that is also directly involved in this with Stacey Champion filed a letter contesting 'Staff' involvement. This is the really fun part and I'm going to include most of it below:

Warren Woodward, Intervenor in this proceeding, strongly objects to the suggestion put forth by Staff on June 29, 2018, that a procedural conference be scheduled in this case to discuss Staffs participation in this case. 
1) This matter can be handled on paper. There is no need to waste the Parties' time at a conference.  
2) The time to apply for intervention passed on May ll, 2018. Staff missed the boat.  
3) By virtue of signing the APS rate case Settlement Agreement, Staff is biased in favor of the rate hike established in ACC Decision 76295, and Staff cannot be expected 1 to be impartial in this case. To wit, Section 40.6 of the Settlement Agreement:  
  • The Signing Parties shall make reasonable and good faith efforts necessary to obtain a Commission order approving this Agreement. The Signing Parties shall support and defend this Agreement before the Commission. Subject to subsection 40.5, if the Commission adopts an order approving all material terms of the Agreement, the Signing Parties will support and defend the Commission's order before any court or regulatory agency in which it may be at issue. 
4) If commissioner Forese, who suggested Staffs involvement in order to assist his decision making, wants to better understand the issues in this case, then he can read the docket, including all the APS customer complaints, both in this docket and in docket E-01345A-16-0036. There is also nothing stopping commissioner Forese from sitting in at the hearing and paying attention, something he neglected to do during the APS rate case in which these unjust and unreasonable rates (that are the subject of this proceeding and for which Forese voted) were spawn.  
5) In light of all the foregoing, there is really nothing to discuss. Staffs request for a procedural conference, and Staffs intervention in this case, should be denied.

Is this AWESOME or what? Woodward stepped up and actually said what should have been said:

This herd of lawyers has not been paying attention to this because it seemingly wasn't important, therefore they want to extend the schedule of the hearings and actions. Probably past the election so it doesn't interfere with the sitting commissioners campaign for reelection.

That the herd also cannot be neutral, or even in favor of the public's interest because they signed off on the rate increase and promised not only to not object, but also to "support and defend" it. Including them will add lawyers that are required to support APS in this matter.

The Chairman of the Commission himself isn't tracking it and doesn't want to go to the effort of catching up so he wants the lawyers to do it for him.

I'm going to add something to this that wasn't directly mentioned. More lawyers means that the normal folk that are trying to get this reheard will have to spend more money answering the new lawyer's questions. More time will mean more expense and delays so this falls further behind in people's minds. We all know that more lawyers always cost more money, and APS doesn't care at all. They are guaranteed a reasonable profit by the regulating body regardless of how badly they run their business.

One other thing, how could a section like 40.5 quoted by Woodward above ever have been signed? The parties to this 'settlement' were the solar industry, other power companies and such. My Lord, it also included Walmart and Sun City for crying out loud. There's a paragraph in there that says they will defend it?


And it's really there. I found it on page 31 about half way down the page <link>. If you want to see all the documents and interactions look here <link>, but it's really, really boring.

OMG!, do we have the best regulatory body that money can buy or what?

Thursday, July 5, 2018

PZEM-016: Another Chinese Power Monitor

I really like the PZEM-004 that I picked up just to see what it could do <link>, in fact I built the monitor and control system for my water heater with it <link>. This thing has really taught me a lot about water heaters and how much money my solar water heater actually saves me.

That led me to look at other devices available from China that could actually help out around the house. Well, the same manufacturer makes a different model, the PZEM-016 that does much the same, but even better for my purposes. This one does the measurements for me, but also has an RS485 serial interface so I can watch more than one of them.

OF COURSE I took it apart:

It's built extremely similarly to the 004 model I already wrote about. The big difference, of course, is that this one doesn't have any display. That's OK, I'll take care of that part. But first I have to actually talk to the darn thing. I've already worked with RS485 using an arduino when I put together my pool controller <link>, so it isn't too strange, but it still intimidates me a bit.

I dug around in my boxes of left over pieces and found an adapter to go from TTL serial to RS485 and combined it with an arduino and started working on getting it going.

Naturally, it was a pain in the bottom to talk to the device. I emailed the manufacturer when I first ordered the devices (yes, I got five of them) for as much documentation as they could provide. They sent me a manual that was actually pretty easy to read and understand. In it they said that the device was Modbus compatible, and that really impressed me. If you look up Modbus, it is an industrial protocol for machines. It can control a large number of devices in an industrial setting and should have code that I can leverage to get this working.

Right ! Things never ever work out that easily. I did find protocol libraries that I could use on the arduino, but have you ever looked at Modbus? I thought the documents for ZigBee were obtuse, these are where ZigBee learned how to do it.

Frankly, I chucked the idea of using a Modbus library down the tubes pretty quickly in favor of a much simpler approach. When I looked at the messages that the PZEM 016 actually used, there were only a few of them and the responses were pretty much canned and easy to work with. I just sat down and put together a message to read the data from the device and sent it to see what happened.

No, it didn't work first try. No, it didn't answer on the second or third try either. One has to understand that if you don't get the message exactly right, you'll never get a response from the device. In my case, I was messing up the checksum. Fortunately, in the last couple of years there have been many sample checksum implementations and online calculators implemented. I tried a couple with my data and hard coded the actual message I needed to send, that actually got me a response.

Then I spend a couple of afternoons working the kinks out of getting the response and using the checksum to validate the message. Once I could send and receive a single message reliably, I was ready to start adding code. Naturally, it encountered problems. It seems that short messages would cause checksum problems ... sometimes. So much for the idea that a computer does the same thing each time. I worked at this for quite a while without resolution. Here's a couple of screenshots of the arduino serial interface. The first one is using a message that requires a short response and the second is a longer message. The interesting thing is the accumulators I stuck in the code to count the checksum errors.

The short response has 34 checksum errors out of 100 tries while the second longer response has only one out of 100. Same code and timing in both cases...sigh.

For the rest of my experiments I used messages that required a long response. Eventually, I implemented code to handle reading the values from the device, changing the address of the device, resetting the energy (kWh) accumulator on the device, etc. I actually had it working pretty well.

Then I outfoxed myself and decided to modify the code to handle more than one device on a single pair of wires. This was actually easier than I thought it would be. The idea is that each device on an RS485 line has a different address, and you address the one you want to control or receive values from. In theory I could have several of these being read by a single arduino and monitor a lot of things around the house.

But, that would mean unique addresses and unusual delays and strange things happening. Gritting my teeth to the point of pain, I dug into it.

One of the initial problems I ran into was not knowing what would be coming after I sent a request out on the line. Sure, it should be predictable, but it never works out that way. When one does a serial read, you can get back something that is expected and just follow the bytes until you reach the end. We've all seen this: a protocol has a leading byte to tell you the beginning of the response, then a length to tell you how many bytes are to follow. You simply get the length and then read until the rest of them come in.

Suppose that is the last byte you see though. Or suppose there's a burst of noise on the twisted pair and you get about a thousand more? Obviously you can't rely on a length in the incoming characters until you can verify the integrity of the message by reading the checksum way out there at the end of the message. Let's make this problem even nastier, RS485 lines can ring. That means that you can get strange interference on the line that will mess up any message that is running around on it. You have to allow for settling times and such after messages fly around.

The problems are not insurmountable though, industry uses these protocols and devices every day. If they can make them work, I can get them to work well enough for my place. And, I think I did. Here's the code I came up with to read a message coming in:

int getit(){
  memset(rxbuf, 0, sizeof(rxbuf));
  int i = 0;
  if (digitalRead(debugPin)==LOW)
    Serial.println(F("Data from port:"));
  unsigned long startTime = millis();
  unsigned long lastChar;
  boolean startchecking = false;

  while(millis() - startTime < readTimeout){
    if(pMon.available() > 0){
      if (digitalRead(debugPin) == LOW){
      lastChar = millis();
      startchecking = true;
    if (startchecking && millis() - lastChar > 4)
  if(i == 0){
    if (digitalRead(debugPin == LOW))
  if (digitalRead(debugPin) == LOW)
  uint16_t calcCrc = makeCrc(rxbuf, i-2);
  uint16_t rxcrc = word(rxbuf[i-2], rxbuf[i-1]);
  if (rxcrc != calcCrc){
    Serial.println(F("Checksum error"));
    if (digitalRead(debugPin) == LOW){
      Serial.print(F("Calculated "));
      Serial.print(F("Received   "));

What I do is set a one second timer around the entire message and when a single character comes in, I set a intercharacter timer of four milliseconds for the next character. This way the most I can wait for a message is a second and then if it just stops mid message, I only waste four milliseconds before I give up and try again from the beginning. This works really well to cut the necessary time to read a message down as well as notice a failure quickly. I was pretty proud of this piece of code until a little later.

When I tried to send messages quickly, there were problems. One response would pile up on top of another from a different device. This required a delay between devices so things could quiesce a bit. Long painful experience has shown me that setting delays in code is just programming around a problem rather than solving it, but sometimes you just have to wait for other devices to stabilize before moving on. This is one of those cases because the devices on the line don't send you a ready message.

One other thing you'll notice in the code above is that I found a new debugging tool, an input pin. I use pin 3 on the arduino as a digital input pin and check to see if it is grounded before putting debugging messages out. If it's running and I see something I don't understand, just ground pin 3 and the debugging messages come out to the screen. I really wish I had thought of this about eight years ago.

The other pin I use for a special purpose is pin 2. If it's grounded I go into a special piece of code that allows me to change the address of a device. All the devices come addressed as one initially and I have to change them to something else to actually use them. So, if I add a device to the line, and boot the arduino, the first thing it does is check for a device at address one, and when it finds one, it tells me to change the address and hangs up in a hard loop.

I plug in a wire to pin 2 and then boot the arduino again. It senses the pin and goes into special code to allow me to readdress the device. This is also a good time to recompile and add another device to the device table. Yes, I took the cheap way out. I add a device in the code by changing a number and entering the default values as well. It just wasn't worth the time to come up with a more elegant solution for something that will happen six or seven times ... ever.

Basically, I'm done with being able to control and read this device, but that is the beginning of a greater project I've been thinking about for a long time. I'm going to put several of these in an enclosure and measure the power usage of my major appliances. The 2 AC air handlers and the 2 AC compressors are big users of power and I want to track their operation. The stinking dryer that has cost me so much money because people keep using it is another one <link>. I messed up though and only ordered five of the devices. I need one more for the kitchen stove. It'll be on order tomorrow probably.

Before the more astute of my readers comment on how an appliance that uses both 110 and 220 like a dryer or kitchen stove can't be measured with a single current transformer because one leg is referenced to neutral, go look at this post from quite a while back where I found a way <link>. Yes, Dorothy, there is a way to do it.

Here's a little sample of two of the devices monitoring my light that has two bulbs in it. I used the exact same setup when I worked on the 004 version.

I have the debugging pin grounded (that is so cool) and I'm reading the light with one bulb turned on. Notice the difference in the 'Energy' value? One of them has been recording usage longer than the other. They both read basically the same thing for the other measurements because they are hooked to the same thing.

Adding another monitor to the stuff is simple, Wire it in, ground pin 2, reboot, change the address to 4, change a value in he code, recompile and away it goes. Since this is one of those devices that will just run for a long time without changes, that should be fine.

Here's a picture of the setup I used to get it going.

The board in the upper left is the RS485 converter and the CTs are off on the right hand side.

Next, mount them in something, wire them up and hook the CTs around the power lines in the mains panel. I will add an XBee to the arduino and send messages back to the house monitor just like I did for the water heater. I fully expect to add at least one solid state relay (SSR) to the project to make sure the dryer is under my complete control. No more running the dryer during peak period for me.

Have fun.