Greenhouse Controller Deep Dive

While I basically knew what I needed the new controller to do there would be a lot of decisions to make to get to the final product. Here are some of them.

What micro controller to use? While I could have used one of the newer boards with the 32 bit processors I did not need the extra processing power for this project. I decided to use the Arduino Nano for its small form factor and the fact that I have the most experience with this processor.

How do I activate the relays? The Arduino can't activate a relay on its own. On a previous relay board I used the ULN2003A relay driver IC but it only has 7 outputs. I could have used 2 of those ICs but I decided to use the TPIC6A595NE high power shift register IC instead. It has 8 outputs which is what I needed. I decided not to use the original 24v coil relays and used 5v coil pcb mounted relays instead. This is a photo of the old panel with 24v relays. 



How to get 5 volt DC power? After I settled on 5v I had to decide what kind of supply I would use. I quickly decided against designing the supply into the pcb. I thought about a wall wart. Easy and cheap but I really did not want to have it accidentally unplugged! A search came up with this Meanwell supply and I had the DIN rails that were not being used.



What kind of user interface to use? There are a few different ways to go about this. I thought about TFT LCD displays with or without touch screens and OLED's are another choice but decided that the easy to use 4 line character LCD would work best. For input I decided 4 discrete buttons could get the job done. I use the MCP23017 I2C port extender IC to connect to the display and buttons using the same library this Adafruit product uses.



How do I get temperature and humidity readings? The old system uses thermistors and a separate make/break humidistat. The sensors are located 75 ft. from the controller. I considered some wireless solutions. Without using large antennas Lora seems to be the only reliable choice. In the end I decided to stay with a wired solution using RS485 breakout boards. They are inexpensive and reliable. I made the sensor node smart by using a second Arduino Nano and this Adafruit temperature/humidity sensor. I sized the sensor board to fit inside a length of 2 inch pvc. I added a small fan to create air flow over the sensor.


The new system mimics the operation of the original with these few changes. I changed the number of cooling stages from 5 to 4 as we only really used 4 and it saved adding a second relay control chip. Another change is that the old system had day/night temperature setpoints. The new system uses heat/cool setpoints. It is a minor change but lets you have a wider range where no heat or cooling occurs. This can save money if the crops can handle it. I still have a day/night light sensor but only use it to lock out cooling at night. I included a backup TMP36 temperature sensor on the small pcb that holds the light sensor (LDR). It is hung 5 ft from the controller inside an inverted 2 inch pvc cap.



I designed and 3D printed several support parts in petG. I will be interested how they hold up in the greenhouse environment.

I wrote the C++ code in the Arduino IDE. I know "amateur hour" but it got the job done. The code has been rock solid for a month. I also have alarm monitoring in case something goes wrong.

During the installation I documented where all the wires connected on the original install. This would be useful for the new install and there was a chance I would have to revert to the old setup if the new one ran into serious problems. The changeover took about 5 hours and the system fired right up when we applied power. I left the unused transformer cube on the top left and the unused terminal strip wiring on the left side in place for now. Here is the new install.


 The nice thing is the project fits cleanly in the original enclosure safe from the elements.


I created the PCBs using the EasyEDA online editor. The 3 EasyEDA project pages for the PCBs are listed below.

Aspirator Board

Light Sensor / Backup Temperature Board

Here is a link to the bill of materials for the project BOM



No comments:

Post a Comment