As illustrated in a previous post, you need only a few Yoctopuce modules and a very simple logic to regulate an environmental factor such as humidity. Starting from there, why not generalize the principle and produce an environment fully optimized for a specific aim, such as growing plants? We decided to test this principle to grow mushrooms. Mushrooms, rather than tomatoes or pumpkins, because mushrooms grow fast and in the dark. It's therefore quite easy to make a time-lapse of their growing if you control lighting well...
We selected common mushrooms (agaricus bisporus) because it's quite easy to find growing kits for this type of mushrooms in garden centers. The first element of the kit is a polystyrene box. The bottom of the box contains a not very engaging lyophilized matter, we don't exactly know what it is, but we're quite sure that we don't want to know :-) Growing these common mushrooms is quite easy: you must fill the box with the compost provided in the kit, and keep everything very humid by spraying water several times a day while maintaining the temperature between 16 and 18░C.
Mushrooms are going to grow in there
We put our kit in a little cellar. The cellar temperature being lower than the required one, we installed a small ceramic heater. We modified the heater by adding a Yocto-LatchedRelay to its power supply.
A simple heater, hacked into an USB heater
Automatic control of the temperature with a heater, a Yocto-Meteo, and a Yocto-LatchedRelay
Every ten minutes, the hub triggers a PHP script through an HTTP callback. If the ambient temperature measured at the time of the callback is bellow 17░C, the script turns the heater on during one minute. This is enough to maintain a constant temperature in the cellar, to the nearest fourth of a degree.
We managed to keep the room temperature very stable
Common mushrooms need a very humid soil to grow. To the point that you are supposed to spray water on the box several times a day. We solved this issue with an electric sprayer. This sprayer looks like a classic sprayer, but you only need to press the switch for the internal pump to start working and spray water. We simply modified the system by wiring a Yocto-PowerRelay in parallel to the trigger.
An electric spray bottle, now USB controled
Our soil moisture sensor
The sprayer and the Yocto-4-20mA-Rx are connected to a YoctoHub-Wireless. Every ten minutes, the hub runs a PHP script through an HTTP callback. If humidity at the time of the callback is below a given threshold, the sprayer is turned on for 15 seconds.
Automatic control of the soil moisture with a 4-20mA probe and a sprayer
To make our time-lapse of growing mushrooms, we reused our automatic picture taking system based on a Canon EOS camera and a Yocto-Relay. For light, we used a large led projector, which we also modified by placing a Yocto-PowerRelay on its power supply.
Our hacked USB controlled floodlight
The projector and the camera are controlled by a YoctoHub-Wireless: every ten minutes, we turn on the light, we take a picture, and we turn everything off immediately afterwards.
We take a picture every ten minutes. The light and the camera are controlled with a Yocto-PowerRelay and a Yocto-Relay
A piece of advice: deactivate all the automatic features of your camera, including auto-focus, if you want to obtain a picture quality constant from one picture to another.
The complete installation, apart from the heater which we put on the ground
Coding is dead easy: each Yoctopuce hub is able to connect itself at a regular interval to the server of your choice and to run a PHP script while transmitting the value of all the sensors connected to it. The script can then answer with a list of actions to be performed on the actuators. For instance the script for the temperature control is as simple as: if too cold then turn the heater on.
if (yRegisterHub("callback",$errmsg)!=YAPI_SUCCESS) die($errmsg);
$temperatureSensor = YfindTemperature("temperatureSensor");
$heatControl = YfindRelay("heater");
$temperature = $temperatureSensor->get_currentValue();
if ($temperature<17) $heatControl->pulse(60*1000);
Note that this very useful technique is also available for Java and Node.js.
The experiment ran for several weeks without anything growing despite a completely stable environment. Just when we were about to give up, the first mushroom started to come out of the ground, soon followed by a string of others.
It's moving, it's alive, it's alive, it's alive, it's alive, IT'S ALIVE!
We can confirm that mushroom grow quite fast: on the following video, each second equals roughly 4 hours.
As you may have noticed, we thought we were growing mushrooms, but actually we were raising a multitude of tiny-creepy-crawly bugs.
From the Yoctopuce technology standpoint, this is a complete success: we have once more demonstrated that with a few relays and a few sensors connected to a YoctoHub, it's very easy to transform everyday objects into connected objects with fairly complex behaviors.
From the gardening standpoint, there is room for improvement. Using a sprayer is clearly not the most efficient method to water our box: way to much water is lost because it's sprayed outside of the box. Next time, we'll have to find a way to spray from the top. The soil moisture sensor works well, but the values measured depend too much on the way it is installed. The values measured may vary from simple to double depending on the orientation of the sensor and the compactness of the soil. It is very efficient to measure variations and thus maintain a constant soil humidity, but we cannot base ourselves on it to obtain an exact absolute value.
Finally, we could eat the result of one of our experiments, and this is a first for the Yoctopuce team!