Arduino Climate Control

@bobinca I have my lower limit set to 68.5F and upper limit at 75F. The upper temp tends to drift up to 77-78F now that winter is over. For right now I am only using an Amazon $20 outlet thermostat to control my heater and I have the inline fan on a manual variable speed control and it is constantly running so I have been able to dial in a good temp/humidity balance. Eventually I want to change these so I can have some tighter tolerance and control.

It's interesting to see the changes through out the day.

data.jpg
 
@Dro yeah, I love watching the graphs.

I thought of something else to graph, energy usage and costs. It will just be an estimate. I know the amount of time each device (heater, a/c, etc) is on. I will just multiply by the maker's wattage listing. I think I will eventually get a watt meter to see what each device actually uses.

My electricity is pretty expensive during the day. Here is what I have to calculate the cost of a device. I will run the code each hour for the total time in that hour each device was on.

I will post some graphs after I get a couple of days of good data.

C++:
float cost(float kwatts) {
  time_t n = now();
  n-=SECS_PER_HOUR; // previous hour, this will run about 30 seconds after the hour changes
  int h = hour(n);
  int dayOfWeek = weekday(n);
  int schedule = 0; // 0 = off peak, 1 = partial peak, 2 = peak
  float cost;
 
  if (dayOfWeek==1 || dayOfWeek==7) { // saturday and sunday
    if (h>=15 && h<19) {
      schedule = 2;
    } else {
      schedule = 0;
    }
  } else {
    if (h>=14 && h<21) {
      schedule = 2;
    } else if (h>=7 && h<14) {
      schedule = 1;
    } else if (h>=21 && h<23) {
      schedule = 1;
    } else {
      schedule = 0;
    }
  }
  // summer
  if (month(n)>=5 && month(n)<=10) { // May until Oct
    if (schedule == 2) {
      cost = 0.48220;
    } else if (schedule == 1) {
      cost = 0.26168;
    } else {
      cost = 0.12511;
    }
  } else {
    // winter
    if (schedule == 2) {
      cost = 0.33308;
    } else if (schedule == 1) {
      cost = 0.20370;
    } else {
      cost = 0.12815;
    }
  }
  return cost * kwatts;
}
 
@Dro yeah, I love watching the graphs.

I thought of something else to graph, energy usage and costs. It will just be an estimate. I know the amount of time each device (heater, a/c, etc) is on. I will just multiply by the maker's wattage listing. I think I will eventually get a watt meter to see what each device actually uses.

My electricity is pretty expensive during the day. Here is what I have to calculate the cost of a device. I will run the code each hour for the total time in that hour each device was on.

I will post some graphs after I get a couple of days of good data.

C++:
float cost(float kwatts) {
  time_t n = now();
  n-=SECS_PER_HOUR; // previous hour, this will run about 30 seconds after the hour changes
  int h = hour(n);
  int dayOfWeek = weekday(n);
  int schedule = 0; // 0 = off peak, 1 = partial peak, 2 = peak
  float cost;
 
  if (dayOfWeek==1 || dayOfWeek==7) { // saturday and sunday
    if (h>=15 && h<19) {
      schedule = 2;
    } else {
      schedule = 0;
    }
  } else {
    if (h>=14 && h<21) {
      schedule = 2;
    } else if (h>=7 && h<14) {
      schedule = 1;
    } else if (h>=21 && h<23) {
      schedule = 1;
    } else {
      schedule = 0;
    }
  }
  // summer
  if (month(n)>=5 && month(n)<=10) { // May until Oct
    if (schedule == 2) {
      cost = 0.48220;
    } else if (schedule == 1) {
      cost = 0.26168;
    } else {
      cost = 0.12511;
    }
  } else {
    // winter
    if (schedule == 2) {
      cost = 0.33308;
    } else if (schedule == 1) {
      cost = 0.20370;
    } else {
      cost = 0.12815;
    }
  }
  return cost * kwatts;
}

That's great idea! I was actually looking into current sensors that I can hook up to track this as well but your idea is awesome!

I have been slacking a bit on the Arduino "tools" side of my grow. Gotta wrap up the PCB design this week so I can get it built. I could just hook it all in on proto board but I kinda want it to be a bit clean.

Also, I am thinking about sending my sensor data straight to Google sheets so I can keep it as a log. Right now I have to download the csv file from adafruit IO then upload it in Google sheets... I have already forgotten to do this a couple times and my data is all over the place it is starting to drive me nuts.
 
I have my first 24 hours of data for runtime and costs for my connected devices. I'm surprised that the highest costs go to my heaters, combined they cost 90 cents for the 24 hour period. Second was lights at 84 cents. Today wasn't that hot, so the A/C didn't need to run too much. But considering the lights are 300 watts and the A/C is 400 watts, I guess lights will always be a big energy consumer. The total grow cost for the day was about $2. Energy is cheaper at night so I could save 50 cents off that by running the lights at night, but that would make it harder to check in on them while I'm awake. Notice the yellow line for lights in the cost graph jumps from 5.8 to 9.5 cents per hour at 2pm even though I didn't turn on any additional lights. Once May starts that jump will be even bigger (winter peak cost of 33 cents per kwh vs summer peak cost of 48 cents per kwh), so maybe at some point I will try to run my lights during non peak hours.

1771760
 
My humidifier ran out of water yesterday and even after I noticed it couldn't do anything about it. I was watching my kids and since I want to keep this private from them I couldn't just go into the attic to refill it. This got me thinking that maybe I need to two humidifiers and with an automatic fail over. After 10 minutes if one is is on and the humidity doesn't go down, I can assume it is out of water. This will give me a couple of days to fix the one that ran out before it affects the plants. Just a thought. I will have to figure out if I actually have room for another one.

I did notice something while the humidity dropped to 40, my a/c stay on continuously for an hour. At first I thought there was something wrong because it usually only runs for 5 minutes at a time, but I saw that the temp was a pleasant 73 degrees for that hour. The a/c has a temp nob, now I think I know why it doesn't have numbers on it, it is affected by humidity. I believe when the humidity lowered the temp setting triggered the compressor to turn off. It certainly maintained the temperature better than I was doing by letting it get to 78 then turn the a/c on and turn it off at 72. I did this wide range because otherwise it would want to turn off/on every couple of minutes. Now maybe I will adjust the temp nob a bit more and when humidity is properly restored I can leave my same numbers to turn it on/off, but now it will stay on much longer and hopefully maintain 75. This will invalidate my energy readings based on device runtime since I won't know when the a/c compressor is on, but I think it might be worth it to get a much smoother temperature range.

I circled the mysterious smooth temperature readying that was way lower than the attic temp of 92 at the time. On both sides of the smooth areas the temperature swings are caused by the a/c coming on a 78 and turning off at 72

1772739
 
Have you considered a float valve for your humidifier?
This is a cheap humidifier that fills the tank from the bottom. I think it would be hard to do a float in there, but I have seen a float in my larger 6 gallon humidifier I use for the whole house. I've also seen sensors that can detect liquid through a plastic wall that look interesting or even just using a pressure sensor for weight. Before the a/c, the humidifier would last 2-3 weeks for that one gallon. Now I seem to go just a couple of days.

For the short term I guess I just need to top if off the 2 times a week I physically check on things. Long term, I'm not sure. Maybe since I won't be drying when I go on my 3 week vacation this summer, I can use my 16x16 inch drying area to hold a 6 gallon humidifier. I actually have a gallon humidifier still in the box. I ordered one last year and for some reason amazon sent me two :)

So far I have really enjoyed this project, there are just so many possibilities to all the problems that come up. It definitely keeps the brain active.
 
This is a cheap humidifier that fills the tank from the bottom. I think it would be hard to do a float in there, but I have seen a float in my larger 6 gallon humidifier I use for the whole house. I've also seen sensors that can detect liquid through a plastic wall that look interesting or even just using a pressure sensor for weight. Before the a/c, the humidifier would last 2-3 weeks for that one gallon. Now I seem to go just a couple of days.

For the short term I guess I just need to top if off the 2 times a week I physically check on things. Long term, I'm not sure. Maybe since I won't be drying when I go on my 3 week vacation this summer, I can use my 16x16 inch drying area to hold a 6 gallon humidifier. I actually have a gallon humidifier still in the box. I ordered one last year and for some reason amazon sent me two :)

So far I have really enjoyed this project, there are just so many possibilities to all the problems that come up. It definitely keeps the brain active.
How about running the drain from the A/C into the humidifier, since it's the humidity thief.
 
How about running the drain from the A/C into the humidifier, since it's the humidity thief.

I guess the A/C is too advanced, it self evaporates. So far I haven't seen a single drop from it.
 
What about something like the soil moisture sensors, except they will either be dipped in water, or dry, you'll be able to read it and see when the level falls below the sensor, and you could activate pump to add more water? Even just a pair of wires fastened to the inside of the chamber with the ends bared...
 
@odam2k I don't have automatic watering done yet, but it is next on my list of things to do. Once that is up and running and I have a bucket of water near by that might be an option. I'm a little nervous about storing too much water in the attic, I wouldn't want a leak. Maybe before that I should figure out a way to lift everything up a few inches then I could drain any leaks with gravity to the near by house HVAC drain pan.
 
Things have definitely slowed down this week. I added a second fan to move air from one part of my corner of the attic to another. When I'm in the attic I noticed my corner was much warmer. This should help bring down the temps. I'm also experimenting with turning down the temp nob on the a/c. I'm hoping I will hit a spot where it can manage the temperature for me more smoothly than I can with the arduino. Right now I turn off the a/c when it hits 72 degrees. I'm trying to prevent things from turning on/off every minute so I put a 10 minute delay for the heater or a/c to turn on again after one of them turns off. During that 10 minutes the temp can shoot back up pretty quickly. So I will see temperature swings from 72 to 84. I'm hopeful my second fan will help by controlling ambient temperature. But in the summer there won't be much I can do. My tents just have no insulation so I will have to accept that the a/c will be on continuously during the day.

Overall I'm controlling temperature and humidity pretty well, here is the last 48 hours

1776135


Since I have security cameras in the tents I'm also starting to experiment with time lapse. Unfortunately it will take a couple of weeks before I have something interesting to show.
 
How did you end up turning the A/C on and off? Did you modify it, or just plug it into an outlet controlled by a relay? If using a relay, did you use something special, or just a regular blue 5v one?
 
I'm using a controllable power strip. It's kind of pricey compared to the relays I'm exploring for the 9v pumps. But I didn't want to risk anything with 120v.

 
I'm using a controllable power strip. It's kind of pricey compared to the relays I'm exploring for the 9v pumps. But I didn't want to risk anything with 120v.


Seems like a good idea. I'm a little leery of using one of those tiny blue relays to control a 400W light, although I'm sure it's well within the relay's capability...

The powerstrip with shipping comes to about $63 Canadian.... Seems expensive, but I'd probably sleep better...
 
yeah, the shipping adds up. I bought a few of them and some other stuff. I think I spent more than $200 and got free shipping.

I just wish each socket was it's own relay. But overall I was happy with it.

As for lights, I still use a timer. I didn't want to worry about the lights going on/off everytime I rebooted the device for a software update.
 
No, I just use a regular timer, not with that power strip. If I use the power strip to control the lights, then the lights would go on and off when the arduino controlling the power strip reboots.
 
Ah, ok, I thought maybe they had a workaround for that...
Need to solve that problem, somebody must be controlling lights with an arduino :)
 
Back
Top Bottom