Greenhouse computer improvement

New sensor!

I was using an MHT22, hanging on wires outside the case, for temperature readings on my greenhouse computer. I wasn’t happy with it, as it isn’t really compatible with the connections on the Raspberry Pi, and it has a habit of giving occasional absurd readings for no obvious reason.









So, I got myself a Microdia TEMPer-2, from PiHut, which plugs into a USB port. It has a fancy button on it, which activates the sending of text messages or emails, which I shall never be using. It also has an external plug in sensor, which is waterproof, a handy thing in a greenhouse!

It comes with a software mini-disc, which may possibly be useful if you’re using it on a PC, whatever they are. (Kidding. I’m writing this on my PC.) There are several web sites that tell you how to program Python to read from it, and it didn’t take me long to install the appropriate library on the greenhouse computer, and run the test command, sudo temper-poll. That worked, but then I ran into one of those programming blockages that can send you crazy. None of the various pieces of example code would work, mostly due to my inability to get the necessary permissions set correctly. It didn’t matter, I realised, after a lot of head scratching. Instead, I just used Python’s subprocess library to run the command that worked…
import subprocess

rv = str(subprocess.check_output(“sudo temper-poll”, shell=True))
# Split the string, keep fourth block, chop last five characters, make float.
temperature = float(rv.split()[4][:-5])

I’m hoping I won’t need to write any more software for the greenhouse for a while. The Raspberry Pi now monitors the temperature, switching the fan heater on if the temperature is below 5°C, uses its fish-eye camera to take pictures at set times for a time-lapse series, and takes a picture if it spots movement. Eventual improvements under consideration are a soil moisture detection sensor, automated watering… Nothing’s ever really finished, is it?



Me, wearing a Panama hat, spectacles, and a fine growth of facial hair.

Author: Walrus

Just this guy, you know.