Gerrit Niezen

hydroponics

I received a Seed Pantry Grow Pod 2 as a Christmas gift. It came with a packet of Sweet n Neat cherry tomato seeds which I planted just after Christmas. On 6 January I started seeing the first seedlings.

Tomato seedlings in a hydroponic grow pod

The grow lights are on a simple timer that is on for 16 hours and then off for 8 hours. It also has a sensor to detect the water level, and beeps until you fill it up with more water. So it's really low maintenance until the plants start flowering. That's when you have to start giving it some liquid fertiliser once a week.

Tomato plants in a grow pod

I planted some basil recently in the other pod and the seedlings just started appearing. Overall I think this is a very easy way of growing things, but maybe a bit expensive for what it is. I transplanted two tomato plants from the pod into regular pots, so it will be interesting to compare them to the two that are still in the pod.

#hydroponics #gyo

Feature image

Back in June, I mentioned building a wireless temperature sensor that I wanted to use for growing veggies. I also mentioned that I wanted to get started with hydroponics. Well, it's now October, and while I've had all the bits and pieces ready, I haven't made a start on this yet.

I mentioned this on Mastodon today, and asked for suggestions for plants to grow in the autumn. Tulsi mentioned greens and pointed me in the direction of Japanese greens, like mizuna. I never knew so many options existed. Cathal Garvey, who some of you may know from building his own bio-lab in his bedroom, mentioned that he is growing lamb lettuce. I picked some seeds up from the garden centre this afternoon, and it will be an interesting experiment to see how they respond to being grown hydroponically.

#Hydroponics

Feature image

I've come down with some kind of stomach bug. I've been feeling horrible all day, but I am hoping that whatever this is will be over quickly.

I have also been thinking a lot about this Twitter thread today. While it's true that conventional gardening techniques will not provide the yield required to feed ourselves and our families, I do wonder if the increased yield from hydroponics, and the ability to grow year round, will make this feasible?

#Hydroponics

Feature image

We had an allotment[1] for a couple of years here in Swansea. It took us a year and a half[2] to get hold of one, as the waiting lists tend to be very long everywhere in the UK. We enjoyed the grow-your-own part of it very much, but it was just too far away to make economic or environmental sense.

It usually took anywhere from 20 to 40 minutes to get there based on the traffic. It's partly this quote from Jay Rayner's “A Greedy Man in a Hungry World” that made me think twice:

if you are renting an allotment a mile or two from your house, which you have to drive to, so as to carry tools there and produce back, you will quickly bestow upon your food a carbon footprint of the size that would embarrass a multinational oil company.

I disagree with a lot of what he says in that book, but he's got a point about the carbon footprint of an allotment that's not within walking distance. We gave up the allotment at the beginning of this year.

Given the super short summer and lots of rain here in Wales, you have a pretty limited growing season if you're not using a greenhouse. It's also easy for pests to quickly wipe out an entire crop. We had lovely tomato plants that were destroyed in less than a week by blight.

I was also a bit surprised by how expensive it can be, for example to provide nutrients like compost if you don't already have your own compost heap. And I found weeding to be very time-consuming, but my wife tends to enjoy it. Overall what I found most disappointing was the yield when conditions weren't perfect.

But what if:

  • we can grow all year round
  • we can eliminate weeds and pests
  • minimize the amount of nutrients required
  • do it anywhere, even on an airship or a boat
  • maximize yield

That's the promise of hydroponics, which is why I want to give it a try. I found a tutorial on Instructables that I'm going to give a go, and will post the progress here when I get started.


  1. also known as a community garden in the US ↩︎

  2. registered with the city council in November 2014, got the allotment in May 2016 ↩︎

#Hydroponics

Feature image

I have a tiny growhouse standing outside that I've used for seedlings in the past, and potentially want to use for growing veggies hydroponically in the future. It occurred to me that I don't know how hot or cold it gets inside.

Given that it is standing against the side of the house, it gets a lot of sunlight at certain times of day and almost nothing at other times. When I know it's warm outside I open up the flap to make sure it doesn't get too hot, but I'd like to know exactly how hot it gets.

I've worked with DS18B20 temperature sensors in the past, so I knew that they are ubiquitous and pretty easy to work with. You can buy the bare chip, but I went with the waterproof version at the end of a 3 metre lead from Amazon for £3.99 including P&P. The reason for getting a temperature sensor on a lead is so that I could keep the prototype (with microcontroller on a breadboard) inside the house connected to power and just run the lead outside through the window, so that it's the only part that needs to be waterproof.

I then had to decide which microcontroller to use. Originally I wanted to use my C.H.I.P. from Next Thing Co. but it looks like they recently went bust, so I dediced to give the ESP8266 chip a try. There are a bunch of NodeMCUs at my local hackspace available for less than a fiver, and they seem like a pretty neat prototyping platform, as it's breadboard-compatible and then just plugs into USB. I've tried using the built-in Lua interpreter in the past, but I found it to be a bit flaky so decided to go down the Arduino Core route instead.

I took me forever to get the basic DS18B20 Arduino code example to work. It turns out that I had my wires swapped: There are two types of DS18B20 sensors with red, yellow and green wires and I had the less common type where the yellow wire instead of the green one is ground. One good thing came out of this: On that page describing the sensor types I discovered that there is an ESP8266 port of Espruino, which would allow me to write actual JavaScript code, not “NodeJS-like” code which is actually Lua[1].

Man, was this a game changer. Espruino has great example code, and a simple web-based editor which allows you to connect to the device over WiFi and update your code over the air (OTA) almost instantly. Compared to the Arduino Core where it can take quite long to update your code over USB, this felt magical. I know Arduino Core has OTA capability too, but I haven't tried it yet.

So, without further ado, here is the code I use to connect to the temperature sensor, cobbled together from various Espruino examples. It takes a sensor reading every minute (in Celsius) and runs a web server that displays a temperature graph. It also toggles the on-board LED when it takes a reading. I specifically did not want to use an IoT platform/service, as they don't tend to stay around for long and the ESP8266 is perfectly capable of running its own web server:

temperature graph

var wifi = require('Wifi');
var http = require('http');

var led = Pin(NodeMCU.D4); // on-board LED
var toggle = 1;
var ow = new OneWire(NodeMCU.D3); // data pin connected to D3
var sensor = require("DS18B20").connect(ow);
var history = new Float32Array(30); // store 30 readings

function updateLed(){
  digitalWrite(led, toggle);
  toggle=!toggle;
}

setInterval(function() {
  updateLed();

  var temp = sensor.getTemp();
  console.log(temp);
  // move history back
  for (var i=1; i<history.length; i++)
    history[i-1]=history[i];
  // insert new history at end
  history[history.length-1] = temp;
}, 60000);

function onPageRequest(req, res) {
  res.writeHead(200, {'Content-Type': 'text/html'});
  res.write('<html><head><meta charset="utf-8"/><meta http-equiv="refresh" content="60"></head>'+
            '<body><canvas id="canvas" width="200" height="200" style="border:1px solid #888;"></canvas><script>');
  res.write('var d='+JSON.stringify(history)+';'+
'var c=document.getElementById("canvas").getContext("2d");'+
'c.moveTo(0,100 - (d[0]-d[d.length-1])*10);'+
'for (i in d) {'+
'var x = i*200/(d.length-1); var y = 100 - (d[i]-d[d.length-1])*10;'+
'c.lineTo(x, y);'+
'if (i % 5 === 0) c.fillText(Number.parseFloat(d[i]).toFixed(1),x,y - 2);}'+
'c.stroke()'+
'</script>');
  res.end('</body></html>');
}

function onInit() {
  wifi.restore();
  http.createServer(onPageRequest).listen(80);
  console.log("Server created at " + wifi.getIP().ip);
}

onInit();

What's also great about Espruino is that it saves your WiFi credentials separately on the flash memory, which means you don't accidentally expose them in your example code. 😉


  1. which is where NodeMCU gets its name from ↩︎

#Hydroponics #Electronics