I’ve got an itch I want to scratch
Since we started our mushroom growing adventure I have been dreaming and scheming about how to measure the temperature and humidity in the mushroom grow room. It didn’t take a very long dream to lead me straight to my other adventures with the Arduino micro controller platform and the Raspberry Pi micro computer. Both these devices can easily accept sensor input and do something with the data that they receive and I had one of each of these devices sitting in boxes after our move to South Australia.
Options, Functions(); and Iterations
I’ve had a little bit of options paralysis getting this little project off the ground because of the possibilities I see when delving into this world of coding, electronics, horticulture, permaculture, sharing, open-source etc etc. The grand plans of an amazing sensor fest measuring and switching and making decisions based on algorithms constructed from courting the muse of creation! Ha. Just log some data first hey? Sounds like a good place to start.
Question 1: What do I want to measure first?
One of the most important, but also the easiest data to measure in relation to growing mushrooms is the temperature and the humidity of the spawn run and fruiting rooms. Since we only have one room which is a combination spawn run and fruiting room, I wanted to measure what was going on inside this room throughout an entire day.
With a little bit of searching I found a dual temperature and humidity sensor package called the DHT22 which has software libraries for either the arduino IDE or the python programming language on the raspberry pi. It is a relatively simple sensor with a degree of accuracy that will be good enough to get some initial data.
Question 2: What prototyping platform should I use, Arduino or Raspberry Pi?
I started out on the Arduino but because I don’t have an ethernet shield or a SD Card shield I had no way of logging the data without having my laptop permanently connect to it via a usb cable. I did however, develop a few bits of code and ideas for logging data from the arduino to Phant, an open-source data-logging server program from SparkFun, which I may wrap into this dream one day. The upshot of my lack of hardware for the Arduino is that I decided to just develop some code and connect the DHT22 sensor to the raspberry pi instead.
Question 3: What programming language will I use to write the code?
I have only had limited programming skills (HTML, Arduino IDE, Processing and PureData) but I feel like I have a little bit of a grasp of some of the formalities of coding to be able to read examples and change them to what I require. The programming language that is most commonly used with the raspberry pi is Python and that is what I have used because of the plethora of examples, tutorials and enthusiastic generous users.
A DHT22 sensor is installed in the mushroom grow room and is connected to the raspberry pi GPIO pins via an old 10baseT networking cable I had lying around.
The DHT22 sensor is protected from water spray from the grow room misters by a plastic dip container and faces strategically away from the nozzel of one of the misters.
The pi is logging the data to a file on its SD card for later retrieval to my laptop via the pi ethernet port. If you look closely you will see a blue Arduino Uno and an electronics bread board mounted on the SparkFun Inventors Kit mounting board. The Arduino is just sitting there because I could be bothered to remove it from the board and the bread board is used to connect the DHT22 wiring to the raspberry pi.
I wont go into the ins and outs of how to connect and program the raspberry pi because the extremely generous and wonderful tutorial that I followed on youtube, by Alexander Baran-Harper, explains it all except for a few additions to the code that I have made.
The following is the code that is running on the pi to log the data. Hopefully the comments make it clear what is happening.
In analysing this graph we can see that every two hours the humidity in the room rises to nearly 100% relative humidity, then drops off over the next two hours. This corresponds with the misting schedule we have set at present. This schedule is currently based on a number of factors and limitations that we have observed and learnt about growing mushrooms where we are in South Australia. One of the main limits we have is that all our water use on the farm comes from rain water stored in tanks. We can’t run the misters often or for long periods, or we increase our chances of runing out of water. Luckily for us we don’t have to run them too much because we found that when we do run them too much there is a high possibility of mould growth in the room or in our grow bags.
So, from looking at this data we can try scheduling the misting system more frequently, but for less time each run, so as to keep the humidity closer to the optimum fruiting humidity requirements for oyster mushrooms which is about 95%.
There are three main drops in the humidity, one at 3:20pm, 11pm and 3am. At about 3:20pm the humidity takes a dive to about 73%. This drop is when Ella and I loaded the next batch of inoculated grow bags into the room. Opening the door to the room drops the humidity by allowing the air inside to flow out and less humid air to enter the room. The drops at 11pm and 3am are when the evaporative air conditioner turns on for 1 hour each time to inject a flush of outside air that brings oxygen into the grow room. Oyster mushrooms need oxygen in their fruiting stage and the sealed room builds up carbon dioxide without mechanical air movement.
Where to from here?
So many ideas, so little time! An automated humidity, oxygen and temperature control system that is connect to our Little Bunyip computer network, accessible and controllable via the internet and phone, and able to send alarms via text/email would be awesome. So…… I’ll keep you posted.