powering yourself: water heaterS – Most efficient setup with no tradeoffs

In the “Rethinking the Smart home series“, I proposed that if you have a solar PV system (or any system that generates electrical power), no one uses your own produced power better than the you. To summarize the proposition, I claim that “selling back” to the grid is environmentally less ideal than using the produced power yourself. The concept needs a nickname -something I can use to expand and apply the concept later. Towards that end, I think “Powering Yourself” works. I’m open to suggestions if you can think of something more catchy. Let’s market this idea and spread it around! The more eyes and ears on the concept, the more solutions we can come up with to make distributed smart-grids a reality and ultimately make the world a more energy efficient place.

Water heater relative efficiency

Hot water is essential for our daily lives. Hot water kills many types of bacteria that can infect our bodies. It is more effective for cleaning with as it helps loosen up bonds. In US homes, hot water is typically produced in a centralized tank. This insulated tank is mostly heated by burning natural gas (CH4/methane).

Rheem Performance Platinum 50 Gal. Medium 12 Year 5500/5500-Watt Elements Mobile Alert Compatible Electric Tank Water Heater
courtesy Rheem

Tank water heaters are generally less efficient than tankless or “on-demand” water heaters. This is because the water in the tanks is maintained at a set temperature (between 49C-60C) even when you are on vacation or shower less frequently, etc. Running a tank water heater is estimated to cost about twice as much as a tankless.

Even more cheaper to run than tankless is a type of water heater called a “hybrid water heater” or “heat pump water heater”. Some of the manufacturers claim they take “energy from the air” to heat the water. This is misleading in my opinion. These are actually using the same technology as your AC unit: it uses mechanical energy to compress and decompress a phase-changing medium from liquid and gas states. The in the decompression state, the phase change from liquid to gas will actually suck thermal energy from the air to help facilitate the phase change. You can experience the same effect if you get a can of compressed air and spray it for a while. The can gets cold fast because the phase change going on inside is sucking thermal energy from the can and your hand (and the air, etc).

On the flip-side, during the compression stage, heat energy is actually released to facilitate the phase change from gas to liquid. This energy would go back into the air or in the case of the hybrid water heater: into your water. The process isn’t even zero-sum because the compressor itself gives off some heat.

Courtesy of Stiebel Eltron

Hybrid water heaters use electrical power to turn the motor in the compressor. They use less energy than traditional electric water heaters which run at sometimes run at 5kW. Further, they use drops compared to tankless electric… which can go higher than 36kW. Yikes!

Tankless comfort

Of all these different types, tankless are the most comfortable in my opinion. Tanks fill with cold water at the same time they are being drained of hot water. This results in fluctuating temperatures at the start and end of use. If you’ve ever showered right after someone else in your household, you know this reality. Tankless heaters don’t have that problem. They have constant temperature from start to finish. So if you have or want to use a tankless heater for the comfort and savings, how do we achieve this while still following the “powering yourself” principle? Tankless heaters are gas or electricity powered. Gas is a bit more difficult to power under your own means (not impossible, maybe more on that later). For electric tankless, the electrical consumption is so high that very few solar systems can keep up (36kW or more). To power ourselves, we are left with tank solutions and really only hybrids as they require less electrical power. But to go with a tank we must sacrifice all the pro’s of tankless… or do we? Can we have our cake and eat it too?

Smarter water heating

In the last article, I wrote about an automation approach that uses smart budgeting to maximize the usage of your own energy production and reduce usage of the grid. Could we add a hybrid water heater as a device to this system? Let’s calculate and see if we can power it with solar PV. We don’t need to power it all the time since the tanks are insulated and will maintain some thermal energy. At an R-value of 20, a 50 gallon tank of 60C will cool by about 3C over 9 hours assuming a surrounding temperature of 8C.

A 50 gallon hybrid water heater stores 183 l (or 183 kg) of water. Worst case for my area, the temperature of the water will be 9C. We need to heat that up to a minimum of 49C (to meet government standards) or 60C (most manufacturer defaults). Using 60C as the worst-case target, we need to put in 40.3 MegaJoules of energy into the water to heat it up from 9C to 60C (Q = mC△T). No heater supplies that amount of power all at once, so lets divide that energy requirement over time. To get kWh we divide by 3600 (number of seconds on 1 hr). We get 11.2kWh. That’s pretty reasonable production rates for even a small solar system. With my 3kW system, I can average 11kWh a day for 8 out of 12 months or 2/3rds of the year. With a 6kW system, you can do 11 of 12 months.

We can almost power our water heating needs under the Powering Yourself concept! To cover the last little bit, we could put a tankless heater in-line after the tank water heater. The tankless water heater would only be active if the incoming water is below the setpoint. We can get the benefits of Powering Yourself and tankless comfort!

Copyright 2018 tripzero.io

Cost savings of the Hybrid Approach

In the above diagram, we are using a fairly large tankless heater. Heaters at this price range can do 9 or more gallons per minute of hot water. For reference, a typical US shower head is 2.1 gallons per minute. This is probably overkill for what is actually needed in most situations. Even the cheapest 5 gpm tankless option will be better in the worst-case scenario than just having a tank.

For the 9gpm tankless, the time to payoff with the savings is about 9 years with a 3kW solar PV system. It’s about 7 years with a 6kW system. With a 5gpm tankless heater, you are looking at 3-4 years.

This payoff period is only for the added cost of the tankless heater in this setup. It is assumed that this is either a new install or you are replacing the existing hot water tank with a hybrid. Hybrids save about $100/year over traditional gas tank heaters. The payoff for the hybrid upgrade over traditional is around 5-8 years.

Conclusion

First, there is no point in even trying this if you do not have your hybrid tank optimized for solar with some sort of home automation software. It needs to essentially turn off if there is no solar power being generated. Wifi enabled versions allow setting the temperature setpoint remotely. There’s even an open source python API for talking to some Rheem models. If the hybrid heater has this capability, we don’t have to turn it off. we can just turn the set-point down appropriately to stop it from running… or run less. Another option is a wifi relay outlet like those supplied by Wemo or TP-Link Kasa. Be careful! Many of these only support 15 or 20A loads and some hybrid water heaters require a 30A outlet.

If you are able to automate the hybrid tank to only (or mostly) use solar generated power, you should save money (up to $100/year in some cases). Adding a tankless heater in-line will add the comfort, and will pay for itself eventually.

What other devices can we bring under the “Power Yourself” umbrella? If you have any ideas, leave a comment below or tweet me. Good luck and happy powering!

RETHINKING THE SMART HOME PART 2 – Device Management

In Part 1 of the Rethinking the Smart Home series, we looked at how we can using batteries to offset the electrical usage of certain devices.  We did not discuss how and when that battery system is charged.  We will do that now.

Batteries are just devices

There are a lot of “devices” in our homes.  Devices are things that use power.  This includes lights, displays, HVAC systems, and even battery chargers.  Over the last few years, the market has flooded with relatively inexpensive smart light bulbs, switches and outlets.  Many of these offer power and energy consumption monitoring.  Many of them have APIs either provided by the manufacturer or reverse engineered by the community that can be used to communicate with these devices.  I decided that I could use one of the smart outlets I have to control when the battery system charges.  Obeying the Law of Using Your Own Generated Power, I will only charge the batteries when there is enough solar power available.  I realized quickly that there are many devices I have in my house that I can turn on and off in this way.  I have several grow lights for indoor food plants that are already connected to Ubiquity mFi WiFi outlets.  I have them on a schedule, but I was interested to see how much I could save if I only had them run when there was enough available solar power. 

The use-cases after that kept growing.  What if I tell my smart light switches to dim when there isn’t enough available solar power?  What if I raised the setpoint of my thermostat by a degree if there isn’t enough solar power?  What if I only charge my robot vacuum on solar power? 

To see how much money I could save, I wrote some code to help manage the devices based on a “power budget” which was set by the output of the solar PV system.  For example, if the PV system was producing 2000 Watts of power, I would turn on “managed” devices until I either reached 2000 Watts or they were all powered.  If the solar PV output dropped to 1000W, I would need to turn off some devices.  To do this, I wrote some code I call the “Device Manager”.  The Device Manager would maintain the power budget and turn on and off devices as required.  It would also run device-specific rules (more on that later).

Priority

Some devices are more important to me to have powered than others.  For example, my phone charger is more important than the robot vacuum charger.  If the power budget is exceeded, Device Manager will first turn off the lower-priority devices.

Runtime Modes

 Many utilities offer variable rates depending on the “time of use” of your power.  For example, rates are often cheaper in the night when fewer people are using lights and appliances.  Rates can also be more expensive during “peak usage” when the grid is experiencing more load for example, at noon on a hot summer day when everyone’s air conditioning is running.

The Device Manager should be smart enough to take these time of use modes into account.  If I go over my local power budget, I may want some devices to remain running if it’s during off-peak hours of the day.

A perfect example of this is my greenhouse preemptive cooling system.  I run this system at night during off-peak hours for the cheapest rates.  It also runs more efficiently at night because it’s cooler.  Double-bonus.

Rules Engine

Turning on/off devices is powerful enough for many devices.  But what about devices you don’t necessarily want completely off?  For example, I need lights at night to see.  I can’t just have them turn off if there isn’t enough power.  I can have them dim, however.  There are lots of use cases from dimming lights to adjusting thermostat settings that calls for a rules engine.  I have written rules to turn off devices, or dim lights or even check occupancy.  Devices can have many different rules so rules can be combined in interesting ways.  My lights have occupancy rules and dimming rules.  I even have a rule that “links” devices to a master devices so that the on/off state mirrors the master device.

Batteries as a buffer

In the first part of this series, I built a battery system to help optimize when I charge my laptop and other devices.  That system really cannot work to peak efficiency without the Device Manager managing when the batteries charge.  I charge the battery banks when I am under budget with medium priority.  I found this works best for my usage.  I am able to charge all phones in the house and my laptop from this simple battery system.  While it doesn’t amount to huge savings (only $5/year), it does make a good proof of concept that we can use to power additional devices later.

In practice

With the system running and managing about 8 devices ranging from grow lights, to chargers to the thermostat, we observed considerable savings.  Our power usage is about 30-50% less year over year.  That’s much more than Not all of that can be attributed to the Device Manager system, but a lot of it can.  Most of the savings is probably in the thermostat automation, but the light management probably helps a lot.  I believe it also helps us get to sleep faster since the lights are not so bright at night.

In the next part, we will look at how using AI and machine learning makes this system even better.

 

Rethinking the Smart Home Part 1 – Offsetting power usage

Like myself, many people have grid-tied solar power generation and also like me, I suppose that many people are doing it wrong.

“Nobody uses your power better than you do” -Milton Electron Friedman

With a typical grid-tied solar system, the solar inverter converts DC power into 240V AC which feeds directly into the grid.  Using a net meter, the power company will credit you something for any power that you don’t immediately use.  After those electrons leave your house, your ability to understand how that power is being used disappears.  Your generated power may be used by one of  your neighbors to power an inefficient incandescent light bulb where 95% of that power will be wasted.  For ethical reasons, it may be best for you to use the power you generate yourself.  In the very least you’ll be able to control how the power is used towards more personally valuable objectives.

There’s also economic reasons.  Many electric companies will only credit you for the energy you generate per kilowatt-hour.  Only part of your bill is energy consumption.  The other part of your bill is transportation fees per kilowatt-hour.  The electric company may not credit you for these fees when you gift the grid your power.

How do I use more of the power I generate?

The simplest, but most expensive, is to couple your solar system with a battery system like the Tesla Powerwall.  A battery system can allow you to offset when your generated power is used.  You charge the battery when you would normally be gifting the grid and you use the power later when you need it.  A large battery system can cost tens of thousands of dollars, however, and the payoff length is long.  Some estimate 30-38 years.  My goal was to start smaller, work up, and see if we can not only build savings over time.

I started with the goal of charging my phones from battery.  This is pretty simple.  I purchased a large 3.7V lithium-ion battery for $90.  This battery is a pack of (21) 18650 cells in parallel.  The total capacity is 40 Ah or so.  To charge it, I picked up a pack of 10 TC4056A charging chips for $10.  Putting two in parallel allows me to charge at 2A via USB.  Many USB chargers won’t go over 2A, so that’s slow, but fine for now.  These also offer over-current and under-voltage protection.  Bonus.  I need to boost the 3.7 volts up to 5V to charge USB devices so I bought some 3V to 5V USB boost converters that can charge up to 2A each.

DZS Elec 2pcs Mini DC 3V to 5V 2A USB Output Step-up Charging Module Battery Converter for Mobile Mp3 Phone Charging DIY Power Supply Charger

Using this $110 battery setup, I can charge almost all the phones in my house.  I also use it to charge our fitness watches, and anything else that charges over USB.  Using it to charge my two kid’s phones, I save about $0.06 per month.  That’s not very much.  If I can utilize the entire 40Ah of the battery, I can save around $0.53 per month.  There’s only so many USB (type A) devices in my home, however.  My phone and my wife’s phone are USB type C.  These devices can charge at 5V 3A.  Furthermore, I have a laptop that also charges via USB type C.  This time, it’s at 20V 2-3A.  How do I charge those off a battery?

USB Type C charging from battery

There are already aftermarket batteries that charge both USB type A and type C devices.  Each of these however comes with unique flaws that make it unusable for my purposes.  I have a 10Ah battery and a 20Ah.  The 10Ah battery made by Anker can power up to two USB type A devices at 2A but will only do so after you hit the power button on the battery.  It’s not automatic.  The 20Ah battery, which has one USB type C port, is similar.  It won’t charge until you hit the button, but worse, it will not charge devices and allow itself to be charged at the same time.  The 20Ah battery also only charges type C devices at 5V.  This won’t work for my laptop (which alone could save at least $0.16/month if powered off-grid).

We need a type C charger that can be powered off a battery, and charge up to 20V.  I’ve searched for years trying to find one that can charge 20V.  There are many DC-DC Type C chargers made for vehicle charging of phones.  These typically come with both a type C and type A charging port.  Some can even charge at voltages as low as 2.6V (Tronsmart).  This one will work perfect for phones from my 3.7V battery.  After much searching, I finally found one that charges my laptop made by Gearmo.

It claims to support up to 60W on the type C port.  I’ve tested it with my laptop and seen it do 40W.  The point is, it works.  I have to supply 12-24V to this adapter, however.  My 3.7V battery won’t cut it.  I had about (16) 18650 laying around that I made into a 16V battery.  I configured it with four in parallel, and four in series (4S).  Each cell is 2000mAh so in total it’s about 8Ah or 118Wh (8Ah * 14.8V).  This is almost three times that capacity of my laptop.  To charge this, I spent $30 on a 700W+ Drok power supply.  I charge this battery at 5A.  I’m also using a Drok 4S battery protection board so I don’t kill the battery with under-voltage or over-current.

So now all my phones, most of my USB devices, and my laptop are all off-grid now.  How much do I save?  About $4.34/year.  Ouch.  That’s nothing.

What else can I save (future plans)?

There are actually many things that use voltages in the 5V to 12V range.  My stair lights are 5V.  My garage and front door lights are too.  Those use APA102 LED strip lights.  Those lights can consume up to 40W, but typically are around 10W.  If I can power those off of battery, that’ll save me about $20/year.  Now we are getting there.

I have several 12V devices as well.  I have two wireless access points.  Those can consume up to 46W each and are on 24/7.  These end up being the biggest pigs so far.  Almost $100 in savings.  These, however, have a maximum power usage of 1.1kWh.  Our little 16V battery is only 0.12kWh.  We need more batteries.  We only have to power these from battery during non-solar hours.  So the battery bank that powers them should be at least 500Wh.

Nissan Leaf Powerwall

Batteries made for electric vehicles can be purchased at pretty good prices.  There are dozens of videos on youtube of people using Chevy Volt batteries, Tesla, and even Nissan Leaf batteries for off-grid projects.  The Nissan Leaf battery is in a 7.4V configuration and is about 33Ah.  Two in series gives me 14.8V and about 0.49 kWh of storage.  That’s almost enough.  I picked up two of these a while back on ebay for around $100 each.  I plan on getting a few more later.

In the end, how much will I save?

With just two, plus my other two battery banks, I estimate I can save almost $115 per year.  My total cost is close to $500 but may be close to $800 when I’m all done (two more batteries, wiring, DC converters).  That’s a 5-8 year payoff.  Not bad.  Much better than the 30 years of a much more expensive unit.

This setup really only works if we have the available solar power to charge our batteries.  Since not everything in the house is going to be powered from the batteries (like the HVAC system), we need to take those devices into consideration and be smart about when we charge the batteries.  I figure that in total, these 5-12V DC devices amount to about 2.7kWh usage.  In the dead of winter, my solar system does about 4.4kWh a day average.  We have power to spare, but if we really want to save, we need to only charge the batteries when there is excess available power on top of the devices already being powered.  More on that in part 2 of this series.

How much cooling does my greenhouse need?

When looking at different cooling methods, the first thing you need to know is how much energy (heat!) you need to remove.  You have to know your energy inputs and outputs.  The inputs are primarily the sun or solar radiation, but they can also be air from the outside.  We’ll focus on solar radiation input, as it’s the biggest factor.  Our outputs are our cooling mechanisms.  Probably the most common method is simple air exchange with the outside air.  We’ll add to that list geothermal and water chillers, but we can even include evaporative coolers and traditional air conditioners.  We’ll start out with a very rough way to estimate and go into more accurate forms in subsequent blogs.

Estimating Input using the Solar Constant

The average solar radiation received by the earth is about 1300W/m^2.  After atmospheric absorption, it’s around 1000W/m^2.  That makes things easy.  All you have to do to get your radiation input is to multiply the surface area of your greenhouse by 1000.  My greenhouse is 8.9m^2 so my energy input is 8900W or 8.9kW.

Energy Input = 1000W/m^2 * GH Surface Area(m^2)

Now that we have a rough estimate how much energy we need to remove, we can look at how we can cool that with different methods.

Geothermal Water

This type of cooling requires 4 basic parts: geothermal temperature, setpoint, tubing, and a means of transferring the energy into the water.  For our setpoint, we are using 32C and assuming the geothermal temperature is 15C.

We assume for simplicity that we are able to transfer all the energy input from the sun into the water.  This is really important but we could dedicate an entire article on just this topic.  I’ll briefly mention a few methods of getting the energy into the water and move on.  Methods include: copper/aluminum air-to-water heat exchangers, tubing distributed in the greenhouse flooring (using the surface area of the greenhouse flooring to transfer the heat), direct radiation to a water reservoir.

We also don’t assume any bonus energy transfers from condensation or evaporation.

We are going to use a script I wrote to try to figure out how much tubing we are going to need to bury underground.  We run it like this:

python3 tube_length_calc.py –greenhouse redhouse.json

redhouse.json is my greenhouse and you will want to edit it for yours.  We just need greenhouse_dimensions and optionally “pump_flow_rate” for this script.  We can also change the flow rate with the “–flow_rate” option.

Tubing diameter : Watts per meter tube length
1/2in (0.0127m)  : 0.72W

Using the –tube_diameter argument we can see how much doubling the tubing size helps:

python3 tube_length_calc.py –greenhouse redhouse.json –tube_diameter 0.0254

Tubing diameter : Watts per meter tube length
1in (0.0254m) : 1.44W

I use 1/2″ tubing, so to get enough cooling for 8900W, I’d need 8900/0.72 = 12420 meters of tubing length.  That’s a lot of tubing!  Is it correct?  I am not sure.  My script is open source, so feel free to look at it and check it.  We need to be clear what the script is telling us.  It is trying to transfer all the solar radiation to the soil.  That is a factor of the thermal conductivity of soil, the temperatures of each, and the surface area in contact.  We can play around with our setpoint, the flow rate and the tubing diameter and this will change out outcome.  Most likely, geothermal will be a supplementary method used with other cooling methods.  So we can play around with the energy input as well.

Geothermal Air

Air is going to be similar to water in how we figure out how effective it will be.  We will use our tube_length_calc.py script to figure out cooling potential per meter length of tubing.  We will use the same setpoint of 32C and 15C for the geothermal temperature.  We will use 0.102m for the tubing diameter (4in pipe), and an air-flow rate of 94 liters per second (about 200 cubic feet per minute).  Like our water calculations, we are not assuming any condensation/evaporation effects which are complicated and unreliable.

python3 tube_length_calc.py –greenhouse redhouse.json –tube_diameter 0.102 –flow_rate 94

This gives us a rate of 5.77W/m of tubing.  If we use 0.152m tubing (6 inches), we get 8.59W.

We require 1038 meters of tubing for my greenhouse.  That’s still a lot of tubing, but much less.

Is geothermal air better than water?

It certainly transfers more per meter of tubing because of the increase in surface area.  Water of the same tubing size has identical using this script.  The differences are going to be in the transfer of energy to air.  Air doesn’t absorb much visible light.  So all energy absorption comes from its atoms bumping into things that do absorb the direct solar radiation.  This is a slow process because air has the worst thermal conductivity of almost anything.  The good news is the surface area is huge: effectively the entire surface area of everything in your greenhouse.

Energy transfers to water much more easily (24 times better) and can store 4 times the energy per gram, but performance is going to greatly depend on surface area of radiation to water heat exchange and the water to soil heat exchange (the tubing diameter).

Condensing Air Conditioner

These are the easiest to estimate for because they usually come with a rating in BTU/hr.  1W = 3.412BTU/hr, so we can do a simple conversion to get the required size of air conditioner.  8900 x 3.412 = 30367 BTU/hr.  These are expensive up front and expensive also to run.

Water chiller

Another expensive option is a water chiller.  There are two varieties air cooled and water cooled.  If you have need of both heating and cooling, the water cooled option is a good one.  Either option is a good addition to a geothermal  water system.  It can also be used to cool LEDs if those are water cooled.  These are usually rated in “tons”.  Each ton is equivalent to 12,000 BTU/hr or about 3500W per ton.  For my greenhouse without geothermal, I’d need a 3 ton.

Water cooled chillers require a second water loop to transfer the heat.  It can be transferred to a pool heater system, a water cooling tower, or even used to heat water for your home.

I want to look more into both advanced estimation solar input and these different cooling methods including more in subsequent blogs, so stay tuned.

Preemptive Greenhouse Cooling with Machine Learning

In order to improve cooling, I added a 1/2 HP water chiller to my system.  When used with the geothermal, it cools pretty well.  This is evident by the amount of condensation I can see on the pipes and the HVAC water reservoir:

 

and the heat exchanger:

The chiller, however, is only a bit over 400W consumption.  This means at 100% efficiency, I can remove 400W of energy.  That’s not good enough.  Using pysolar I estimate I need to remove an average of 1764W of solar energy.  Combining the chiller with geothermal, however, I have so far been able to maintain sub-40C temperatures with 22% shadecloth (1375W average solar input) at up to 30C outside.  However, near the end of the day, the reservoir sensors claims the water temperature is 30C.  I think this is higher than it actually is (sensor may be polluted by outside air due to its location), but it’s warm enough that condensation stops.  Condensation represents a nice boost in cooling because it takes more energy to phase change water gas to liquid and that energy will be pulled from the ambient air.

How much energy can my reservoir absorb?

Doing the math, I can estimate how much my 151L reservoir can absorb at different starting temperatures.  If I can start my reservoir at 9C, it can absorb around 245W of energy throughout the day (15 hours until it reaches 30C).

This is more than enough even without any bonuses from condensation.  So how do I get my reservoir that cool at the beginning of the day?  One established method is to pre-cool the reservoir during the night.

Pre-cooling and saving energy

It would be relatively easy to pre-cool the reservoir at night.  I just keep the geothermal pump and HVAC pumps going at night until I reach the desired temperature.  However, if I want to maximize efficiency, I need to understand the next day’s needs.  I need to preemptively decide whether or not pre-cooling is necessary.  If it’s going to rain the following day, and solar radiation drops below 400-500W/m^2, I don’t need to pre-cool.  How do I understand my future needs so that I can be efficient in how I pre-cool?

Weather forecast is inadequate

I can easily get tomorrows estimated maximum temperature.  However, this is not adequate.  In a greenhouse, it may be 15C outside, but if there’s high solar radiation, it will easily be 30C or higher inside the greenhouse.   I cannot use predicted outside temperatures alone in my preemptive decision.  If I knew the forecast for solar radiation, I could base my preemption on that.  However, the Weather Underground (WU) forecast API, the API I’m currently using, doesn’t have solar radiation estimates/predictions.

Machine learning to predict greenhouse temperature

I can get tomorrows and historic atmospheric conditions from the WU API.  This will give me a rough idea how much solar radiation I’ll have.  I also have a couple years worth of greenhouse temperature data.  Using Tensorflow, I should be able to train a neural network linear regression model using historic weather data and data for my greenhouse and use that model to predict future temperatures using weather forecasts.

To start out with, I used 2 months worth of data.  The data retreival process was the slowest part.  With a free WU API account, I can only get 10 API calls per minute.  Once complete, I have 3700+ data points to work with.  I can expand this to more data as needed (depending on accuracy requirements).

Machine learning prediction results

Looks like my prediction results are within about 4-5C.  I selected 3 recent temperature points and associated conditions over the past week to test:

Outside Temperature: 15.1C
Condition: “Overcast”
Prediction: 18.5C
Actual: 17.9C

Outside Temperature: 17.7C
Condition: “PartlyCloudy”
Prediction: 21C
Actual: 25.8C

Outside Temperature: 27.2C
Condition: “Clear”
Prediction: 32.5C
Actual: 36.6C

This level of accuracy might be fine.  If it predicts anything over 23 (which is my typical setpoint), I’ll know I need to preemptively cool during the night.

Efficient Method of preemptive cooling

I have up to three sources of cooling at night.  The air using the HVAC heat exchanger and fans, the geothermal system, and finally the chiller.  Understanding when to use which will help me cool most efficiently.  My algorithm is roughly this:

  • Use HVAC heat exchange fans and all pumps until reservoir is within 1C of the air temperature
  • Disengage the HVAC fans (180W savings)
  • Continue using geothermal pump until water is within 1C of geothermal battery temperature (I estimate at 12C)
  • Disengage the geothermal pump (60W savings)
  • Continue using chiller pump until water reaches 4C.

Measuring success

The entire system is just about in place.  There’s a few bugs to work out with using the machine learning model and I still need to separate the pumps onto different power supplies.  I have, however, been doing well using only the forecast max temperature to decide preemption and I believe it’s been working.  To determine this objectively, I should be able to look at non-preemptive cooling minimum and maximum deltas between the indoor and outdoor temperatures.  The smaller the difference should mean better cooling.  I started preemptively cooling using the temperature method on 6-6, 2017.  I started preemptively cooling using machine learning on 6-18.  Let’s pull min/max data from may, and compare it to data between 6-6 and 6-15 (a few days before any changes for good measure).  The results look promising:

5-6 to 6-5:

  • min delta: -3.8
  • max delta: 30.0
  • mean delta: 4.0

After 6-6:

  • min delta: -1.0
  • max delta: 15.6
  • mean delta: 3.1

The max of 30 may be anomalous (ie, during a power out), but doing a mean should weed those out.  After implementing preemptive cooling, I’m getting almost 1C better temperatures.  Once I have the machine learning and other improvements made, I’ll check again and see if I see additional improvements.

UPDATE (7/18/2017):

Math about how much energy a 151kg could absorb over a day was incorrect.  Fixed math to cover 15hr period instead of merely 1hr.

Also fixed greenhouse estimated solar input.  New estimate computed with pysolar.

Using the SCIO in gardening

Ages ago, I funded a kickstarter for a “consumer molecular scanner”.  It’s a pocket spectrometer of sorts that can be used with your smartphone to analyse the chemical composition of just about anything.  It works by spraying an object with photons from an LED on the device.  Different chemicals react differently with different wavelengths of photons.  On the device is a sensor, that analysis which photons bounce back.

The android app that you use with the device, communicates over bluetooth to read data.  Data is then sent to the cloud for analysis.  What comes back is a spectrum that represents the object.  Included in the app are a number of applets for doing things from estimating body fat to estimating the BRIX rating of a fruit product.  You can also create your own “mini-applet” to capture and analyze your own objects.

Tomato leaf deficiency mini-applet

I wanted to create a mini-applet to analyse tomato leaves and perhaps identify any deficiencies.  I started with some healthy leaves and took some scans.  Unfortunately, I need to produce leaves with known deficiencies, scan those leaves and name those scans after the deficiency for this to be really useful.  I did however, notice some strange leaf formation, took some scans and the results were different than the normal “healthy” leaf.  If I can identify this as a nutrient deficiency, I’ll have a good way of identifying it moving forward.

Produce Selector applet

This is a built-in applet that allows you to scan your favorite fruit and get a BRIX rating.  BRIX is basically the sugar content in a solution.  Unfortunately for this applet, it didn’t recognize any tomato I scanned :(.  I scanned my unripe fruit and the store bought roma tomato.  I provided feedback via the app to the developers.  I hope there will be an update soon.

Fruit and Vegetable applet

This applet lets you estimate the carb content in the fruit or vegetable.  I used this on my unripe tomato growing in my greenhouse.  It came up with 5% carbs.

I snapped a picture of the fruit and I’ll be able to check later for changes.  I’m exciting to see what happens over time with these readings.  Here’s the “spectral fingerprint” from my phone (5/10/17):

For comparison purposes, I scanned a store-bought roma tomato.  The readings were identical from what I can tell and I’m not sure exactly what that means yet, but another scan of my greenhouse fruit when its ripe might reveal something.

 Conclusion

The SCIO is pretty fun.  I foresee it will be very useful moving forward to help identify plant and fruit quality.

Winter 2016-2017 learnings

What I learned (so you won’t have to)

My goal for this project is to grow tomatoes (and possibly other warm-weather crops) all year round in my greenhouse. I learned several things from my winter experience this year.  I thought I’d record them here to benefit anyone else out there trying to grow tomatoes year-round in uncooperative environments.

For the record.  I “shut-down” the greenhouse in mid-December.  This year (La Nina year), was below average cold for my area.  There just wasn’t enough produce to justify the propane heating cost which was turning out to be double what I expected (9 kg of fuel per month).  Further, there was no future produce either as flowers were not setting fruit.  Reasons listed below.

Light is essential

No duh, right?  This winter, I did not have supplemental lighting.  As a result, growth was slow, the plans were weak, and fruit didn’t set.  A lot of this has to do with improper temperatures, but I believe light was a major factor this year.

Geothermal is unhelpful for winter tomatoes

The concept behind geothermal in the winter is that you can store energy during the day, and recover it at night.  In addition, since the geothermal “battery” recharges from the surrounding soil, there’s a temperature floor which helps keep air temperatures at night above freezing.

The problem with the theory is when there is little to no energy input geothermal temperatures are too low for tomatoes.  Without the sun, which is typical for winters in my area, there’s no “free energy” to store during the day.  To supplement the lack of solar energy, I have a propane water heater as a backup heating source.  This energy isn’t “free” light sunlight and I don’t need to store it in the ground.  In fact, it’s inefficient to store it in the ground during the day because just like the geothermal battery “recharges” from the surrounding soil, the surrounding soil also “recharges” from the geothermal battery when the battery has a higher temperature.  The energy losses to the surrounding soil resulted in lower than acceptable air and soil bed temperatures and wasted propane.  The lower temperatures with the light problems led to slow growth and a lack of fruit production.

When I turned the greenhouse back on, I added a bypass manifold that separated the geothermal from the bed and aisle lines.  Now I can provide radiant heating directly from the propane water heater without any losses to the earth.

The result was very positive.  The water reservoir heated up enough that it was warm to the touch.  Soil temperatures went from just 11C to above 16C (March 6th).

Don’t shut down your greenhouse

When I shut down, temperatures were allowed to drop extremely low.  It was cold enough to crack some PVC pipes, and burst copper tubes in every single heat exchanger in the greenhouse including the propane water heater.  The damage was close to $500…  (all in the name of saving $20 worth of propane).  Instead of shutting down, I should have just lowered the set-point to around 3C.

Genetics is everything

A number of my tomato plants had poor yields, even in the summer time.  Among the poor producers was the San Marzano that I got from The Home Depot.  This was especially disappointing as even my grafted San Marzano produced almost nothing.  I’m not sure why the San Marzanos didn’t produce well in my greenhouse, but this year I’m trying a greenhouse-specific hybrid: The Pozzano.  This is supposed to be the same style as the San Marzano (paste/plum tomato), but really excels in the greenhouse.  We’ll see.  So far the plants I have look promising.

A new start

It took a while to repair and get things running again.  Sometime learning is expensive and I sure learned a lot this year.  Early February, I was able to transplant some new Pozzano plants into the greenhouse.  I have 7 new plants and 5 of the 7 have flowers.  This is going to be year 3 and I’m hoping this will be the year it “just works”.  Summer is coming and I have big plans, but I’ll save that for the next post.

Estimating light energy requirements by CO2 consumption rate

Plants use carbon dioxide and water to make sugar.  They use light energy to power this operation.  I wanted to see if I could estimate light energy requirements by the rate at which my plants are consuming CO2.  With that information, maybe I can vary my LED light intensity to match those requirements.

NOTE: I’m already varying my LED intensity based on how much sunlight I’m getting.  You can see that blog here.

Energy required per gram of CO2

1g of hydrogen = 5.02e22 elements.
CO2 weighs as much as 44 hydrogen elements.
1g CO2 = 5.02e22 / 44 = 1.1e21

It takes about 60 photons of light to break down 1 molecule of CO2 and sugarize it. The average energy of a 550nm photon is 3.63e-19 Joules.

Energy per molecule of CO2 = 60 x 3.62e-19 = 2.17e-17
Energy per gram of CO2 = 2.17e-17 x 1.1e21 = 24741 Joules or 24kJ.

The ratio of grams CO2 to plant sugar (6CH12O6) is 1.4:1. So for every 1g CO2 consumed, your plant increases in mass 0.6g. So 1g of growth requires about 40kJ of energy.

According to this website, plants consume about 2.40g/h/m2 of CO2.  That’s about 57.6kJ of energy over the span of 1 hour or about 16W per square meter ( 57600/3600).  It’s not clear on the website, but I believe that’s using the CO2 concentration of 1300ppm.  Consumption will also vary by plant, temperature, water, nutrients and other conditions.  If you happen to find plant specific CO2 consumption rates, or consumption rates per concentration CO2, please comment below with the source.

Plants only use 16W per square meter

Full sunlight at the earths surface is about 1000W/m^2.  Is it possible that plants only use 1.6% of the sunlight that hits them?

Light technology efficiency

LEDs are about 40% efficient (theoretical maximum efficiency).  That means a 100W LED will produce about 40W of light energy.  We need to assume that a certain percentage of the light isn’t going to hit the plant.  This is difficult to measure, so let’s just assume only 10% of the light actually hits the plant.  So a 100W LED would have about 4W actually hit the plant.  That would mean we need about 400W of LEDs per meter to reach our 16W of required light energy.  We can play around with that “plant penetration” percentage too.  At 50% penetration, we only need 100W/m^2.  I’ve prepared a calculator spreadsheet that uses the knowledge we developed here to calculate light power requirements.

Calculating Greenhouse CO2 infiltration/leakage

At the moment, my greenhouse is somewhat empty.  I can write a simple python script that will bring the CO2 reading up to 1000ppm, and then measure how long it takes for the CO2 reading to reach ambient levels (for my sensor, that’s about 460ppm).

I’ll take the reading in a different blog, but we can do the math here.

Actual CO2 consumption = (CO2 Reading 1 – CO2 Reading 2) – Leakage Rate

Light Power Required = (Actual CO2 Consumption x 24000) / 3600

Now that we have the light required, we can plug the data into our calculator and see what our light level should be.  My light intensity is controlled by PWM rate programatically so we can plug these calculations into the automation algorithm.

PID my lights

Now that we have a light rate, we can actually use a PID controller to check our light vs CO2 consumption rate.  The setpoint should be set to the maximum CO2 consumption rate we can achieve.  We can try to use the number we got above (2.4g/h/m2) or we can observe our greenhouse full of plants over time and get a maximum rate.  We can also start low and adjust over time.  The minumum rate is 1.2g/h/m2.  For this example, I’ll use the python pid module but you can adapt it to whichever PID library you use.  Most of this is just psuedo code, so keep that in mind.

 

Future work

Our set point can actually change over time based upon the actual plant size and health.  We should implement some machine-learning and change the set_point accordingly.  For example, if we are never reaching our setpoint and the lights are always on, we should accept the current co2_rate as the new setpoint.  Also, any time our co2_rate is higher than our setpoint, the co2_rate should become the new setpoint.  After all, we are trying to maximize CO2 consumption.

Also, since temperature is also a significant component in co2 usage and photosythesis, we can create a second PID controller that controlls temperature and tries to find the temperature that will give us the maximum co2 consumption rate.

Conclusion

My previous method of light control was based upon light level readings and assumed plant requirements (ie 8hrs of “full sun” per day).  I think this method is much more accurate because CO2 consumption by the plant and photosynthesis are very strongly correlated.  It is still probably important not to give your plants more light in terms of total on time than is necessary.  The rule of thumb is up to 16 hours depending on the plant and stage of growth… however, if CO2 consumption goes on and on past 16 hours, maybe we should call into question the 16 hour rule.

I’m going to be implementing this new method of light control and I’ll post back on my results.  As I said, right now my greenhouse is mostly empty, so I imagine that the results will be several months away.  Remind me if I forget to blog about what I observed from this method.

Geothermal air vs water – The math

Math is hard… especially in complex systems.  Therefore what I’m about to do may have errors.  There may be holes in my understanding.  Hopefully, if you see an error or hole, you’ll let me know.  Here goes…

Air holds less energy than water.  About 4 times less.  That means that you can sink lots of energy into water without raising its temperature much.  Water can also transfer energy (thermal conductivity) better than air.  These attributes should make water superior to air at heating or cooling, right?  Well, as I have learned, maybe not.

Air contains water.  Up to 2% of air is water vapor.  How many grams of water per cubic meter of air depends on the air’s temperature. The warmer the air is, the more water it can hold.  For example, one cubic meter of air (1.2kg) at 30C can contain 30g of water at 100% saturation or 100% humidity.  At 15C, air only can hold 12g of water (again at 100% humidity).  I’ll be using those temperatures later in my examples, so take note.

Latent heat

When water changes from a liquid state, to a gas state (and vice-versa), it takes a certain amount of energy.  It takes 2257 joules per gram of liquid water to change it from a liquid to gas.  In my understanding, the energy to phase change the water will come from the warmest available source.  In a geothermal cooling situation, the energy is going to come from the air because it’s warmer.  We can calculate, then, how much energy will be taken out of the air as it goes from one temperature to another.  We can estimate a best-case energy transfer air to a 15C geothermal thermal mass.  I compiled the following chart showing the best-case performance of geothermal air per humidity level:

geothermal-air

From the chart, we can see that it’s possible to condense 100% of the available air above 50% humidity.  We also see that we move about 18,000 joules of energy from the air during this transfer.  By contrast, taking the same mass of water (1.2kg) from 30C to 15C without any phase changes transfers 75,312 joules.  Even with the latent bonus, more energy is being transferred with water.

The devil is in the details.  How quickly can you transfer that amount of energy using the various mediums and what is the cost are really the questions.  How likely is it that you will be able to achieve a water temperature shift from 30C to 15C?  I guess it depends on the amount of tubing in the ground.  Likewise, we are making assumptions about the air system -that all available water has been condensed and the humidity of the air coming out is almost 100%.

Update (2016/10/24): I originally claimed the air coming out would be 0%.  That is incorrect since not all the water vapor will be condensed.

Too make the muddy water less clear, a geothermal water system isn’t exactly 100% sensible (no phase changes).  For example, I see water condensing around my heat exchanger.  Water can also condense around the reservoir surface area but I have not noticed it (nor have I looked for it).  This condensing effect might be just as good as a geothermal air system, but I don’t have the proper tools to test it and my temperatures are probably not warm enough to do the testing until next year anyway.  So we’ll have to leave that as an open question: does the latent effects of a water system with heat exchanger equal that of a geothermal air system?

Heating

Air is probably better at cooling than it will be at heating.  The main reason is that the amount of moisture that the air can hold at cool temperatures is low.  If you live in an area like mine where the cool months still have high humidity, this effect is reduced even more because there just won’t be the excess capacity in the air to hold any water vapor.  Without water vaporizing or condensing, there will be no latent heating bonus.

I put together a similar chart showing, again, best-case results where the air picks up as much moisture from the soil as possible (achieving 100% humidity every pass).  I’m assuming that air that wicks up moisture gains the energy from the phase change of liquid from the soil to gas.  I started with an air temperature of 0C and a geothermal mass of 10C.

geothermal-air1

Both tables are available here: https://docs.google.com/spreadsheets/d/17UPHaWa3gyW5nGFhePqA4NapztrVFfzKLJVkps7rV2w/edit?usp=sharing

How does that compare to water?  Well, to take 1.2kg of 0C water to 10C takes 51000 joules of energy (ignoring phase change).  That’s enough to warm the air to “7.2C” over 50 times.  At one complete exchange of the loop per minute, it will take about 22 hours for the water to achieve that temperature.

Costs

The up front costs of geothermal air are higher than geothermal water.  For 200 meters of corrugated 6 inch tubing, the cost is around $500 dollars.  For the same length of 1/2″ PEX tubing, it will cost less than $200 dollars.  The blower is also more expensive than the pump.  Below I’ve listed prices I found for both systems:geothermal-air2

What about runtime costs?  The pump consumes around 70W.  This dayton blower consumes above 200W at full speed.  The fan on the heat exchanger runs at about 90W.  So even though the water system has more components, the total sum of components uses less power than the air system.

Utility

Utility is how useful a thing is.  If it has more than one uses, the better.  Are there multiple uses for the air we can take advantage of?  Yes.  We can use the cool air from the geothermal system to cool lighting such as LEDs but we need extra fans.  Ambient air cooling will probably not be  adequate.  Channeling the air might also be difficult.

Water will have much more utility.  Water is going to be better for spot cooling things and for moving energy around.  The tubing is much smaller and cheaper and pumps are less expensive.  You can use the same pump for the entire system where with air, multiple fans are requires for spot applications.  The costs add up.  We can easily use a water system to spot cool CO2 generators, lights, and virtually anything else we need to without any additional moving parts or electrical components (generally just tubes and adapters).

Conclusion

Geothermal with air as a medium might be better than water at cooling if water has no latent effects.  If water does have latent effects and if latent effects are equal, water is probably better due to it’s capacity to store energy.

The latent effects of air for cooling are diminished in dry environments when air is below 50% humidity.  Humidity in high desert states like Utah may not get over 30% during summer days.

For heating, the endothermic bonus for air is not great and since it cannot be used as thermal mass, water could be better.

Temperature stability is going to be better with water because the required amount of energy to change the water’s temperature is greater.

Utility is also better for water because it can be used to spot cool virtually anything without adding additional costs relative to trying to spot cool with air.