Introduction: Indoor CNC Garden

Hi, this is my first instructable and I hope to do more project. I found Instructables page a year ago and very interested in what you have shared. I had planned to do a tutorial to contribute to this forum but my English is not good. Hmm... If you see a lot of grammatical errors in this tutorial, please give me sympathy :D

An indoor garden is my dream for a long time, but I don't have much time to take care of them. I tried to plant a lot of vegetables, for many times but they all failed. I mean, I forget to water, leaving them dry, either too much water or too little.

More so than a how to build CNC machine, this Instructable will show you how to build an indoor garden which combines simple CNC frame and Arduino and a lot of sensors, all of them will make an automatic garden. The goal of this project is to build an indoor garden, so that care itself and give you all the parameters of temperature, humidity, light intensity and real time images. It can automatically watering and adjust the wind, light accordingly.

This is the project I spent over two months to make, all the time I read about the CNC and programming. But I just spent more than one week to build the CNC frame and connect the circuits.

The idea of this project is a reference to, an open-source project.

Total cost was minimal as the most expensive single part was CNC frame and Intel Edison board. The total cost of the project is about $300

If you liked this project, please vote for me, thanks!

Step 1: How It's Working

This step shows you how a CNC garden operation:

  • You can view real-time status of the garden through a webcam which mounted on CNC frame.
  • When the soil moisture sensors detect below the threshold, the system will automatically watering for each plant with pre-programmed flow.
  • The lighting system is programmed to illuminate 16 hours to 18 hours a day to help the plants grow faster.
  • The fan has 10 minutes on/off period to circulate the air.

Step 2: What You Need to Build CNC Frame

I recommend buying all the necessary materials before starting the realization of any project.

Below is bill of materials and components to build CNC frame 900x250mm:

  • 2x 1000mm 2020 aluminum extrusion
  • 2x 330mm 2020 aluminum extrusion
  • 4x 300mm 2020 aluminum extrusion

  • 2x 8mm Smooth rod 980mm long

  • 2x 8mm Smooth rod 350mm long

  • 12x 2020 Metal square bracket

  • 32x M6x12mm screws + 32x M6 T-nuts for extrusion profiles

  • 8x 20mm caps for extrusions profiles

  • 4x 625ZZ

  • 2x GT2 16 teeth pulley

  • 3Meters of GT2, 2mm belt

  • 7x LM8UU bearings

  • 2x Nema 17 42mm stepper motors (I got from the old printer)

  • 2x Micro switch (with rollers)

  • Plastic tie


  • Allen Key
  • Iron soldering
  • Screwdriver
  • 3D printer
  • Cutting plier

Step 3: 3D Printing Parts

I used some parts from the Scalar Family - 3D Printer project to build this CNC frame. It's pretty fit and I don't need to edit any part.

I have an Up mini 3D printer, it is average quality printer and I use it most of the time in over a year. I usually settings the printer in the normal mode and takes two days to complete all of parts. All are used white ABS filament from Esun with inexpensive price. Support parts is very easy to remove with a plier.

You can download stl files which are attached below.

Step 4: Frame Assembly

I use 2020 aluminum extrusion because it easily paired. You only need a metal square bracket and a pair of screw and T-nut to fit together. Just tightened slightly the screw because it makes you easy to correction later.

You need to make a rectangular frame, then carefully corrected before you can mount the X axis on.

Step 5: X Axis

First you should assemble 3D printed parts as shown above. 625ZZ bearings used to help the sliding belt. Each pulley/bearing set consists of one bolt, 2 bearings, a washer, and sheet metal.

Next you mounted 4x Idle holder on aluminum frame by Screw and T-nuts. You should tighten lightly because you have to calibrate the smooth rod later. You will fix the Idle holder to the rod with some plastic tie, but we will make it after build Y Axis on next step.

Step 6: Y-Axis

Use 4x LM8UU bearings for the X Axis and 3x bearings for Y Axis. You should carefully attach the bearings on Idle holder which was 3D printed. Because the 3D printed parts can easily be cracked or broken, I recommend using a rubber hammer to knock them together, using super glue to patch the cracks, if it occurs.

Fixed the bearings by screws and nuts and plastic ties. I also use 4x aluminum extrusions 300mm long to mount to the cnc frame.

Step 7: The Belt & Stepper Motors

First mounting the stepper motors on both X Axis and Y Axis. When it came to mounting the stepper motors to the base and attaching the timing belt I used an allen key and screwdriver.

The stepper motors and bearings should go on first before you worry about putting the belt on. You can get a much better picture of what i'm describing in the pictures above.

Step 8: Setup of End Stops

We are going to install here the end stop of the X Axis and Y Axis. There's a bit hard when attaching the end stop on the 3D printed parts. I used the plastic ties to fixing them together. You can also get a much better picture of what i'm describing in the pictures above.

Step 9: CNC Frame Overview

Finally, let's review what you've done in the previous step.

Step 10: Setup of Lamps

I use a shelf which I had built before and put my CNC garden into it. The size of the shelf is 1 meter H x 1.3 meter L x 0.4 meter W. It is enough to put 2 pot into.

The top surface of the shelf is covered with thermal foam insulation, it helps prevent the outside temperature and reflected light from the lamp into the trees below.

I've ordered two 40W light bulbs and two 18W light bulbs. The 40W is the main task. 20W bulbs will be connected when the low light intensity match.

Step 11: Electronic Parts

Below is bill of electronic materials:

  • Intel Edison with Arduino breakout kit
  • Arduino Uno
  • Arduino base shield
  • L293D motor shield
  • Webcam
  • 2x Grove moisture sensor
  • 2x Grove light sensor
  • 4x Grove SPDT relay
  • Grove air quality sensor
  • Grove speaker
  • Grove temperature sensor
  • 12V water valve
  • Water flow sensor

Step 12: Arduino and Motor Shield

Now that we have all the parts, we can assemble the circuit. Above is the wiring diagram:

Step 13: Arduino Programming

Download the attachment below and build to your Arduino board. You also have to add the library:

  • Adafruit_MotorShield
  • AFMotorDrawbot

After loading the program is successful, you will see the stepper motors rotate, it's scan for X0 Y0 point. Opening the Serial Monitor window and type: "G00 X100 Y200 F150;" so the stepper motors will go to X100 Y200 point.

Actually you're using G-code to control cnc machine, that commands will be sent from Edison board through UART.

Step 14: Webcam Mount

I used the plastic ties to mount the webcam and Y Axis together.

Also, mount the caps for extrusions profiles. I bundle the wires together so they look clearly, it includes stepper motor and end stop and webcam cable.

Step 15: Build Auto Watering System

I reuse a 5 liter bottle to store water. I think it is enough for nearly a week. Hot glue is great for fixing water pipes and the bottle. I put the bottle on top of the shelf, the water flows in the pipe, passes through the water flow sensor, then go through the water valve and flowing into the pot.

Also, I used 8mm diameter pipe to connect the water flow sensors and the electromagnetic water valve. You must set the water flow sensor in the vertical direction to take the most accurate value.

I use water valve is 12V, it is available from my power adapter.

Step 16: Relay System

The system includes four relays: two relays to control two separate lamp, another relay control the fan and the other control electromagnetic valve water.

Each relay includes a normally closed pin and normally open pin, make sure that you are connected to normally open pin.

I have a 12V 50W power supply with cooling fans inside, it works quite efficiently and quietly. You can get one cheaply from Ebay.

Step 17: Intel Edison Setup

You connect all the sensors to the Arduino Base Shield in the diagram above. Notice that I use UART port to control the Arduino board with the G-code commands. So please connect UART between Arduino and Edison:

Edison(Tx) --> Arduino(Rx), Edison(Rx) --> Arduino(Tx)

Also plug the webcam into a USB port on Edison to receive real-time images.

Download the attached source code below to load into your Edison board.

Step 18: IBM Watson

IBM Watson IoT is a lot of assistance for IoTs projects function data updates in real time and analyze the data, which I chose this server for this project. You will have a 30-day free trial to test the flexibility of the system. I noticed the server is very fast and smooth, plus many chart types to show the data that you upload.

There is a lot of documentation about IBM Watson, you can refer to:

The project chart in CNC Garden include:

  • Temperature sensor
  • Moisture sensor 1
  • Moisture sensor 2
  • Water Flow sensor
  • Light sensor

Step 19: Prepare Seed and Pot

You can grow more vegetables indoor as microgreens and cilantro and hot pepper. I really like mint and rosemary, it's very pleasant to smell, my whole room filled with vegetable flavor.

You need to soak the seeds in water for at least 3 hours before sowing. I use two pots the size 25x50cm and it is very fitting when placed in my shelf. A pot to plant short days plant like cilantro, sprouts and spinach. Another pots to plant hot pepper, tomatoes, mint and rosemary.

Be sure to wet the soil before sowing.

Step 20: Sowing Seed Indoor

Covered with a thin layer of soil above the seed layer, then watering some water and wait to be surprised. The microfreens seeds grow rapidly, just five to seven days. Some seeds may take longer as coriander and peppers.

Step 21: Setup Moisture Sensor

I have two soil moisture sensors, so each pot will have one. Use plastic tie to fix the pie to Y-Axis CNC frame.

Step 22: Finish

Indoor Gardening Contest 2016

Grand Prize in the
Indoor Gardening Contest 2016

CNC Contest 2016

Participated in the
CNC Contest 2016

First Time Authors Contest 2016

Participated in the
First Time Authors Contest 2016