Hi group. I'm starting a new project with a terrarium controller mainly for irrigation as well as continuous monitoring of temperature, humidity and CO2. I've looked around and I have seen quite a number of aquarium and terrarium projects, but this idea includes some additional functionality. So, I'm wondering about the feasibility of achieving all of this with just one single board as well as how I can get started rounding up hardware. I'm a beginner novice, so I will also have a lot fo questions about code.
Lighting for the enclosure will just be an economy programmable LED strip that already includes a daytime-nighttime lighting timer, so I don't have to worry about that. The main board functions will instead be watering and air ventilation to control humidity inside. I use a numbered list here because the functions will actually start with a sequence initiated manually with a push button.
Organisms in tank are of kinds that will grow best with a wetting-drying cycle, rather than constant moisture/humidity.
A clock (does not have to be precise, e.g. RTC) will switch on a color LED to indicate a preferred hand watering day at some interval, maybe every five days or so. (I'm using a hand watering approach because I do not wish to rely on a bigger water reservoir that could leak or run dry.) Sometime during the day that this light switches on, I will fill the small fogger reservoir, then press a button to start fogger, switch off LED indicator and initiate the rest of the sequence.
Fogger will run continuously until visual observation confirms that enclosure is well-watered, at which point I will press push button a second time to stop fogger and simultaneously start an air pump to push dry, outside air into enclosure. Air pump will run continuously until a lower relative humidity threshold (maybe 50%) as detected with humidity + temp sensor is achieved, at which point air pump will automatically switch off.
When air pump stops, an internal case fan will automatically switch on to circulate air within the enclosure and to run continuously until sequence starts again five or so days later.
Temperature, humidity and CO2 will be measured at intervals (with relative humidity percentage also controlling air pump and fan switches as described above) and logged on SD card. A small graph monitor may also display these parameters if I decide to add that.
I hope this is pretty clear. Please let me know if anything needs further explanation. I hope I can figure this out and would be very thankful for any tips or ideas how to start.
My programming experience is very basic and amounts mainly just to using libraries and copy-pasting.
Please read the part about the sequence. I've tried a few of these things already and seen explanations for others. I mainly just want to know if this sounds doable. Also interested in any examples of comparable projects.
Your description is ok, but I’m pretty sure you’ll discover things you ‘forgot’…
I’d start out old-style with a big sheet of paper, and draw a flow-chart or state diagram with as much detail as you can think of.
After about the third revision, you’ll be getting close to building something.
You also need a chunky ‘block diagram’ of the hardware - at least - so you can visualise how the parts work together.
Next step will be derived from that to create a detailed ‘schematic/circuit diagram’ that includes power supplies etc.
That will identify pins and other elements needed to write the code.
You may be surprised to discover how many bugs you can cram into a short piece of code. Given that, testing will be important.
Consider building a setup where you can simulate the terrarium's inputs and outputs to see what your code does. This could be a simple as a few potentiometers that you can use to set humidity and temperature readings and LEDs for misting and air pump.
It may also be worth running the sim faster than real time.
I think you will benefit from an RTC for that. The Arduino's internal clock will drift significantly over a 5 day period, and after a couple of months you might find yourself watering plants a day early or late.
The other advantage of an RTC is that they retain the correct time even when the Arduino has no power. Also you can log the time of sensor readings on your SD card, which I think you will find more useful than any elapsed time.
I guess we should also ask at this point: what are you growing, and is it legal to do that in your country?
Please post links to the specs of the air pump, fogger and fan. We can advise on circuits to control them with the Arduino.
The environment in which the sensors will be located sounds like it could be quite corrosive to electronics. For the temp/humidity sensor, I would recommend one that comes encapsulated in a tube with a vapour-permeable "filter" at one end, like this:
That's a good point about the RTC and I will plan to include one. I think I still have a couple of extras with batteries here. A 7-segment display showing the time might also look nice with the display.
I don't know what bearing legality of plants in question would have on circuitry and code, but, no, I'm not growing anything illegal. I'm just a science enthusiast and a nature lover. People keep all kinds of plants and other things just for fun and not to break the law. There are literally thousands, possibly millions, of different organisms you could put in a terrarium with no legal restrictions whatsoever.
I intended to just strip the wire and use a blue relay block, although if there might be a tidy way to keep the USB connection on there, that would be handy. I suppose I could just strip a USB female connection and wire into a relay, or maybe there's another solution(?).
This point reminds me I also wondered if there is a tidiest way to get 5v power to both the Arduino and to the relays(?).
I have a couple of those going already and they run OK with 5v. I will need to remove or bypass the on-off push button on the fogger in order to wire with the whole setup. The fogger board will go on the outside of the enclosure, so there is no need to protect it from humidity.
I have not decided yet on a fan. I could just use a regular mini case fan, but I also thought it could look cool to use a small drone rotor with a slow rotation (like a mini ceiling fan). Can you recommend a reasonably durable low RPM (maybe 100rpm) mini DC motor?
Oh, I know, I know. But occasionally we get asked, sometimes openly, sometimes not, to help with growing plants that are not legal in the countries where they will be grown. Its good to know that you are not planning anything like that.
I would wonder if preemptive policing of your board content is really worth mild insults and assumption of guilt.
The "what a joke" air pump is just a 5v device that you plug in. It runs when it gets power. I don't know what the current draw is, but it's not much and if I have doubts I can just measure it.
I don't understand the point of getting a lot of antagonism over a little thing like this.