offset \ˈȯf-ˌset\ noun

a force or influence that makes an opposing force ineffective or less effective

Cuply - Hydroponics Greenhouse Cabinet Powered by Django Channels and Arduino - Hardware

I'm in the process of making a greenhouse out of a glass cabinet that sits on our balcony. Inside it, there's to be a plethora of sensors and actuators hooked up to Arduino Due microcontroller, which is in turn connected to an old Raspberry Pi. The software stack is Django with Channels in the back-end, and React with some D3 in the front-end. It was a project long time in development, and this series of articles will explore it from the inception to the latest product.

  1. Overview
  2. Hardware ← You are here
  3. Back-end
  4. Front-end
  5. Conclusion

The hardware side came to be an IKEA glass cabinet. We opted to buy one and be done with it. I assembled it indoors and we took it out to the balcony. It fit the space we had in mind for the project and we felt it was good enough. The glass walls made it a greenhouse and, because it resembled a cupboard, the name was born: Cuply.

We replaced the original shelving with a suspension contraption to hold the plants. Some parts were bought in the nearby hardware store, some in IKEA, some online, some in the nearby general store, but let's list them all:

Glass Cabinet
Ikea, a small version of MILSBO line, to hold everything. It's transparent on all the sides except the bottom, which is to achieve the greenhouse effect and keep things cozy.
Suspension rod
Ikea, FINTORP line rod, attached with screws from the local hardware store. We drilled into the inside of the cabinet, on the top side, to attach it. It's meant to hold the suspended plant pillars from the accompanying hooks. I also had to shorten it with a hacksaw.
Two chains per pillar
From the local hardware store, four chains in total. They measure ~50cm in length. The links have to fit the hooks on the suspension rod and the turnbuckles.
Three turnbuckles per pillar
From the local hardware store, six in total. Each turnbuckle goes through a bottle so it holds it in place.
Six plastic bottles
They're rather small, 1L actually, but one has to start somewhere and we drank a lot of juice to get them. Bottom half is sprayed white to reflect the sunlight and shield the sensitive roots. Black electric wire isolating tape is added in the middle just for the looks, to hide the transition from white to transparent. The front of each bottle is cut out to allow the plant to stick out. Bottle sides are drilled on the left and right for the turnbuckle to go through. A plant pillar consists of three bottles, turned upside-down and connected by plugging the bottle cap of the previous bottle into the bottom of the next one, which requires drilling a 2.5cm hole in each bottom to push the cap through. Each bottle cap and the bottom of the first bottle have a 5mm holes drilled into them, to connect to the water system loop and circulate water through the pillars. Each bottle houses a hydroponic pot (it's like a regular pot, but like a net) with clay pellets. There are two pillars, three bottles per pillar - six bottles in total.
Upper tank made from a soil drain pipe
10cm diameter, 75cm in length. Both ends are covered with a rubber cap bought online. There is a hole at the top, 2.5cm in diameter, for the water inlet, and two small holes at the bottom of the tank with aquarium drip valves to control the flow. A small piece of aquarium tubing leads from each bottom hole into the top hole of its respective plant pillar. The drip valves are sealed with silicone (which is safe for aquatic life) so they don't leak at the sides. The upper tank is suspended above the pillars and held in place by two pipe clamps and some screws from the local hardware store.
Lower tank also made from a soil drain pipe
10cm diameter, 75cm in length. Both ends are covered with a rubber cap bought online. There is a hole at the top, 2.5cm in diameter, for the water outlet. A small water pump is submerged in the lower tank with a power cable going out the cable hole on the side. The outlet of the lower tank is connected to the inlet hole in the upper tank via the provided water pump tube (via nozzle), approximately 13mm in diameter and of ~150cm length. The pump outputs 1500L of liquid per hour so it's fast and strong enough. Another hole on the top, also 2.5cm in diameter, is drilled on the other side to replenish the water and to provide the access to the air stone from the air pump to keep the algae from forming in the tank. The cap of the bottom bottle of each pillar has a small hole drilled into it, 5mm in diameter, from which an aquarium tube feeds back into the lower thank, allowing it to be filled up again. There's also another ~2mm * ~20mm slit on the top side for the I2C capacitive water level sensor to go into the bottom tank. Could be that more sensors can be added, but this is my experimental limit for now. It is also held in place by two pipe clamps and some screws from the local hardware store.
Light, temperature, ambiental humidity sensors
All analogue placed inside the cabinet.
Relays
For controlling both of the pumps and the light. Three in total.
Arduino Due
All the sensors are attached to it and it has its own power source since all of it cannot be powered through the USB. Arduino Due is used because it supports a wider plethora of sensors than GPIO of Raspberry PI.
Raspberry Pi
A first generation model B+ is put to use here. It has a WiFi antenna in one USB slot (because it didn't come with an integrated WiFi interface) and Arduino Due is plugged in the other USB slot to report the state of the sensors (and act on the actuators).
LED strip in the cabinet
Held in place above the pillars to provide additional lighting and connected via relay to the Arduino Due.
Power source
Everything is neatly connected in one plastic box and fed power coming into the cabinet from the nearby outlet.

The idea came from the Window Farms kickstarter so kudos to those folks. Even though the project is discontinued, it gave me inspiration for the hydroponic loop. The plants are nested in each bottle and are of a herb type, compatible both with the ambiental conditions as well as with each other. There are various attempts online at controlling similar systems via computers. Mine is no different. The systems are known as Grow Boxes and there are most likely communities around them.

The lower tank has an inlet for the solution that is made from water and a fertilizer concentrate bought in store. It needs to be changed weekly or when it evaporates. Once things are set up, the system runs the loop by pumping the solution from the lower tank controlled by the relay and turned on by the sensor, then letting the gravity take care of the rest by dripping the solution from the upper tank all the way through the pillars to the lower tank. The whole cycle is repeated ad nauseam. The lights turn on in the low light conditions.

Here are some photos from hammering on the hardware:


/media/images/cabinet.jpg
/media/images/suspension-rod.jpg
/media/images/turnbuckle-1.jpg
/media/images/turnbuckle-2.jpg
/media/images/pillar-1.jpg
/media/images/pillar-2.jpg
/media/images/light.jpg
/media/images/lower-tank-1.jpg
/media/images/lower-tank-2.jpg
/media/images/lower-tank-3.jpg
/media/images/lower-tank-4.jpg
/media/images/lower-tank-5.jpg
/media/images/lower-tank-6.jpg
/media/images/arduino-box.jpg
/media/images/air-pump.jpg
/media/images/raspberry-pi.jpg
/media/images/cuply-first-look.jpg

Cuply - Hydroponics Greenhouse Cabinet Powered by Django Channels and Arduino - Overview

I'm in the process of making a greenhouse out of a glass cabinet that sits on our balcony. Inside it, there's to be a plethora of sensors and actuators hooked up to Arduino Due microcontroller, which is in turn connected to an old Raspberry Pi. The software stack is Django with Channels in the back-end, and React with some D3 in the front-end. It was a project long time in development, and this series of articles will explore it from the inception to the latest product.

  1. Overview ← You are here
  2. Hardware
  3. Back-end
  4. Front-end
  5. Conclusion

Since we started looking to buy an apartment back in 2018, we had in mind a south-facing balcony. In the end, we were lucky enough to buy just such an apartment and, even though the balcony is small, we got it to become a special corner of our living space. It doesn't have much, but you can sit there and enjoy the view of the treeline across, day and evening, have a drink or even a meal on the foldable table we installed. The previous owners had a water butt set up to pick up the drain water and a set of flowering plants that thrived on it. We wanted herbs we could use in the kitchen so we had to control the water quality. Because the balcony is small, we opted to try a vertical set-up instead of a horizontal one, and having a hydroponic loop made sense. Fast forward to 2022. We have an automated system, although that's still just the beginning.

Even though sunlight is abundant on south-facing balconies in the northern hemisphere, if there are no outside obstructions, Ireland is not ideal. To control the temperature better, we opted for a glass greenhouse to look nice and make use of the greenhouse effect. For that, we had to buy a glass cabinet because building one was hardly an option. No space for us to do it at home, and the hackerspace we know is not really near enough to reach conveniently without our own transport.

Whoever opts to build such a thing by themselves, by all means, go for it. Custom builds will always utilize the available space better.

We could've become members of a nearby community garden. It's looking lovely this year. But we'd definitely be too lazy to devote ourselves to maintaining it so the balcony greenhouse will have to do. And, to be fair, setting up hydroponics is more fun.

Of course, there are some drawbacks. The space is limited in general and we'll see how viable the plants will be (the pots are rather small), but it's an experiment driven project that is inconspicuous enough, but also decorative and useful; it enriches our balcony's environment, creates a separation from the neighbours and might yield fragrant herbs. Not to mention that it's a great opportunity to have a hobby.


/media/images/cuply-first-look.jpg

In the future articles, I'll go into more detail on how the thing was made. For now, it's a hydroponic loop that functions between two tanks. The lower one pumps the water into the upper one, and the gravity takes care of the rest. Because of the size, only six plants are able to be inside the cabinet. The other things are nifty add-ons that just make the whole thing a bit high-tech and agro-informatics driven. Whatever the case, I'll open-source it after I finish the articles and have a working cabinet, so whoever wants to explore a bit and implement a similar solution in their place, they're more than welcome to use it.

3D Printer Shenanigans

/media/images/3d-printing-setup.jpeg

Buying a 3D printer was a decision we postponed for a very long time. With Vesna delving deeper into DM-ing D&D, we were thinking that we could host some games IRL for friends. Heck, I could even make some cocktails because we got a cheap cocktail making kit. Having miniatures would be nice, printing them would save money. Having a 3D printer would be useful for other models like small hardware parts, gifts, fixing broken things, etc. In the end we decided to bite the bullet and opted for a high resolution resin printer because they have gotten affordable enough and the level of detail is amazing. Right now we have Phrozen Sonic Mini 8K resin 3D printer.

What surprised me the most was that people who tinker on their computers usually have a notion that 3D printing is still filament only. Having a spool of plastic thread melted and drawn with, layer by layer, is not the only way. The other type is resin based, where the build plate is submerged in a vat of photopolymer liquid resin. The resin gets exposed to UV light from the screen below the vat and hardens on the build plate, layer by layer. The model is pulled out of the vat upside-down. These printers are faster by design because they harden the entire layer at once instead of a single dot drawing. They also have a higher resolution and less visible ridges between layers, but are messier and one needs to deal with toxic chemicals. To understand resin a bit more, Brent, from Goobertown Hobbies, explains the resin from the chemist perspective better than I would ever do.

There's also a concern where the fumes from melted plastic are a health hazard that needs to be addressed, but also the evaporation from resin, which needs more study. That's why 3D printers should be kept in a well ventilated room and PPE should be used. The toxicity for the environment and recycling the waste are also a concern. We don't plan to print a ton of miniatures, but we still need to address the waste properly. Like any other dangerous chemical, resin needs to be treated with respect. UV curing the liquid form renders it inert because monomers eventually form polymer chains that are not as harmful to the environment. The outcome is the same, the waste needs to be properly disposed of.

We bought Artisan Guild Patreon subscription to get some really nice miniatures for D&D. Surrounding a campfire with some heroes is a good start. We aligned all the models we wanted that could fit the printer margins. This was done in Chitubox slicer tool and the presupported files had most of the planes under 45 degrees vertically to counter the effects of gravity. The presupported files are great, but Chitubox can do it automatically if your models don't come presupported. One needs to know why printing is done at an angle and align their models properly so the need for the supports is reduced and it's easier to print without ending up with bent model planes.

Chitubox also needs a profile for the machine so it knows the parameters like screen resolution for the printing and what kind of resin is used. Regarding the printer itself, the profile file can be picked up from the manufacturer's pages and loaded into Chitubox.

As for the resin parameters, we needed to consult resin documentation. The problem was that the parameters were provided on the assumption that we would be using the same manufacturer's printer as well. We had to dig a bit to find the correct parameters for our use case. Exposure times and lifting speed are paramount for a successful print. After they were set, we sliced the file and had it ready for printing.

The resulting sliced file was under 250 MiB with over 1000 layers and around 50 grams of resin would be used. The bottle is 1 KG so it wasn't a lot. With the correct settings (don't ask, we had to print twice and we found out about the proper instructions afterwards), the printing process would take around seven hours.

There are a few steps we also had to do:

  1. Upgrade the firmware. Phrozen has instructions for their printers so the resulting files from recent Chitubox versions can be compatible;
  2. Test the LCD. There's a button for it in the printer. Inspect the screen for any deformities;
  3. Calibrate the build plate. Also a button that gives out instructions. Align the build plate accordingly.

With the above done, and setting up the workstation and cleaning equipment (we used pet food trays to work on), it was time to print. PPE was used all the time: safety glasses, breathing masks, nitrile gloves. We also bought Elegoo carbon filters and put them in the printer chamber and turned them on. I know the melted plastic smell because I visited the plastic factory way too often when I was a kid. This one is not that bad, but still we'd like to play it safe. We then shook the bottle of resin for a minute and then opened it and poured the contents out in the resin vat. We covered the printer, inserted the USB memory stick with the file from Chitubox and kicked off the printing. Our window was also open so fresh air could circulate in the room with the printer.

When the printing finished, the resulting models were still dripping a bit, so we left them for a couple of minutes for the majority of liquid to drip away. It was time to wash and clean. With PPE back on (safety first), we removed the printer cover and transferred the build plate, with the printed models still attached to it, into the washing tub of our washing and curing station from Anycubic. We then filled the tub with tap water and covered it. We used the resin from Elegoo that is water washable because IPA (isopropyl alcohol) is tricky to handle and expensive to buy. That said, please have some. We bought a bottle in the local pharmacy because it is invaluable when cleaning the equipment after printing.

We covered the printer again with the lid to prevent the smell and the stray UV rays from reaching the resin in the vat and started a ten minute washing cycle in our washing/curing station. It has a lab type mixer so it was creating a vortex in the tub. After it was done, we removed the tub and pulled out the build plate from it.

It was time to remove the models with a spatula. They were really stuck. Safety equipment is especially necessary here because the crumbling resin supports start flying everywhere. After the models were dislodged, we immediately removed the rest of the supports by (gloved) hand and put the models on a paper towel.

We transferred the water from the tub into a separate container and left it to be cured by the sun. It must not just be poured down the drain because in uncured state it's still toxic to aquatic life. We used IPA to clean the tub, the grate, the build plate and left it all to dry. We then put the washing/curing station in the curing mode and put the models in it to cure for another two minutes. This is the general time for curing and it should dry them out. They were done, but we weren't.


/media/images/3d-printing-results.jpg

We uncovered the printer once more, turned off the carbon filters and took out the resin vat. We sieved the resin back through a funnel into the original resin bottle. Some people leave it in the vat, but we cannot afford that luxury because we don't have a dedicated workshop. We cleaned the vat with IPA soaked tissues since they're softer than paper towels and have a reduced risk of damaging the FEP film on the bottom of the vat. The vat needs to be cleaned after a failed print as well. FEP film on the bottom of the vat will wear out over time so it needs to be replaced eventually.

In the end, we left the used tissues and paper towels from cleaning the equipment (like spatula), the nitrile gloves from handling it all, etc., in a transparent bin bag in the sun. The dirty waste has to be left out a few days so the UV rays from the sun cure whatever is left of the resin particles.

The washing water could be reused for the next printing sessions until there's sludge in it collecting on the bottom. At that point, the sludge can be poured onto a plate so the sun evaporates the water and cures the rest of the resin so it hardens. The hardened resin is ready for waste disposal at that time.

As for the models... they had some post-processing left like filing and polishing where needed. I have to say that we're pretty satisfied with the overall outcome. What can be done with them later is painting them, but I'll leave it for another article. Of course, if something else needs printing, other than the miniatures, I'll be sure to mention it.

Open Science

We still have cases of infections and deaths, but people seem like they decided that the pandemic is over. The COVID-19 pandemic is not over. 2020 wasn't that long ago, when we didn't have any protection in terms of vaccines and the world was panic buying. One only needs to look at our world in data to see that the hospitalizations and spikes are still happening.

Today, most of the discourse revolves around Russia-Ukraine conflict instead of the danger in everyone's house. It's difficult for me to see how the world can be united. It's always in-group, out-group thinking that permeates the society.

Climate change and biodiversity loss haven't gone away either. The great bleaching of the coral keeps happening. The world is not in a good place. It's in a bad one.

Most of my last year was focused on automating things. It continues into this year as well. Just recently I got the standing desk (Ikea Idasen) automated (with ESP32) so it forces me to stand up because I made it switch the sitting/standing modes at certain times of the day. It turns out that before that I was really lazy to push a button, either the one on the controller or in the smartphone app and stand up. This way it just happens and I must adjust. Does wonders for my posture :)

I also installed sensors for windows and the entrance so I can turn off my heating usage if I'm airing the place. Other things, too, like security.

Days are getting longer. DST still wasn't abandoned though. We finally got to walk outside and have a coffee in the nearby park. The sun really ups our mood and the weight of the winter clothes are once again disappearing.

We got triple vaxxed and would go for the next one if needed in the future. There is an effort to find ways to expand vaccine usage quickly enough where normal distribution chains may prove lacking. This was argued with RaDVaC vaccine and it shows an interesting application of it; nasal instead of the regular injection. Also, the push towards opening the research is active with Open COVID Pledge spearheading some of the efforts. Body hacking can be cool.

Opening the science got some traction years ago with now defunct Science Commons. However, people still use Creative Commons licenses to get the research out to the interested parties. It's a noble goal and the civilization can only move forward with it. Scientists take to Twitter and other social media to get enough people to do peer review for them in unpublished pieces before they submit the work to a scientific journal. They need to get their work reviewed sooner rather than later. We really need a new form of peer review process.

There's a whole topic on Open Science about how we don't really have the access to the whole body of knowledge the civilization possesses. More often than not it's hidden behind paywall webs of scientific journals that, while doing a good job in peer review and quality control of the submissions, also get in the way of science proliferation itself.

According to the Universal Declaration of Human Rights, Article 27, Alexandra Elbakyan argues that

Everyone has the right freely ... to share in scientific advancement and its benefits

which is the reason she founded the Sci-Hub.


/media/images/Alexandra_Elbakyan_at_Sochi_in_2021_(cropped).jpg

It is a place where people can pirate scientific articles and see what's inside. When I was doing papers back in the university, I myself could've definitely used the opportunity to easily check something online without potentially paying for content that might turn out not relevant for what I was doing. I can deeply relate to the annoyance of the situation when resources are not readily available, and understand the reasoning to go about it the Sci-Hub way. In my time, there was no other option but to do some legwork and hit the libraries in hope that they had things one needed.

The problem from years ago, and I don't think it has changed, was that the majority of courses were based around the resources known to be previously available to students, rather than being on the bleeding edge of science. It's not that hard to imagine that we should be moving faster than we are.

Prepare In Advance

We've had a lot of time on our hands to get better at planing meals. Food rarely gets boring and humans usually eat several times every day so there's intrinsic motivation to become better at it. It's handy to have some pre-made ingredients at the ready when you're out of ideas or short on time. At some point we were buying, I think, some ready-made dough that came with a small jar of tomato sauce. We kept the jars so now we use them to store things like seeds and nuts, almond flakes, pine nuts. Roasted or raw, they are a great addition to all kinds of meal bowls. For some reason, Vesna gets really excited about storage containers, but if you have a variety of them, you can store all kinds of goodies beforehand:

  • icecubes with botanicals (for gin or some such)
  • the same tray can be used to freeze fresh herbs in olive oil to have a quick ready boost for meals that require those two. For instance, fresh basil in olive oil for tomato based sauces
  • bigger silicone trays or pots can house ready made frozen soups that you can thaw out
  • small jars look cute and can store flavoring oils like chili oil and black garlic oil
  • we've also made nut butters; Vitamix has a program to make those. Aside from pure butters (that we did), you can also make mixed (which we didn't try yet), as well as home made chocolate spread
  • jams, but you should do the ones that you usually cannot buy otherwise. For instance, we made carrot cake jam
  • pickling is also an option, we have a steady supply of ginger (gari), but we also pickled purple onion which looks quite decorative as well
  • jackfruit cashu picked up from Wil Yeung. It's very textured and involves draining the canned pieces, marinating them in a spicy mix and baking in the oven
  • vegan cheeses. Vesna usually makes them and I tag along. She uses cashews as a base with lactic acid and kappa carrageenan, which are easily available to order online
  • herbal teas. Of course, if you have a garden with things like mint, chamomile, rose hip, even better
  • mayonnaise with aquafaba. Don't throw away the water from the chickpea can. It can be used for various things like mayonnaise or vegan cheese
  • cold brew tea. Easily made by soaking green tea teabag per cup of cold water overnight and using it in quick drinks or as is
  • cold brew coffee, not much to say, I wrote about the ease of making it before
  • chili and curry pastes. These can store for some time and can be used when making, well, chili or curry

Here are two quick Vitamix recipes you can try:

Vegan white chocolate spread

Vegan white chocolate spread

Essentially this is a nut butter with white chocolate added in.

Ingredients:
  • 250 grams vegan white chocolate
  • 400 grams Roasted hazelnuts
  • 1 pinch salt
  • 1 splash vanilla extract
Instructions:

Melt the chocolate in a microwave. Put hazelnuts, a splash of vanilla and a pinch of salt in a blender. Put it to a nut butter program and blend. When it's done, add melted chocolate and pulse a few times. Store in a jar.

Grated vegan parmesan-like cheese

Vegan parmesan

You can put it on pasta or wherever the real parmesan would go.

Ingredients:
  • 0.5 cup cashews
  • 2 tbsp nutritional yeast
  • 0.5 tsp salt
  • 0.25 tsp garlic powder
Instructions:

Put all of it in a blender. Pulse on high a couple of times until it's powdery. Use the smallest Vitamix attachment since it's useful to make small amounts quickly.