Temperature is important in soilless cultivation. Articles agree on an ideal growing temperature between 18°C and 26°C. A too cold temperature will slow down growth but increase the dissolved oxygen in the water. While too hot temperature will increase bacteria and disease in the plants.
It should be noted that pH and EC are correlated with temperature, so the values of these two sensors must be corrected.
It is therefore essential to monitor the water temperature, which is why I will be adding 3 sensors to the UltraTower. There will be two DS1820 waterproof temperature sensors one located in the main tank and one in the root chamber. The third sensor is the DHT22 which will be located at the top of the tower to monitor the ambient air temperature and humidity.
For energy saving reasons, the sensors should not be active continuously but only when needed. Both types of sensors are compatible with the 3.3V of the ESP 32.
If we look at the datasheets a DS1820 sensor consumes 1.5 mA in active mode and the DHT22 consumes a maximum of 2.1 mA. This gives us a total of 5.1mA which is largely supported by one pin of the esp32 which can deliver 40mA.
Therefore, we only need 3 pins, one to power up all the sensors and switch off when not using it, one for the one wire technology of the DS1820 that allow us to read the both sensors with only one pin and the last pin is use to read the DHT22.
I'm not going to detail the code in this log as it is quite simple to read the sensors. You can look at the examples of the 3 libraries that I use for these sensors:
- DHT22: DHT (MIT License)