Saturday, December 27, 2014

Energy Monitors

Whenever I have some time to spare, I've been tinkering with the ESP8266 board, slowly getting it to act as a simple serial to Wifi gateway.  As the simplest path forward, I've setup the serial input to be read into a buffer, which then gets flushed as an UDP packet to the server when filled up.  The code seems simple enough, but I'm running spontaneous reboots, which I suspect is caused by the watchdog timer.  What I wouldn't give for a proper debugger!  I'm hoping I'll be able to get it up and running soon, though.

Meanwhile, I've been keeping a close eye on power consumption over time as best as I could by manually checking the battery monitor at different points in time.  One of the most important part about the battery monitor reading is that it literally monitors just the batteries, not any other parts of the electrical system.  You can infer a lot of things from getting the voltage and current information, but they are no direct measurements.  The diagram below shows where the battery monitor measurement shunt is located.
Power System High Level Layout
If the battery monitor reading shows positive current (in other words, the batteries are being charged), it could mean that it's nice and sunny outside and the solar panels are generating power, or the diesel generator has kicked in and is running, and the total power being generated is more than the power being consumed by the house, the water pump, and all the electrical loads.  Reverse is also true - the Solar Panel could be generating power, but if microwave and hair dryer is running at the same time, you'd see a negative value on the battery monitor.

One of the things that I noticed right away was that there was a spike in power consumption whenever water was being used - using both cold and hot water would result in a brief spike in power consumption of up to ~500W for the duration of the water usage, which was a surprise to me.  As it turns out, the water pressure in the house - both hot and cold water as well as the sprinkler system - is maintained at 50 psi by an electric water pump which kicks in automatically when the water pressure drops below that point.  It would be nice if there's a way to store the excess power during the day in the form of pressurized water or water with higher potential energy, but the terrain at the house does not have enough elevation gain to have decent water pressure and apparently the existing system is about as energy efficient as water systems get these days.

The current set of solar panels, under full Sun close to Winter Solstice, gets about 45A, or little over 2kW.  The diesel generator seems to be rated for around 3kW, peaking at 60A.  The house is fairly efficient, but in the middle of the night with everything turned off, there's base consumption of ~7A or 350W which seems kind of high.  I walked around the house with a Kill-A-Watt meter to see if anything was amiss, and noticed that a camper that was plugged in was using 40W, but 200VA with power factor of 0.20.  I wasn't able to figure out the actual effect of unplugging the trailer (it was during the middle of sunny, gorgeous day with solar panels going full tilt!) but I'm hoping getting a timer and having the camper powered on only during the day will make a sizable dent in the power consumption.

Going back to the diagram, even if I were to get the Battery Monitor information, there's a lot of information missing from the battery monitor readings - it'd be nice to get a finer breakdown of where the energy is going, and how much is actually being generated and being used up.  In trying to answer that question, I got introduced a whole world of Home Energy Monitors, from fancy industrial looking units to cute user friendlier ones with names like TED.  They all work in similar manner - a set of current transformer on relevant circuits feeding data into some sort of control unit which then sends the data over to a display unit.  Many of them are designed to be wired into the circuit panel, and uses proprietary wireline and wireless protocols to send the data to a receiving unit.  Being able to collect data to a computer is unfortunately considered a "professional" use case that requires more expensive units to be purchased.  In the house, having energy monitor wired to the circuit panel would mean that I'd get good visibility within the house itself, but I wouldn't be able to easily figure out the amount of energy used by the water pump for example.

Then I found a product called mFi/mPort from a company called Ubiquiti.  I've actually already been looking at their wireless last-mile product line in trying to get non-Satellite internet up at the house, and it was a pleasant surprise to see that they have nicely designed, cheap(-er) line of IoT sensor products.  As far as I can tell, you purchase a mPort, which can support 2 different sensors (or your own sensors over RS232/422/485!).  Ubiquiti sells a variety of sensors, though the ones that I'm interested in are the current sensing modules.  mPort itself is wireless / ethernet based and as far as I can tell, it should be fairly easy to get the data off of the device itself.

For about $100, I should be able to get two current readings (AC only, as the sensors are current transformer based, not hall effect), so that should allow for Water Pump and Rest of the House energy consumption.  This ends up killing two birds with one stone, as it gives me a proxy way to measure the water consumption in the house as well.

I'm slowly getting all the pieces in place to get the house to be a little bit smarter, but everything's taking much longer than originally expected...