Software apps and online services
Hand tools and fabrication machines
2 years ago I decided to step to a new level in controlling micro-climate in our thermal water heated greenhouses. Before that time for example we did all airing by opening-closing windows manually. It was a waste of time, took hours per day! So the "simple" and clear step was to build automatic micro-climate control "things" begin with automatic windows openers.
- 200 meters long, 10 meters wide and 4 meters high half-circle production area
- Any number (26 in my case) of windows along at the top of the structure
- 400 (2x200) meters long, 4mm thick steel leading wire to attach to the control arms of the windows. One of the 200m line is the opening line the other is the closing line.
- The leading wire is attached to a 3-phase motor assembled with a worm gear unit. The steel wire lines are twisted around the axis of the gear unit clockwise and counter-clockwise. If the motor rotates clockwise then one line of wire moves one direction and the other one moves opposite.
- Different rotation is managed by a 3-pole reversing contactor assembled with a thermal relay set to the motor's parameters. The contactor has two 24V AC coils. Coils can be powered with a 230AC to 24V AC transformer through a 3-way selector switch (OPEN or CLOSE) where the third position is for the AUTOMATIC control. For limiting the amount of opening and closing movement (no to destroy the structure by the gear) two limit switches have been put near the steel wire rail.
- ... How to decide what kind of climate is need for the plants during 24 hours whole year...?
- ... How to manage system stability in an airspace where humidity can be 100%, temperature can be 60 Celsius degree and huge EMI pollution (3-phase motor, contactor, pumps and relays for irrigation, etc.) all around...?
- ... How to protect structure, and parts if malfunction hits...? Have experienced when a motor-gear-unit crushes the structure. No one should see that...
During last 2 years I had several phases of this project. For example it was a dead end using plastic cases. High humidity and sunlight can be harmful. All the 1602 and 2004 type LCDs with its HD44780 type controller have a high sensitivity to any kind of electromagnetic impact. After a time it just doodled random things. Not to think for future modifications can be expensive. Bought many Arduino Nanos thinking they are just fine but later I built around the MKR1000 boards. Yes they are much expensive but for IoT projects being online is essential :) isn't it?
After this long prelude lets do the workmanship (from big to small again).
I need to isolate things as much as possible from climate. Metal box is the best option i found to achieve that. I have to separate high voltage things (Supply Box) from low voltage (MCU Box) things. Two metal boxes better than one :).
The high voltage box contains the 3-phase input supply (3 phase + Neutral + Earth). Circuit brakers for motor/transformer and for MCU in the other box. Transformer (230V to 24-18-12-6-3V). Reversing contactor and thermal relay. Input and output cables from motor to Supply Box, from MCU box to Supply Box.
The biggest limitation is the physical size of the controller housing. First it was a headache how to install everything in a logical manner.
The MCU Box contains the controller aka the Climate Cube, and an I2C bus expander housing. The controller have all the stuff what counts here. But first, the most important thing is I wanted to built it as a structure of modules to be able to expand, enhance later and replace parts if necessary. See the wiring diagram.
MKR1000 has everything (now) i need. Lots of GPIOs, hardware I2C, WIFI option, and strong processing ability not to mention it has more program space than Nanos.
I use 2-channel opto-isolated relay to switch the 24V AC circuit to drive the contactors' coil. The relay can be fully separated from the MCU by giving a second 5V DC power supply. So the coil of the relay powered from one power supply (PSU) and the optocouplers (relay inputs' VCC) are from another PSU shared with MCU. The two PSUs have been built with input and output EMI filter circuits. (I did not find such filtered PSU where 24V AC input available).
A DS3231 clock is installed also. During plant production there are many scenarios. For example if there is not enough sunlight for plants to do their photosynthesis effectively no need to keep hotter air.
The lack of sunlight in the winter (January) not warmth the air and there is a high chance that temperature inside is lower than what we wanted so windows stay closed. If this happens plant cannot get fresh CO2 rich air. So we need to get some fresh air in despite the temperature inside still lower what needed. Of course we don't want to do that in the night when outer temperature drops minuses. That is why MCU needs to know what time it is. Because, for the daylight I need to set checkpoint/time. Example: when certain conditions appear MCU opens the windows for 5 seconds interval then keep that for 3 minutes than close them. Air freshening done.
A display is also necessary to set things and inform us. The 1,3" OLED was the simplest and best for this project. Uses 3.3V and I2C. Piece of cake.
Keypad was a hard choice. Tried several types but MPR121 Capacitive keypad won. The 4x4 membrane also in duty elsewhere but uses 8 input. (to achive only 2 wires using different resistors connected to its' wires gave hectic readings, so in the end membrane OK but not with 8 outputs). So the cap. keypad... Farming is a dirty thing, much have rough hands and fingers, not to mention gloves. I have to get used to that capacitive keypad requires clean hand.
There are dedicated switches and a button in duty. Main switch is a full ON/OFF switch for AC 230V input. The metal tactile button only switches the Relay coil ON/OFF (good when debugging needed). And there is a momentary button also. Pushing it the display activates for certain seconds and then deactivates (or pushing it again also deactivates it). OLED displays have limited lifetime that's the reason I put it there.
MCU cannot capable of running parallel processes at the exact same time. To show user what is going on inside the Cube I also installed an RGB 5MM (common cathode) LED. You can program which colour what means in the program loop. For example in normal 'stand-by' mode when MCU only reads sensors a blinking green colour indicates everything is fine "you can go to your work". If freezing hits (not happened since OLED displays used) blinking stops or it is just light but not blinks.
The first and most important input is coming from the temperature sensor. I chose the 1-Wire bus type DS18B20 sensor. Simple and long range. Range is needed here, we are talking about 200 meters where can be so much differences between temperatures. I managed to reach 50 meters using CAT5 cable. Sometimes, thanks to the EMI sensor gives 'error' values but you can filter them easily in the software.
In the future under new project names but based on this very first Climate Cube project i am going to install more sensors (RH%, LUX, etc.). Optimum relative humidity for sweet pepper is important and Si7021 sensor can measure it quite well. The amount of radiation is also very important to know. If it is less than the optimum you have to keep cooler temperature inside, not to turn the growing process into vegetative stage etc.
There are many dilemmas and 'what if...' type questions but the main thing is we all exposed to the changes of weather. All we can do is to adapt our micro-climate to it. First of all, for optimum adaptation we need exact data (°C of Air, °C of Soil, RH%, Soil moisture, Watts/m2° etc.) from our surroundings. Second, we should know what plants exact need in certain period of production. Only after these information we can start to think about what type of intervention should we take.
I am about to build a 3G based Wi-Fi network in the area, after that i can monitor, manage etc. the already installed units. I real IoT based plant production come alive soon.
If demo video required I will do that, just say.