Arduino Climate Control

I just googled it, and it looks like it just outputs PWM to a PWM LED Controller...

It does do some pretty cool stuff, providing realistic lighting for an aquarium, including the ability to enter coordinates, and it will emulate sunrise/sunset for that location... and lightning, etc... not much use for us though...

We threw some ideas around on another thread, and when I can find time, I'll see if I can get something working using an arduino and a relay...

My project I started uses Mega and I hook up 2 relay boards that have 4 relays on each...2 run lights and 2 run watering pumps.
I also changed 2 of the relays on each board to match the proper amps the lights were pulling.
If your lights pull say 3-4 amps then make sure you use MIN 5 amp relay or even better a 10amp.
I think I paid like $8-10 on Aliexpress for each one and another $5 or so on relays...so $20-25 total.
 
Once the plants are bigger, then you can just position the camera somewhere on the whole floor space in that tent, may
My project I started uses Mega and I hook up 2 relay boards that have 4 relays on each...2 run lights and 2 run watering pumps.
I also changed 2 of the relays on each board to match the proper amps the lights were pulling.
If your lights pull say 3-4 amps then make sure you use MIN 5 amp relay or even better a 10amp.
I think I paid like $8-10 on Aliexpress for each one and another $5 or so on relays...so $20-25 total.


What happens when the Mega reboots? Usually a relay will "de-power" so if the relay is normally open, and the lights are on, then the relay will be closed (powered) and when it reboots, it loses power, your lights go out, and then back on once the Mega powers the relay again. Were you able to overcome this?
 
What happens when the Mega reboots? Usually a relay will "de-power" so if the relay is normally open, and the lights are on, then the relay will be closed (powered) and when it reboots, it loses power, your lights go out, and then back on once the Mega powers the relay again. Were you able to overcome this?

I just did all the time checks to include the current time.
Each time mega boots up it does time check and then I cycle through time checks for each thing...lights or pumps...so it does 8 checks and turns on or off.
So if its night time and things reboot...it may flicker for a brief second then shuts off immediately and turns on and stays on if it should be.
hope that made some sense...lol
 
You must be using LED lights? I'm using HID (MH and HPS) so I need to make sure it does not flicker the lights. I'm pretty sure I have a design that will work, but I haven't implemented it yet, or even tried a proof of concept, my ToDo list is huge! :)
 
You must be using LED lights? I'm using HID (MH and HPS) so I need to make sure it does not flicker the lights. I'm pretty sure I have a design that will work, but I haven't implemented it yet, or even tried a proof of concept, my ToDo list is huge! :)

Well even the HID should be fine...unless the Mega reboots continuously...the brief split second the relay jumps won't be long enough for the HID to kick back in...if they should be off.
And if they should be on well the relay will turn on, but it may take a moment for some HID to start back up.
Also even if a plant get a few seconds of light when it should be dark doesn't do anything...that I could see.
I actually use yes LEDs (about 3.75amps x 2) and also have florescent (about 1.75amps x 2) on the relays.
link to thread on what I did ...not to hijack this one with my info...lol
 
In volatile memory have a variable indicating *Power Loss
Test that variable first when the Arduino boots.
If it's true:
  • go through a routine to immediately shut everything off;
  • go through a catch up routine to set everything where it should be 30 seconds from now;
  • wait for the 30 seconds to elapse;
  • set all outputs where they belong; and
  • continue running.
The other method is to have battery backup for your Arduino, and raise an interrupt when the power goes out. The relays should not be powered by the Arduino battery backup. Then go through the above routine. You can extend the time if you find that it is too short.
 
I'm sure the 15 seconds of darkness won't harm the plants, but I guess I'm just a little paranoid about that. The wall timer just seems too dependable to mess with what works. I like the idea of controlling my lights with the arduino. In fact I coded it the same way, where during boot it will check if it should be on. My arduino's are connected to a small pc that powers them via USB and the pc is on a UPS. So I'm only really worried about random reboots and software updates (which I guess I could time to happen when the lights are out).

The advantages of the arduino is that if the power really goes out for a couple of hours, when it comes back on it will be on the same time schedule, where as the wall timer will be off by those couple of hours.
 
I'm sure the 15 seconds of darkness won't harm the plants, but I guess I'm just a little paranoid about that. The wall timer just seems too dependable to mess with what works. I like the idea of controlling my lights with the arduino. In fact I coded it the same way, where during boot it will check if it should be on. My arduino's are connected to a small pc that powers them via USB and the pc is on a UPS. So I'm only really worried about random reboots and software updates (which I guess I could time to happen when the lights are out).

The advantages of the arduino is that if the power really goes out for a couple of hours, when it comes back on it will be on the same time schedule, where as the wall timer will be off by those couple of hours.

Some timers have battery backup...digital ones, but yes I too wanted the ability to have battery backup and figured why buy 8 timers when I can use 1 Arduino and 2 relay boards...screen and stuff I got just because I figured it would be handy to have :p
I run mine from a 4 port USB hub. I had to use seperate 5V rails due to arduino crashing sometimes randomly...was drawing too much on PC 5v USB rail with 8 sensors, 2 relay boards, RTC and LCD.
So if power is out the Arduino is out too...power comes on everything picks up where it left off and it cycles its checks again...simple for me to use...lol
 
Some timers have battery backup...digital ones, but yes I too wanted the ability to have battery backup and figured why buy 8 timers when I can use 1 Arduino and 2 relay boards...screen and stuff I got just because I figured it would be handy to have :p
I run mine from a 4 port USB hub. I had to use seperate 5V rails due to arduino crashing sometimes randomly...was drawing too much on PC 5v USB rail with 8 sensors, 2 relay boards, RTC and LCD.
So if power is out the Arduino is out too...power comes on everything picks up where it left off and it cycles its checks again...simple for me to use...lol

On a module, all i2c devices are on the same "buss" which gets its power from an external 5v supply, and the Mega's are powered from an external 12v supply. Solved all my power issues...

I'm sure the 15 seconds of darkness won't harm the plants, but I guess I'm just a little paranoid about that.

I'm mostly concerned about the lights themselves, darkness during the light period won't have any negative effect on the plants unless it's dark for hours, even still, not a big deal...

What worries me is the strain on the light if the arduino reboots during lights on, then the relay will cause the lights to go off, and a second later, back on. The lights generally have hot start protection, but I happen to have a VERY OLD Metal Halide ballast (in fact, so old, it might be the original prototype for HID's!!! <just kidding>).

In any case, it can't be good for the lights...

As I said, I'm pretty sure I have a solution somewhere in my thread, I'll have to go look for it again, I've forgotten :(
I suppose I should make that more of a priority, I've already written all the code for it, in fact, I used it already for the small LED bulb for my clones but never implemented it for the HID's due to the above issue...
 
So if its night time and things reboot...it may flicker for a brief second then shuts off immediately and turns on and stays on if it should be.

Has anyone discussed latching? I remember playing around with a latching configuration composed of standard momentary relays... similar to this. Also, I track state in non-volatile memory (EEPROM or SPIFFS) and return to this on power loss if the power loss was momentary. If I had momentarily overridden a timed circuit, I DO NOT want that state to revert on power loss. Although exciting, it's not a fun to clean up after a sump pump unexpectedly turns your reservoir into a geyser because you reset the controller during maintenance ;) .
 
Making sure that everything that should be on is on, and should be off is off... that's kinda important when running through initialization. I haven't found issues with a flicker here and there if by some chance you experience a reboot during "lights on", at most a couple seconds. The timer routine also checks for "should this be on/off?" every 1s.

Each of my ESP8266's have a battery and solar panel (grabbing back some of those photons!). Because of this - power outages would only affect the current that the pump or lights is pulling, not the relay state. I'm still working on the circuit for full "self-charging" where I can alternate on and off battery power while lights are on and completely ignore the 5v input.
 
I started my air mixing tent upgrade. I got a 2x2.5 gorilla shorty tent. The tent has 4 poles that make a square for the top and 4 for the bottom and those squares are connected by 4 vertical poles in the corners (standard tent setup for a tent this size). To make it fit I just left out the top left pole. I only need 2 inches to be removed so the tent fabric isn't that loose. I was thinking that I would need to fashion some sort of replacement pole, but it just doesn't seem necessary, I'm not hanging lights or anything heavy in this tent..

I replaced my window a/c unit with a portable a/c since I had more room than my 20x20 inch tent. I'm happy not to cut a hole in what is now my most expensive tent :)

I also added a 2nd fan to the inside of the tent, 1 fan will draw air from the veg tent and the other will draw air from the flower tent. This will give more control over air flow balance. Previously I was just trying to close some of the pull string duct ports of the tent to restrict air flow. This also removed a duct T which was one of my goals.

I ran out of time so I haven't removed the other T yet.

Also the A/C didn't seem to work. Probably user error. I will have to read the manual. Luckily today isn't too hot. The inside of the tents are about 85 degrees so they will live until I figure out the A/C.

The gorilla tents are really nice for how large the duct ports are. This little tent has 10 inch duct ports. This allowed me to run the intake and exhaust from the portable a/c through the same duct port. Currently the a/c intake and exhaust just go straight into the attic. My near term project would be for them to connect to the outside air through one of the attic vents.

I can't believe how heavy that portable a/c was. The previous A/C, FFRA0511R1, was 41 pounds. The portable A/C, ARC-122DS, is 60 pounds. I almost killed myself carrying that up the ladder.
 
So the A/C seems to work so far, but I noticed the temps were still getting too high. I checked the air flow going into the tents and it was practically nothing, even though the veg and flower tents showed considerable negative pressure when zipped up.

My theory is that two fans blowing into the air tent created too much pressure in the air tent which resulted in less air moving. Just a guess, I really don't know much about air flow. I added a duct T inside the tent and now just have a single fan to pull air into the tent from the veg and flower tents. The 2nd fan now runs at a slightly lower speed and pushes air out of the tent into an external T towards the veg and flower tents. Now I can feel good air flow in the veg and flower tents and my temperatures are down to the correct level. Today only go up to the high 70s in the attic, so I haven't had a chance to fully test this setup with 100+ temps.

I'm running this A/C a little differently than my last one, when the temp gets too high I turn it on, but I let the A/C manage itself. Once the temp gets too low (hopefully because the attic is cold not because the A/C was set too low), then it will turn off the A/C. The manual says not to turn it off by unplugging it, so I'm trying to follow that the best I can. I imagine I will have to fine tune everything as I see how it performs with higher temps.

The one pole I removed to make it fit in my space

1786347


The air is draw out from the top of the tent and the intake fan pushes the air to the bottom of the tent (behind the a/c in the picture), hopefully this will create good air flow in the tent so that the heater and A/C mix with the moving air well.

1786348
 
So the A/C seems to work so far, but I noticed the temps were still getting too high. I checked the air flow going into the tents and it was practically nothing, even though the veg and flower tents showed considerable negative pressure when zipped up.

My theory is that two fans blowing into the air tent created too much pressure in the air tent which resulted in less air moving. Just a guess, I really don't know much about air flow. I added a duct T inside the tent and now just have a single fan to pull air into the tent from the veg and flower tents. The 2nd fan now runs at a slightly lower speed and pushes air out of the tent into an external T towards the veg and flower tents. Now I can feel good air flow in the veg and flower tents and my temperatures are down to the correct level. Today only go up to the high 70s in the attic, so I haven't had a chance to fully test this setup with 100+ temps.

I'm running this A/C a little differently than my last one, when the temp gets too high I turn it on, but I let the A/C manage itself. Once the temp gets too low (hopefully because the attic is cold not because the A/C was set too low), then it will turn off the A/C. The manual says not to turn it off by unplugging it, so I'm trying to follow that the best I can. I imagine I will have to fine tune everything as I see how it performs with higher temps.

The one pole I removed to make it fit in my space

1786347


The air is draw out from the top of the tent and the intake fan pushes the air to the bottom of the tent (behind the a/c in the picture), hopefully this will create good air flow in the tent so that the heater and A/C mix with the moving air well.

1786348

WOW! That's a really cramped space.
 
You must be using LED lights? I'm using HID (MH and HPS) so I need to make sure it does not flicker the lights. I'm pretty sure I have a design that will work, but I haven't implemented it yet, or even tried a proof of concept, my ToDo list is huge! :)

If anyone is interested, I think I've come up with a very simple solution... It's a long post, so rather than hijack this thread any further, here's a link

Hm, that didn't work, the post-id is right, but it's showing the wrong message...

Ok, with my apologies, here is my post...


Got side tracked and started playing with a Switch Module, a Wemos Mega 2560 with a built in ESP8266, which will control Fans, Lights, etc.

I figured since there was some discussion of lights on other threads, I'd move this one up at least for a proof of concept... I'm pretty sure I've been overthinking it, as this solution seems very simple... either that, or this won't work?

So I have a relay hooked up to a digital pin on the Mega, and I'm using the "Normally Open" connection on the relay, so by default, the lights are off.

So if it's dark time, and something happens and the arduino reboots, the lights will stay off during the reboot... This is the desired behavior for flowering plants. For veg, it doesn't matter...

Two problems, and a solution for each...

Problem #1:
If the network connection is lost, we must continue to function.
Currently my Sensor Modules will go into an endless loop trying to connect to the network and load their configuration, and reboot after so many tries. That's perfectly fine for the Sensor Modules, since without the network, they can't save the sensor data to the MySql database anyways.

Solution:
We need to cache the module configuration as well as the configuration of any lights attached. If we reboot and cannot load the module configuration, or light configuration from MySql, then we will have to rely on the most recently cached version. This will actually work well, since the only reason it reads the configuration so often is to pick up on any changes, and if I were making changes, chances are, I'd notice that it was down.

Where do we cache this information?
SPIFFS is a good solution... Serial Peripheral Interface Flash File System, or SPIFFS for short. It's like having a disk drive to save files on.


Problem #2:
If the arduino reboots during lights on time, then the lights will shut off, and seconds later turn back on, something I'd rather not happen, it's called a hot start, generally the ballast should prevent hot starts.

Solution:
We need to cache the current time so that in the case of a reboot, we know how long we've been down, and can make sure we wait a specified period before we restart the lights.
Each light will have a config option for StartDelayTime and that way we won't need to rely on the ballast to prevent hot starts.
When the system boots up, if the lights are supposed to be ON right now, then it will check the SPIFFS for a file which is updated every minute and contains the current time. So when it reads this file during a bootup, it can compare the time in the file against the current time (It has an RTC module) and determine if enough time has passed to turn on the lights. Lets say you set the StartDelayTime to 5 minutes, and according to the timestamp in the file, only 3 minutes has passed, then we will delay a further 2 minutes before turning the lights on.
When we reboot, if the lights are supposed to be off, then no action needs to be taken at all...
 
@odam2k I currently do something like that for my a/c and dehumidifier. But I kept it simple, I just assumed it on when the power went out and wait a couple of minutes after reboot if they are needed.

I guess for a light though, I would want it to come back on as soon as possible. I guess that is the upside of my LED's, I don't think I need a delay for them.
 
I guess for a light though, I would want it to come back on as soon as possible. I guess that is the upside of my LED's, I don't think I need a delay for them.

No rush, your plants won't be affected at all by 5 minutes without the light being on... In contrast, if it was the other way, where the lights came on when they weren't supposed to, THAT would be a problem...

My original plan was to use other externally powered relays to control this relay, or some such convoluted process, but it turns out the problem is nowhere near as complicated as I had thought.
 
I had one of my highest morning CO2 levels ever at 583. I wonder if this means the tents leak less air now because I don't run as much negative pressure. Or maybe the Exhale bags like colder temps more. Unfortunately my heater didn't go on last night and it got down to 61. I'm not sure what happened to the heater, I will have to investigate that later today. I guess it just takes a while to work out the bugs after redoing the air tent.
 
Back
Top Bottom