How To Build An IoT Plant Monitor using ESP8266

For more information, please go to Lionel-Lim/plantMonitor: Project for CASA0014 (github.com)

Intro


When I was a primary school student around the 2000s, I sometimes heard about “Ubiquitous”. It means that any user can compute anytime, anywhere, on any (omnipresent) device. The word was absurd because computers were just beginning to spread to the home. On the other hand, I wondered what great things we could do.

In 2022, as the Internet of Things(IoT) is introduced, the term is not limited to users, but the Things also communicate anytime, anywhere, over any device. It created massive information which is not been observed before (maybe). However, the information seems to be used sparingly. In this article, I would like to share the journey in the first term of MSc Connected Environment and would like to share my reflection on the journey.

Developing Plant Monitor Device

1. Overview

In the past couple of weeks, I was able to experience the process of shaping ideas, prototyping them, and making products into a more advanced form through feedback in the “Learning By Doing” environment. As one of the results of the CASA0014 – Connected Environments, I would like to introduce the process of developing the plant monitor. 

The device measures the ambient temperature and humidity(DHT22), the degree of moisture in the soil(Moisture Sensor using a pair of nails), and the light environment(Adafruit AS7341). It sends them to the internet(Adafruit Feather Huzzah ESP8266). The data is stored on a microcomputer(Raspberry PIMQTT and InfluxDB), allowing users to use the visualised data(Grafana) as a decision-making tool to see if the condition of the place is appropriate. 

My first impression when I received the plant was :

I know that I can measure data, but how can I know whether the numbers are suitable for the plant? 

Therefore, I started to study the plant.

The plant I received is Ficus microcarpa Moclame. It needs a lot of water, mild temperatures, and humidity for growth. Also, the rapid environmental changes put a lot of stress on the plant. Therefore, I classified which sensors could be used to measure each element and decided how to visualise them for decision-making.

2. Light

The light environment is one of the critical factors of photosynthesis. In general, plants use specific light spectra for growth. This is generally red and blue light. However, green light is not absorbed much but reflected.

(“What is Photosynthetically Active Radiation?,” n.d.)

As a method for quantitatively evaluating this, NDVI (Normalised Difference Vegetation Index) is often used.

In the above equation, NIR means near-infrared spectroscopy and Red means infrared region. To measure this, I used the AS7341 sensor. The sensor numerically represents 10 bands between 415 and 680 nm in the visible light area.

This sensor is relatively cheap compared to an expensive spectrum analyser. However, the ultraviolet and infrared areas are difficult to measure and cannot guarantee accuracy. However, the sensor could measure the trend of how the placed environment changes and the plant receive appropriate light.

3. Temperature

Different plants have different suitable temperatures. My plant prefers between 21 and 25°C as the right temperature. To measure the range, the DHT22 sensor has been used. This sensor can measure temperature and humidity simultaneously and temperature between -40 and 80 °C with ±0.5°C accuracy. Thus, It is considered a suitable sensor for use.

4. Humidity

It is important to maintain a proper degree of humidity. Plants typically absorb CO2 through pores during photosynthesis to produce energy and release oxygen. However, if the pores remain open due to low humidity, the plants cannot maintain the moisture level and lose moisture through the pores. On the other hand, when the humidity is too high, and the pores are always blocked, it makes the plant difficult to absorb CO2 (Cielo, 2021). Therefore, proper humidity between 40-60% should be maintained. The DHT22 sensor has also been used to measure humidity. This is considered the appropriate sensor because humidity between 0-100% can be measured with 2-5% accuracy.

5. Soil Moisture Level

Plants need water at appropriate intervals than to give it a large amount at once. So, the water cycle is set using the dryness of the soil. In the case of this plant, when the surface of the soil is dry, it is appropriate to water the soil. However, in winter, plants do not need much moisture, contrary to popular belief. Therefore, plants can be kept healthy by giving enough water when the soil is dry. 

To measure the amount of water in the soil, a pair of nails have used. When one nail emits 3.3V into the soil, the other nail reads the transmitted voltage with an analogue pin(ADC) to determine the moisture level. However, it is important to calibrate the data with appropriate values considering various conditions, such as the method of pouring water, the distance between nails, and the buried distance in the soil(“Soil resistivity,” 2022). The analogue pin of ESP8266 has a 10-bit resolution, which means the range is from 0 to 1023. To test this, I checked the highest value by connecting the two nails with a wire, and it showed the maximum value.

However, even if the soil is wet enough, the highest value is not expected because of the type of water and soil. In addition, easy-to-understand values such as percentages are advantageous in terms of user experience rather than ambiguous numbers. Therefore, I did the numerical analysis and tested it to calculate a realistic value.

In the experiment, the value measured from the nail was recorded when water began to be poured. In addition, the value of 0-1023 was mapped to a value between 0-1 to see it as a percentage. Also, I checked the wetness of the soil and recorded it. As a result, when water started to be poured, the value rose quickly, and the soil was already mostly wet at around 140 before mapping between 0 and 1. Therefore, there is a need for another method of mapping the values.

TimeRaw data0-1 mappingDryness
000Full Dry
1200.01953125Full Dry
2400.0390625Almost Dry
3600.05859375Almost Dry
4800.078125Almost Wet
51000.09765625Almost Wet
61200.1171875Almost Wet
71400.13671875Fully Wet
81600.15625Fully Wet
91800.17578125Fully Wet
102000.1953125Fully Wet
112200.21484375Fully Wet
122400.234375Overflow
132600.25390625Overflow
142800.2734375Overflow
153000.29296875Overflow
163200.3125Overflow
173400.33203125Overflow
183600.3515625Overflow
193800.37109375Overflow

So, I used the hyperbolic tangent function to normalise the value. Using the function, I could achieve the characteristic of soil wetting quickly and express the value between 0 and 1.

As a result, I could see that the soil was sufficiently wet at 0.8. Therefore, if this is converted into a percentage, the user will know the watering time at about 30% and stop the watering at about 80%.

6. Build Process

Understanding the concept is important, but building it is also very important. The picture above shows how the sensor was built. At first, as shown in the image below, I tested the desired function quickly using the breadboard and wires.

After that, the device was miniaturised by attaching a shield with pre-designed buses.

Finally, the 3D-printed enclosure was used to protect it from the external environment.

It was possible to increase the completeness while confirming the device’s performance through prototyping, miniaturisation, and review process.

7. User Experience

The device used in this article transmits information using the MQTT protocol, and the Raspberry Pi server stores it in InfluxDB. The collected information is visualised using Garfana. To be used as a decision-making tool, it was more important to express the values user-friendly than to display the values collected from the device. The easiest way to access the data is using the local web since It does not need an internet connection. Therefore, the collected real-time information is provided in a user-friendly manner using the ESP8266 board.

8. Feedback

Deploying the device is not the end, but it is the start. In the project, some points can be improved for the long-lasting device.

  1. As the moisture sensor, the nails will rust, and the value deviation is large. However, It can be solved by preventing the sensor from being exposed to water and using a capacitor(Jode, 2020).
  2. Adding an external battery will help with continuous information transmission. 
  3. The shield design and the enclosure are needed to be updated for the light sensor.

9. My reflection


In the title of this article, you can notice the question mark. I actually knew why my plant kept dying, but I did not want to leave my comfort zone, and now the reasons are confirmed. We are observing a lot of information that was not quantified before. Having more information makes people uncomfortable because we usually prefer sticking to the routine. Let me explain a bit about Architecture, Engineering and Construction(AEC) industry, especially Construction.

(Potter, 2021)

Construction productivity had never been good since hand drawings until CAD(Computer Aided Drawing) era. Thanks to the advanced sensors, graphics and AI technologies, We can partially create a virtual construction model to find the potential issues, which was my job. This work process, called Building Information Modelling(BIM), is considered the method that can boost productivity.

What surprised me most was that the “find the problem” sometimes made everyone uncomfortable because they knew the problem but did not want to face it. Fortunately, the problem is becoming solved since the data-driven work process is becoming standard.

This will likely happen or is happening or already happened across the industry, and it is necessary to change the way of work that relies on the hunch and experience, and It will be done as we did.

Then, What are the role of connected devices and the professionals? I think more devices are needed to be connected, accessible and maintained. When the connected environment becomes normal, It will change the way of thinking like smartphones, Space X and AI.

Bibliography


Ann Marie VanDerZanden (2019) ‘Environmental factors affecting plant growth’, Environmental factors affecting plant growth. Oregon State University Extension Service, 7 January. Available at: https://extension.oregonstate.edu/gardening/techniques/environmental-factors-affecting-plant-growth (Accessed: 17 November 2022).

Cielo (2021) ‘10 Tips on How to Increase Humidity for Plants That Are Borderline Magic!’, Smart AC Controller, 23 September. Available at: https://www.cielowigle.com/blog/humidity-for-plants/ (Accessed: 16 November 2022).

Duncan Wilson and Dhruv Kumar (no date) CASA0014 – 2 – Plant MonitorGitHub. Available at: https://github.com/ucl-casa-ce/casa0014 (Accessed: 17 November 2022).

Jode, M. de (2020) ‘Making a Plant Monitor – UCL Connected Environments’, 30 April. Available at: https://connected-environments.org/making/plant-monitor/ (Accessed: 17 November 2022).

N. Jordan Franklin (2021) ‘Should I Water My Plants in the Winter?’, Home & Garden Information Center | Clemson University, South Carolina, 13 December. Available at: https://hgic.clemson.edu/should-i-water-my-plants-in-the-winter/ (Accessed: 16 November 2022).

‘Normalized difference vegetation index’ (2022) Wikipedia. Available at: https://en.wikipedia.org/w/index.php?title=Normalized_difference_vegetation_index&oldid=1091838758 (Accessed: 17 November 2022).

Potter, B. (2021) ‘Construction, Efficiency, and Production Systems’, Construction Physics, 4 May. Available at: https://constructionphysics.substack.com/p/construction-efficiency-and-production (Accessed: 17 November 2022).

RHS (no date) Ficus microcarpa ’Moclame’PBR. Available at: https://www.rhs.org.uk/plants/164300/ficus-microcarpa-moclame-(pbr)/details (Accessed: 17 November 2022).

‘Soil resistivity’ (2022) Wikipedia. Available at: https://en.wikipedia.org/w/index.php?title=Soil_resistivity&oldid=1081452616 (Accessed: 17 November 2022).

Sönke Johnsen (2012) ‘Appendix A. Converting Spectral Irradiance to Lux’, in The Optics of Life. Princeton University Press, pp. 287–289. Available at: https://doi.org/10.1515/9781400840663-012.

What is Photosynthetically Active Radiation? (no date) BYJUS. Available at: https://byjus.com/neet/photosynthetically-active-radiation/ (Accessed: 17 November 2022).