Introduction: Indoor Greenhouse With Touch Screen Control - Updated 6/11

About: Lifelong technology geek

Growing your own herbs and flavorings is not just a healthy alternative but is both fun and cost effective too! To further make the project worthwhile, the automated greenhouse will make an attractive addition to any room as a highlight piece and provide an ever-changing centerpiece for the entire family to enjoy.
Having a greenhouse in my kitchen has been a great addition, but the existing interface was clunky with buttons and knobs to activate and adjust most aspects of its operation. By up-cycling an existing greenhouse project to incorporate a touchscreen instead, more of the operations can be automated, the user interface is cleaner and current status is always visible.

From a maker standpoint, there is significantly less wiring and functionality can be expanded to include more features and data collection - both now and in the future because no new physical input devices are required.

So without further fanfare, if you are interested in growing your own herbs and spices or just interested in getting some ideas for programming your touchscreen, let's get right into it.

Step 1: It’s a Greenhouse, What More Should It/can It Do?

So besides being a place to drop some soil and grow small plants, this greenhouse will provide:

  • ease of use and control via 2.8 inch touchscreen - no buttons or knobs.
  • water whenever the soil is dry, but also have an on demand water option
  • adjustable water times
  • visible reporting for temperature, humidity, last watered and soil conditions
  • support for multiple watering zones
  • lighting for both healthy plant growth and as an environment enhancement
  • a nightlight/away light that automatically illuminates and shuts off at preset times
  • provide multiple lighting modes, colors and brightness via single menu
  • a means of warming the greenhouse environment (with a timed shutoff)
  • a clock and calendar (including hour and minute adjustment control)
  • a physical, manual on/off switch to prevent watering
  • 4” soil base to accommodate most herbs and small plants and 12” inside height
  • inconspicuous access to Arduino USB port for future updates and improvements
  • an attractive addition to any room a great project, with benefits, that costs less than $100

And since no project should ever be totally complete (think “if it ain’t broke, break it”), here are my plans for some future enhancements:

  • programmable timer (it is in my kitchen after all! but also as a homework timer for kids)
  • provide historical data points in graphical form
  • add a small blower fan to cool and move air
  • adapt to use a vaporizer to saturate the air humidity
  • motorized “overhead” watering mechanism
  • Use the SD card to present a digital picture frame option. Requires some minor additional wiring
  • built in water reservoir in the space on the side of the case, which would include a low water sensor. The one in the previous project worked but just didn’t look right. It needs a new design for refilling the water without being too obvious or too hidden.

Step 2: Parts and Pieces

This is a list of what I used, obviously the list can be modified to match the requirements for your needs and what you want the greenhouse to provide.

  • Greenhouse - I like the look of the Socker greenhouse by Ikea. At $20, it's an easy choice.
  • Arduino Mega
  • Touchscreen - I used a 2.8in screen with the ili9341 chip set.
  • NeoPixel strip - using an addressable strip allows for multiple colors, styles, effects and is simple to install. I used 35 LEDs to circumnavigate the greenhouse.
  • (2) 12v motors for watering - the 360 model works well. Use (2) for multiple zones.
  • DHT22 for temp and humidity
  • (2) hygrometers to read soil humidity (dual zone)
  • RTC for timing and clock functions
  • Mesh heat pad from Adafruit - operates from 5v to 12v
  • Small PCB for distributing power and connections
  • (4) relays provide control for lights (this one is sometimes optional), heating, and (2) motors
  • (2) buck converters to allow finer control for motor speed (water output) and heating pad
  • (2) toggle switches to: disable motors and power down Arduino
  • 3 or 5 pole power distribution block

Misc extras needed:

  • 6mm tubing
  • Power barrel (male) - screen shield blocks the Arduino vin
  • Water tray if using the Socker to prevent spillage or leaking
  • Housing case for greenhouse and touchscreen/Arduino mounting case
  • Mounting screws to install components - both M2 and M3 sizes
  • Power cable - I recycled an old 5v/12v PC cable

Step 3: Getting Started - Programming

Since this project uses a touch screen and no other input devices, your first step should be to plan out the components, functionality and connections before beginning programming. Once you have an idea of the working design and component requirements you can start the programming with a more focused idea of what screens are needed and the information that will be shown. Once the basic programming is done, you get to try out the different menus, the touch effectiveness, the information to be displayed and general flow of the interface.
Once that is done, I prefer to hook up the components individually with a breadboard and make sure everything works the way it's supposed to. It also allows fine tuning of the buck converters for the motors and heat. End result was 9.5v for the motors and 9v for the heating pad.

A note about programming a touch screen, one of the issues that I ran into with the touchscreen was the buffering of touch points which led to numerous “erroneous readings”. Looking through forums there was no easy way to clear the buffer, which was unfortunate, but after trying some different approaches here's what I did. For each menu page (routine set) I assigned a menu number and unique touchpoint label. Before each touch read, only allow readings if the menu number matches the routine set and read it into the unique location variables. Here is a brief snippet of code that might clarify:

void lightMenu(){

menu=1; int px1=0; int py1=0;

if(menu==1){

TSPoint p = ts.getPoint();

pinMode(XM, OUTPUT);

pinMode(YP, OUTPUT);

if (p.z > 50){

px1 = map(p.x, TS_MINX, TS_MAXX, 0, 240);

py1 = map(p.y, TS_MINY, TS_MAXY, 0, 320);

}

}

}

If you are new to the Arduino IDE, I would recommend that you develop your code using the tab feature in the IDE. Using the tabs allow all of your global variables and declarations to be available to all of the tabs, but more importantly, it makes sorting through code to find specific routines - such as lightMenu() - easier, because all of the parts for the light menu are under the lightMenu tab. This also makes an ideal format and place to lead with the “menu=x” statement.

This is not the only, and certainly not the best, way but it seems to work flawlessly for this program. ahh, the challenges of not being a programmer but only trying to think like one.

Final note: to use the touchscreen in your program, be sure to #include the following libraries in your sketch:

Adafruit_GFX.h

Adafruit_TFTLCD.h

TouchScreen.h

Step 4: Getting Started - Case

With the programming complete - or something like it - now we can start putting together the physical parts of the project. Let’s start with the case or housing.


Using the size of your greenhouse enclosure, design and prepare your stand/ case. Add space for your touchscreen and casing, I decided to add 5 inches to each side. There are lots of options here and mine is wide, but the location of my greenhouse allowed for the extra 10 inches. You probably will also want to add 3-6 inches to the depth for running your water lines, motor mounts and some wiring.

When the sides and base are in place, add supports for the greenhouse to sit on. My design lets the greenhouse slide in so that the entire front is visible. For this build, I used a scrap piece of MDF as a drop in plate to mount the relays and PCB onto which made positioning and mounting the components easier and, in the end, will allow some flexibility in how it is positioned. Secure the relays, motors and buck converters to the base or plate.

Next mark and drill the water line holes. 1 line will go to the reservoir and is split for the input to each motor. Each motor has a water output, which is again split to evenly cover each zone.

If using a case for the touchscreen, install the Arduino and screen in the enclosure and determine its location on the cover (or front panel) and cut an access hole for the wiring connections. Don’t install the case yet, but it is ready.

Last step for the case, attach the power block, cut holes for power switches and a power cord access hole. Ok, just kidding, real last step for the case…add any trim, paint or stain.

Step 5: Around the Backstretch - Power Wiring

The greenhouse is going to use both 5v and 12v connections*, so if you have a dual voltage power cord, run 5v to the power block upper poles, ground to the middle and 12v to the bottom poles.


Wiring from the 12v poles:

  • wire to Arduino manual power switch, then to a male power barrel for the Arduino Mega
  • wire to Water Motor manual power switch, then to motor buck (if used), then to motor relay
  • wire to Heat pad buck (if used), then to Heat relay

Wiring from the 5V pole:

  • wire to NeoPixel relay

Wiring from the Ground poles:

  • wire to NeoPixel ground #2 (#1 grounds to the Arduino board ground)
  • wire to power barrel for Arduino Mega
  • wire to buck for Water Motors 1 & 2 (if buck is used, direct to motors if not)
  • wire to Heat pad Buck

*Alternative power wiring - If you have a 12v only cable, wire the same, but use an additional buck converter to reduce to the 5v for the NeoPixel. Depending on the number of pixels you’re going to illuminate (and the color and brightness factors), it is possible to run a NeoPixel strip directly from an Arduino digital pin. Not recommending, just saying it can be done.

Install the power switches and secure the power cable inside the case.

The second picture is the previous greenhouse case. What a mess, eh!

Step 6: Almost There! - Component Installation and Wiring

With the programming done and the case ready, its time to begin finalizing our greenhouse. If not done already, wire up the small PCB and secure it to the case plate. It will have a 5v and Ground from the Mega (both run to a rail), component connections to pins and the RTC. As mentioned, one of the advantages of using the touchscreen is the reduced wiring. I included a shot of the old greenhouse wiring as a comparison in the previous step.

For my greenhouse I didn’t find a water proof tray of the exact size to use so I made one from plexiglass. Any tray will do, but make sure the tubing can be secured. Drill (5) access holes through the rear wall of the greenhouse and (4) through the tray to secure the water lines. The fifth hole, in the center, will be the ingress for the heat pad and hygrometer wiring. Once the lines are sized to cover their respective zones evenly, seal the tube ends with epoxy and cut spaced holes in the line to distribute the water throughout the tray.

The next step is to drill a small hole near the top edge on the rear of the greenhouse. This will be the pass-thru for the lighting and DHT22 sensor wiring. Install the lighting and DHT along the top edge of the greenhouse. If leaving the NeoPixel strip sleeving in place (recommended), epoxy is unlikely to secure it, so small brackets or mounts will be needed.

Now it’s time to complete the final wiring connections and assembly. Wire the motors, heat pad and NeoPixel from their relays (use the NO - Normally Open - connections for each). Run the wires from the PCB to each relay (5v, Data, Ground), the NeoPixel (ground #1, Data), the DHT22 (5v, Data, Ground) and the (2) hygrometers (5v, Data, Ground, each).

Place the greenhouse on its’ supports, attach NeoPixel and DHT connections, connect water tubing.

Attach the Arduino Mega pin connections and attach the case to the cover. Secure the cover with 2 screws.

Add some soil and plants, and ENJOY!

I included a video with the menu walkthrough and will be adding a YouTube video with the entire project, probably when I update with actual plants in place!

Thanks for viewing. If you liked this instructable, please leave me a comment or a favorite. I try to post my new projects using Arduino and Raspberry Pi controllers, so follow me for more projects. If you build one, leave a picture in the comments. Good Luck and happy tinkering!!!

Step 7: Update - June 11 - Files and New Menus

So, first - it works! A few tweaks complete and some minor adjustments still to go, but it came out doing what it's supposed to do. Second, I finally got time to drop in some soil and add an Aloe plant I had in a small pot. Here's the finished look. I changed the soil water levels to be lower in zone 2 to be dryer. It might work but it won't be perfect... Now I just need to get some seeds to complete it.

In other news, I am also including the TS_GH_v2.ino file (Which is still changing!!) and (2) 3d model files in .stl format. These are for the Arduino Mega slide in support and the cover. The sketch works fine so help yourself, but you will probably find ways to improve it. If you do, would love to hear your suggestions. When opening, open the TS_GreenHouse_V2.ino - it is the primary and will open all of the other files (14 add'l) in tabs. Enjoy.

6/11 - Now with even more information on the main screen and enhanced menus. Now the main screen has icons to represent the lighted pixels (example shot is healthy - red, red, blue pixels), water time - which can be zeroed to stop watering (has a red dot as a visual reminder) and adjustable away times, no more default setting. Will re-upload the sketch soon with even more enhancements.

Gardening Contest 2017

Participated in the
Gardening Contest 2017