Plant monitor: Hardware

Patience is a bitter plant, but it has sweet fruit



Created by: Bram den Ouden, 2020-02-25


In Maxwell 22.2 - ‘Autonomy’ of January 2019 I described the issues that occur when keeping plants whilst not remembering to water them. Spoiler alert: they die.

Stating the obvious will solve nothing which is why this insight was accompanied by a design proposal and initial draft: A device which could monitor the water level of a plant and possibly supply water when required. This article can also be found here.

This article will describe the transition to the first developed version of the plant monitor which is based on the proposed components:

  • Microprocessor
  • Power supply
  • Water pump
  • Sensors

Figure 1: Schematic design of the plant monitor V1.1 
update The VEE must be connected to the negative power supply despite what the nexperia datasheet states in table 2

Microprocessor

A processor is the brain of any device and is in this case also tasked with transmitting the collected data. In Maxwell edition 22.2 I proposed and compared three possible processor-transmitter combinations for this project: the AttTiny84 using a 433MHz transmitter, a WEMOS D1 mini featuring the ESP8266 and a processor able to support a Bluetooth module.

Out of these options I chose to use the ESP8266 module instead of the entire WEMOS D1 mini. This option was in my case the most favorable because of its bidirectional communication abilities and the Wi-Fi network which was already in place in my home and balcony.

Power supply

At least 90% of my plants are not close to an outlet or they might even be outside. To be able to apply this device to those plants, it must be able to operate on battery power. Preferably this battery would be charged by a solar cell: a design for a solar charger with boost circuit was supplied in the original article. This first design, however, will not have this solar charging circuit integrated into the circuit board to reduce the overall complexity. It is of course possible to develop this solar charging circuit as a standalone-unit and connect the 5V out to the micro-usb connector of the design.

The power source for this design will be a power bank bought at the local Action which will supply a 5V output with a maximum of 1 Ampere. Since the ESP8266 operates at 3.3 Volts, the 5V output of the power bank poses the need for an additional part of the power regulation to generate a 3.3V line. This task will be performed by the 1117-3.3V low dropout linear regulator. Although this is not the most power efficient way of achieving this goal, it is the least complex way and was therefore chosen for this first design.

Water pump

The originally proposed water pump was a small 3-6V submersible water pump able to deliver 120 liters per hour with an adapter for a tube with a diameter of 5 mm. This pump had the advantages of being very cheap and being able to operate on the nominal voltage of the USB powerbank. Unfortunately, during testing it was barely able to supply water through the 10M water hose with a diameter of 8mm that I had available. Although this pump might be an ideal solution for indoor plants much closer to the pump, for my purposes this pump was not good enough. The second pump I tried was a 12V submersible pump advertised to deliver 240 L/H. This pump was able to deliver a nice flow of water through the same hose although a boost converter was required to power it from the 5V power bank.

Sensors

In order to measure the amount of water in the soil, a soil moisture sensor is required. The available choices are:

  • A resistivity-based sensor
  • A capacitive sensor

The sensor based on resistivity sends a small current through the soil and determines a value for the amount of water in the soil based on the resistance measured between its two terminals. This sensor is the cheapest option but is also very prone to corrosion due to the metal areas exposed to wet soil. The second type of sensor, the one I chose, is about 4 times as expensive but at a whopping €1 a piece, this is still quite manageable ;).

The capacitive sensor accepts an input voltage of 3.3V up to 5V and outputs an analog value between 0V and its input voltage.
The chosen microprocessor, the ESP8266, features a single analog input which can only handle voltages up to 1.1V before destroying it. Using a resistive voltage divider on the output of an analog sensor will allow us to connect devices with almost any output voltage to this analog input. Unfortunately this will only allow for 1 sensor to be connected.

Such a shame… A complete device required to monitor a single plant… If only there were ways to connect multiple analog sensors to a single analog input…

  

Just kidding, of course there is: Multiplexers.

In order to attach up to 8 different analog sensors to a single device, a 74HC4051 multiplexer is added. This multiplexer requires a 5V power supply and 3 digital signals to select which of the inputs is connected to the output. To be able to connect the multiplexer to the ESP8266 without destroying it, the earlier mentioned resistive voltage divider must be applied to the output of the multiplexer.

Figure 2: The designed PCB

PCB design

For this design to work, all of the above-mentioned components have to be connected so it was time to design a circuit board for this first design. For the ESP8266 to operate in the desired mode, a few pins have to be at a specified voltage during boot:

3.3V Ground
reset pin15
enable
pin 0
pin 2

The reset pin, enable pin, pin 0 and pin 2 are pulled up to 3.3V by resistor R5, R6, R7 and R8. Pin 15 is be pulled down by resistor R9.

To be able to reset the processor, a reset button (RST) has to be able to pull the reset pin to ground. Programming the ESP8266 after it has been soldered onto the PCB requires the chip to boot or reset whilst pin 0 is pulled to ground. This can either be done manually by adding a button or can be done by the programmer by adding transistors Q2 and Q3. Header 3 (H3) is used to connect the programmer to the PCB. Header 2 and 4 (H2 and H4) feature a 3.3V line, a ground line and a digital input/output pin to connect external devices to.

To allow for more flexibility, a soldering jumper was added to connect A0 directly to the analog input of the ESP8266 if the multiplexer is not soldered onto the PCB. This limits the amount of analog sensors to 1 but also reduces the power usage of the device.

A MCP9701AT temperature sensor is added to the PCB to be able to measure the on-board temperature. This sensor can be connected to A0 by adding a jumper across the TMP header and the SIG header right above it as shown by the green jumper in figure 2. As mentioned earlier, the analog input of the ESP8266 can only handle up to 1.1V and therefore a resistive voltage divider is used. This divider consists of R2 and R3.

These resistor values are extremely important!

If Vcc*R2/(R2+R3) => 1.1V, the ESP8266 can be damaged or destroyed!

Enclosure

Having created a nice PCB, it would be a shame to just leave it out in the weather to corrode and die.

For this reason I started Solidworks and designed an enclosure for both the battery and the PCB. Although the size of the PCB is only 88x35mm, 3D printing would have taken quite some hours. Cutting the enclosure out of wood offered a much faster solution.

The resulting enclosure is designed to be laser cut out of 5.5mm thick multiplex. The thickness of the wood you use should be similar to avoid the rabbit ears from sticking out. Apart from the odd looks, choosing the wrong thickness could also cause the lid to have a loose fit.

Using wood and a laser cutter is cheap and fast but it also has its downside: Wood generally doesn’t like water or too much moisture. To prevent the housing from falling apart after a while, it is advisable to coat the wood with a waterproof paint or varnish. To allow fresh air to dry out the moisture built-up inside the enclosure, the bottom plate contains aeration holes.

The DXF files for the enclosure can be found in the download section below.

Figure 3: Designed PCB in front of the lasercut enclosure

Conclusion

The first version of the plant monitor has been designed and assembled, it will be tested thoroughly in the near future but the results so far seem promising, which brings me to the next part: software.

  • How and where will the data be collected?
  • How will the data be communicated to the plant owner?
  • What level of autonomy must the plant monitor have?

All of these questions will be answered in time so keep checking https://klushok.etv.tudelft.nl/projects and see you in the next project!


This project was originally published in Maxwell 23.2: Transition