TinyStacky: Autonomous Recirculating Garden Tower

by Emiliano Valencia in Living > Gardening

1660 Views, 26 Favorites, 0 Comments

TinyStacky: Autonomous Recirculating Garden Tower

tinyStacky INTRO
tinyStacky_INSTALL_stacked3.jpg
tinyStacky_INSTALL_top_irrig1.jpg
Clipboard01.jpg

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.

Preparing the Water Tank

tinyStacky_CUBET_prev2.jpg
tinyStacky_CUBET_black1.jpg
tinyStacky_CUBET_black2.jpg
tinyStacky_CUBET_black3.jpg
tinyStacky_CUBET_white1.jpg
tinyStacky_CUBET_white2.jpg
tinyStacky_CUBET_StackTest.jpg

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.

Building the PCB: Preparing the Board

tinyStacky PCB
tinyStacky_PCB_marks.jpg
tinyStacky_PCB_cut.jpg
tinyStacky_PCB_Connectholes.jpg
tinyStacky_PCB_saned.jpg
tinyStacky_PCB_silkysmooth.jpg

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.

Building the PCB: Soldering the Components

tinyStacky SCH V1 IMG.jpg
tinyStacky_PCB_TOP_1.jpg
tinyStacky_PCB_BOT_1.jpg
tinyStacky_PCB_sch1.jpg
tinyStacky_PCB_SMDs.jpg
tinyStacky_PCB_layout1.jpg
tinyStacky_PCB_thermofit.jpg
tinyStacky_PCB_thermofit2.jpg

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.

Program the Attiny85 Microcontroller

tinyStacky_PROG1.jpg
vlcsnap-2021-03-28-20h10m55s885.jpg
vlcsnap-2021-03-28-20h11m00s316.jpg
attinyArduinoISP.jpg
attiny85-Programming-diagram_bb-e1513725356922-300x142.jpg

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.

3D Printing the Enclosures

tinyStacky CAD
vlcsnap-2021-03-28-19h14m29s784.jpg
tinyStacky_3DP_Carc1.jpg

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.

Mounting the Control Board on the Waterproof Case

tinyStacky ASSEM
tinyStacky_CASE_halvesTherm.jpg
tinyStacky_CASE_Wboard.jpg
vlcsnap-2021-03-28-19h13m18s862.jpg
vlcsnap-2021-03-28-19h13m36s393.jpg
vlcsnap-2021-03-28-19h13m59s575.jpg

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.

Preparing the Ultrasonic Sensor

tinyStacky_SENS_Assembled.jpg
tinyStacky_SENS_components_1.jpg
tinyStacky_SENS_cableThread.jpg
tinyStacky_SENS_solder.jpg
tinyStacky_SENS_test_OLED_1.jpg
tinyStacky_SENS_firstSilicons.jpg
tinyStacky_SENS_WetSit.jpg
tinyStacky_SENS_fronCleans.jpg
tinyStacky_SENS_WetDrown.jpg
tinyStacky_CASE_IntSili1.jpg
tinyStacky_CASE_fitSili.jpg

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.

Wiring

vlcsnap-2021-03-28-19h20m01s653.jpg
vlcsnap-2021-03-28-19h16m41s551.jpg
vlcsnap-2021-03-28-19h16m59s767.jpg
vlcsnap-2021-03-28-19h17m26s882.jpg
vlcsnap-2021-03-28-19h18m44s624.jpg
vlcsnap-2021-03-28-19h19m31s975.jpg

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.

Installing the Controller on the Water Tank

tinyStacky INSTALL
vlcsnap-2021-03-28-20h01m39s676.jpg
vlcsnap-2021-03-28-20h02m10s575.jpg
vlcsnap-2021-03-28-20h02m24s080.jpg
vlcsnap-2021-03-28-20h02m44s680.jpg
vlcsnap-2021-03-28-20h03m07s113.jpg
vlcsnap-2021-03-28-20h03m11s417.jpg
vlcsnap-2021-03-28-20h03m20s353.jpg
vlcsnap-2021-03-28-20h05m30s818.jpg
vlcsnap-2021-03-28-20h05m46s991.jpg

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.

Install the Sensor on the Lid

vlcsnap-2021-03-28-20h06m25s188.jpg
vlcsnap-2021-03-28-20h06m31s720.jpg
vlcsnap-2021-03-28-20h06m43s183.jpg
vlcsnap-2021-03-28-20h06m59s850.jpg
vlcsnap-2021-03-28-20h04m24s523.jpg
vlcsnap-2021-03-28-20h04m51s620.jpg

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.

Connect the Water Lines and Test the System

vlcsnap-2021-03-28-20h03m51s763.jpg
vlcsnap-2021-03-28-20h07m50s705.jpg
tinyStacky_INSTALL_stacked3.jpg
vlcsnap-2021-03-28-20h07m21s120.jpg
vlcsnap-2021-03-28-20h07m33s085.jpg
tinyStacky_INSTALL_top_irrig1.jpg

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