The control System
The control system runs on a NodeMCU esp8266 these are available online for less than £6 and is a great bit of kit for all sorts of projects.
I have attached mine to a breakout base board to enable easier and tidy cable connections.
The NodeMCU takes readings from the sensors and turns on relays based on the results, with this it can turn on grow lights, a water pump, fans and a heater, this enables the system to maintain any environment I choose to have inside the shed.
The sensors I am using are, a moisture sensor to measure the dampness of the soil, a DHT22 for temperature and humidity in the shed and a photoresistor to measure the amount of light.
The built control board consists of the NodeMCU, three sensors, and four relays, the code that runs on the NodeMCU first connects to the MQTT broker on the raspberry pi 3 B+, once connected it reads the information from the sensors and then triggers the relays to turn on or off, the Mosquitto MQTT then sends the sensor data to Node-RED, the code is set to run every 15 seconds.
Please note the system will work on the new Raspberry Pi 4 and I intend to upgrade once the shed is fully setup and is running.
I have installed a Diet-Pi image on my Raspberry PI and would recommend it to everyone, it makes life so much easier than any other operating system available for the Raspberry Pi.
Mosquitto MQTT is a simple messaging protocol, designed for constrained devices with low-bandwidth. So, it’s the perfect solution for Internet of Things applications. MQTT allows you to send commands to control outputs, read and publish data from sensor nodes and much more. Mosquitto MQTT can be installed by Diet-Pi.
Node-RED is a programming tool for wiring together hardware devices, APIs and online services. Primarily, it is a visual tool designed for the Internet of Things, but it can also be used for other applications to very quickly assemble flows of various services. Node-Red can be installed by Diet-Pi.
With this combination I can publish the results online with Thingspeak this enable me to monitor the environment inside the shed from anywhere.
As you can see the components are relatively cheap, I managed to get everything for well under £100.