Introduction: TinyStacky: Autonomous Recirculating Garden Tower

About: Industrial Designer. Interested in all kind of projects, mainly electronics and object manufacturing.

tinyStacky is an autonomous recirculating garden tower based on an attiny85 controller board. It is a simple, yet very useful microcontroller project.

Why Autonomous Garden Towers?

This sort of stacked gardening has become very popular in the recent decades for high efficiency commercial operations, as they allow huge ammounts of production on limited spaces and a very efficient use of water.

The reason why these stacked gardens are so effective is that they are irrigated abundantly two or three times per day, and thus allow for plants to grow huge with a relatively very small ammount of soil, plus the water can easily be enriched with organic or purified nutrients as desired for even better growth.

tinyStacky takes the principle of these highly effective recirculating vertical systems and shrinks it all down into a single self-contained unit, which can be easily built at home and placed on a very compact area, though of course the more space and sunlight it recieves, the better the plants will grow.

How does the tinyStacky work?

The controller wakes up twice per day for irrigation. First the water level in the tank is measured, and refilled if needed. then the irrigation runs for 5 minutes to generously soak everything. Finally, the controller goes to sleep for the rest of the 12 hours. While sleeping, all the excess irrigation drains back to the tank and no nutrients are lost, which is a key aspect of the system.

Step 1: Preparing the Water Tank

As the water tank is going to be exposed to the sun, we must make it opaque so no algae grows inside, especially since the water will usually be full of nutrients from the soil.

So to prepare the water tank we will take any standard paint bucket and give it a light sanding to aid the adhesion of the paint.

Next, paint the whole bucket black, this is going to be our opaque layer, so ensure everything is thoroughly painted on the outside, and on the inside just skip the bottom.

Finally, once the black paint is fully dry, proceed to paint the bucket white again. I used a very light gray tone for increased appeal.

Once ready, we can place the pot stack ontop to check the looks, and we are ready to install the control system.

Step 2: Building the PCB: Preparing the Board

For this build, we are going to use a 10 x 24 hole perfboard, but we are going to trim it to 10 x 17 holes.

To cut the board, first score across the centers of the whole row #18, using a big cutter, from both sides, then snap the board over a straight edge. Of curse, the cut will be very rough, so we must sand it untill we completely remove the whole row of cut holes, and while you are at it, sand all the other edges and round all the corners for a nicer build experience and cleaner end result. I used #120 grit sandpaper for the cut edge, then 220 for all edges and corners, and then 400 grit again on all edges and corners.

Also we are going to drill 2 1/8" holes for the mounting posts, and deburr them manually with a bigger drill bit. Finally, we must conect some holes together for the bigger pins on the DC and USB connectors. For this, first snip them with some flush cutters, and then work them together using a sharpened hacksaw blade tool.

Once you finish drilling and sanding, give the board a thorough wipe with alcohol to remove all dust and grease, and clean all the mess to begin building the circuit on a clean surface.

Step 3: Building the PCB: Soldering the Components

The circuit is very simple, so it can be built in a small perfboard. 2 SMD N-channel MOSFETS are used to drive the 12v loads. Eventhough these are tiny, they are very high efficiency switches, and can handle several amps. Don't be afraid to solder them by hand, the trick is to place them on son double sided tape and align them carefully on the board before soldering.

Always have a reference of the schematic and final board layout when building the circuit. I find it handy to gather and lay all the components to be used on the schematic, that way you have a clear view of what is on and what is left to solder, and also the connections between components.

Pro tip: Fold the edges of a piece of masking tape over itself leaving a small sticky band, and lay all the SMD components on it with a corresponding label, this will save you a lot of time and hassle. Also, you can place them on thin strips of double sided tape to hold them in place for soldering, I did this just fot the MOSFETS as can be seen in the timelapse video.

Step 4: Program the Attiny85 Microcontroller

Now that the board is complete, we must program the attiny microcontroller with the proper code so that it knows how to read the sensors and when to activate the actuators.

Since the attiny85 microcontroller is so small, it doesn't usually include a bootloader for serial programming, so we must program it using the ISP protocol. For this, you can either use a dedicated ISP programmer, like the USBtinyISP programmer I use, or any regular Arduino as ISP.

Over some time of using arduinos and other microcontrollers, I have come to appreciate simplicity more and more, and thus I have grown fond of the attiny85 microcontroller, as for most projects they are more than sufficiently capable processors, while being tiny, cheap and ultra low power (when optimized in software).

Because of this, I have made a handy breakout board which plugs into the USBtinyISP and accepts the attinys on a base for easy programming and testing, but for a one off, the programming can be done with an arduino and jumpers on a breadboard. refer to images 4 and 5 for the wiring to an Arduino as ISP.

Step 5: 3D Printing the Enclosures

The enclosures for the Main Controller and the Ultrasonic Sensor are 3D printed in PETG plastic. They are quite thin and lightweight, but still pretty tough due to their geometry.

The 3D modelling of the enclosures was done in SolidWorks and the printing on a Prusa i3 mk3 with a 0.6mm nozzle, 0.3mm layers, and 2 perimeters with 20% honeycomb infill.

Step 6: Mounting the Control Board on the Waterproof Case

As the board already has M3 Nylon standoffs on the top and bottom, it is very easy to secure it to the 3D printed case, we only need to set it in place on the top cover and secure it with 2 nylon screws from the outside.

Now, to make the case waterproof, we are going to fill the groove with silicone caulk using a small blastic bag with a corner cut off. Then, press both halves together. They should hold in place and the holes should align with the standoffs. So secure the bottom cover with 2 more nylon screws and let the silicon cure overnight.

Now the case is fully assembled and waterproofed, so we are ready to assemble and waterproof the water level sensor in a simillar manner, although the sensor assembly requires no screws.

Step 7: Preparing the Ultrasonic Sensor

Now we are going to also encase the ultrasonic sensor in a 3D printed weatherproof case. First we must drill the hole of the outside cover bigger to accomodate the USB cable you are using. Ensure it can go in freely as we want to add a heatshrink strain relief over the cable.

Begin by cutting the USB cable in half and threading it through the outer case, now add a piece of heatshrink tubing and expose the tips of the cables.

Next, solder all 4 cables directly to the sensor board and, before proceeding, test the sensor either with the control board or with an Arduino. I prototyped the whole system with an ESP on a breadboard before migrating it onto the attiny. I did this because I implemented a smoothing funcion for the ultrasonic sensor, as the readings tend to be quite unstable, so the function integrates the reads for a few seconds to get a stable average. Thus, I first used an OLED display to see the behaviour of the funcion and the range of the tank.

In the code, the smoothing function might seem a bit abstract or simple, but on the video you can see the behaviour it has of dampening the change in the value. After testing, you can proceed to encase the sensor. First, appy a generous ammount of silicon over the front of the sensor (be very careful not to get any on the actual sensor elements), and press it fully into the holder puck. Check that it is seated flat and clean any excess off with a dry paper towel. Let this part set for at least 6 hours before continuing, or you risk the sensor getting misaligned permanently, so let it set.

Next, proceed to sealing the back of the sensor fully with silicone, and addign a generous ammount on the inside of the outer case. Now pull the cable out to get the puck into the outer case, and press it all the way in untill some silicone extrudes through the edges. Then clean the excess and let the whole assembly cure overnight.

Step 8: Wiring

In order to connect the pump and the valve to the controller, we must wire them together to a 3 pin JST connector, with a common positive on the rightmost pin, and the ground of each on the other 2 pins. It is highly advisable to use precrimped cables and solder to these, in order to ensure a reliable connection in the socket.

Also, we must solder 2 terminals to the tips of the valve cable, and finally, insulate all the connections with heatshrink tubing.

Now the whole control system is completed and ready to install onto the water tank.

Step 9: Installing the Controller on the Water Tank

The installation of the system on the water tank is very easy. The main controller slides onto the top flange of the bucket, and is secured in place by a single ziptie which is fed from the inside of the bucket throught the channel inside the case, and back into the bucket.

The valve is installed in a simillar fashion, but using 2 galvanized wire braces, which are also secured from the inside, by twisting them tight with some pliers. Finally, the pump goes into the bucket and the power cable and water lines come through a small slit cut on the top lip.

Step 10: Install the Sensor on the Lid

To install the sensor on the lid, simply place it against the iside edge and trace around it with a pencil. Next, cut the hole out with a big cutter knife. If you are careful and use the cutter at an angle, you can easily cut the curve in small increments.

Then simply place the sensor onto the hole and the installation is done. Ideally it should be a press fit, but a loose fit is also fine. Now connect the sensor and wiring harness to the main controller.

Step 11: Connect the Water Lines and Test the System

First, set the dripper over the topmost pot and measure enough hose to reach to the bottom of the bucket. If you use the same pump as mine, you are in luck, as the 1/4" hose will fit very snuggly inside and hold quite effectively just like that. Otherwise some epoxy glue will do the trick.

Now add 2 reducers to the valve's threads and connect the inlet hose to the tap and feed the outlet hose into the water tank. Finally, set the lid firmly in place and lift the whole stack of planters onto the bucket.

Success! you have completed the build of your tinyStacky, all that's left is to test it and leave it to do it's magic.

So plug the power in and press the button. You should see 2 quick flashes of the indicator. If the indicator flashes very slowly or stays on, the sensor might not he properly plugged in. Now, the irrigation won't start right away, as it has a programmed delay to prevent uncotrolled irrigation in case of repeated power cuts. so let it sleep for a bit and it should begin the irrigation automatically 5 minutes later.

Congratulations if you made it this far! now you have your very own high efficiency vertical garden and are ready to recieve the spring full steam ahead.

.

This guide is an entry in the Microcontroller contest, so if you feel it's worthy, pleasae consider voting for it, and also check out my other guides on simillar subjects:

Autonomos Irrigation and Monitoring Station

tinyDice: DIY PCBs at home

Microcontroller Contest

Participated in the
Microcontroller Contest