Julian Rogers Home Greenhouse monitoring and control 3 Greenhouse monitor development

Under Construction

Greenhouse monitoring and control 4

Software

This, on the left is a screen shot taken from my PC showing the Raspberry Pi running in a VNC window. The Pi is running a test Python program which is interacting with the Feather controller over UDP. I chose to communicate between two computers only a couple of centimetres apart using UDP over wifi rather than, say, a direct serial connection, so that any other computer on the network could also participate if required. (There is, in fact, a serial connection between the Pi and the Feather which is used to program the Feather and receive data direct, if required, using the Serial Monitor facility.)

At present the Python program does a few basic things. Later it will do a fair bit more, I hope!

Firstly, it checks that the Feather program is running. The Feather turns an LED on and off as it runs through its main loop. A Pi GPIO pin is directly connected to this (via a ZTX450 transistor buffer). The red square (actually a button) flashes in sympathy.

 

The program counts the number of times this flashes in 30 seconds. If it is less than 15 times the label to the right of the red square indicates that, in the opinion of the program, the Feather is not running. If the “Auto Reset” facility has been enabled, the Pi will then reset the Feather by taking its reset pin to zero volts by means of a PI GPIO pin and a ZTX450 buffer. There is also a button to reset the Feather manually. During development the Feather can crash and the reset facility is useful (remember, the Feather is in a box at the bottom of the garden!)

The program also shows some data from the Feather in a rather cryptic form including the time in minutes (the time is also shown in hours and minutes)  and the temperature as measured by the TMP102 sensor (X10) and the thermostat setting (again X10).

Finally, a text based command can be entered which is transmitted to the Feather. Several commands are recognised and there is some validation included. The Feather recognises the command “reset” which causes the Feather to trip the relay which disconnects power to the Pi, if the Pi has been shut down. This is not allowed by the Python program (why would you want to reset the Pi if it were already running?) but can be sent by a remote computer if necessary.

The Feather program logs into the local wifi and retrieves the preset temperature value for the thermostat function from the SD card. It decodes the time on its clock and allows the clock to be adjusted to the correct time. It accepts updates to the thermostat temperature and stores them on the SD card. It sends the status data noted above on request from the Python program. It also accepts various commands such as turning off the thermostat function and reverting to direct remote control of the heater. Of course, it measures the local temperature detrmined by the sensor and turns the heater on and off as required avoiding on/off “flutter” or “chatter”.

At present, the system is not much more than a very complicated thermostat! But, hopefully, it will be able to do a lot more in the future along the lines described earlier.

The Python and the Feather program will be available as pdfs.

Next: some development and modifications.