An Arduino Plant Monitoring & Watering Device

Using Arduino with Parts and Sensors – Plant monitoring & watering device (with micro SD card)

An Arduino Plant Monitoring & Watering Device

In the last project, I used a micro SD card slot DIP kit to work with an SD card. This time, we will write values to a micro SD card and combine temperature sensor, light sensor, and new soil sensor to enable monitoring and watering a plant on my desk. Will this be helpful? Let’s build it and find out!





Get IoT Essential Guide &  Enter to Win a Free Sensor Kit!




Expected time to complete: 120 minutes

Parts needed

Simultaneous communication with a micro SD card via the Ethernet shield

There are several ways to use a micro SD card in Arduino-based projects. If you want to minimize the work, you can connect to the regular SD card easily by using an SD card shield, Ethernet shield, Arduino wireless SD shield, or any other shield that has an SD slot mounted on it.

This time, we’ll use the micro SD card adapter on the Ethernet shield introduced when we created a web server with Arduino.

It is very convenient because the shield has a micro SD connector and can also communicate via LAN cable.

An Arduino Plant Monitoring Watering Device

Figure 1: Arduino Ethernet shield

Set up the Ethernet shield as shown in the linked article. As noted in Diagram 1 below, there are certain pins that can only be used with the LAN adapter and not with the SD card. So, we will have to build our circuit in the other pins.

An Arduino Plant Monitoring Watering Device

Figure 2: Usable pins on the Ethernet shield

Using the micro SD card via the Ethernet shield

An Arduino Plant Monitoring Watering Device

Figure 3: A micro SD card mounted on the Ethernet shield

There are several differences from what we did in the previous article, using micro SD card on the Ethernet shield. The micro SD card’s Pin 2 is used for recording data and is connected to Pin 10 on the Arduino. This is aligned with Pin 4 on the Ethernet shield.

Micro SD pin specification:

An Arduino Plant Monitoring Watering Device

Now, let’s program some codes!

These codes read data from the SD card.

An Arduino Plant Monitoring Watering Device

Figure 4: Confirmation of output on Serial Monitor

I was able to read the contents of the micro SD card via the Ethernet shield.

Recording data from the temperature and the light sensors

Now that we have the micro SD card set up, let’s record data from the temperature and the light sensors. If you’ve forgotten how to use the temperature or the light sensors, please refer back to this article where we make a Stevenson screen.

You can see the wiring diagram below:

Figure 5: Wiring diagram of temperature & light sensors connected to Ethernet shield

Figure 5: Wiring diagram of temperature & light sensors connected to Ethernet shield

An Arduino Plant Monitoring Watering Device

Figure 6: Circuits for temperature and light sensors

In the program, the data from the temperature and the light sensors is read using Analog Input and is written on the micro SD card. You set up the SD card using SD.open(“File name”, “Write mode”) from the Arduino SD card library. Once the file is open, the contents must be passed as a File variable and only then can reading or writing to the SD card occur. After all processing is complete, don’t forget to close the file with .close().

An Arduino Plant Monitoring Watering Device

Figure 7: datalog.txt

I successfully wrote the data.

Let’s build a plant monitoring device!

Now that we can write and read data from a micro SD card, let’s try to assemble a device!

Indoor plants need continuous care. Sometimes, watering your plants every day can get tedious. I’ve had numerous instances where I’d leave my plants and forget to water them for a long period of time and I would find my plants all droopy or even dead upon my arrival. Today, we’ll solve this problem by developing a watering machine!

An Arduino Plant Monitoring Watering Device

Figure 8: A desk plant to be used for this tutorial

Deciding on the design for the plant monitoring device!

First, let’s figure out the design of the device. We want to reduce the burden of watering plants so it’d be nice to have a soil sensor to detect when the soil is dry and automatically water the plant. Also, I want to read values from the temperature and the light sensors simultaneously and record them together on the SD card. We can also predict when the flowers will start blooming based on the accumulated temperature data. We can write a program that will make flower blooming predictions based on the data stored in the SD card. To summarize, we want to:

  • Detect soil dryness and water the plant
  • Record soil sensor, temperature sensor, and light sensor data in the SD card

Now, it’s time to build a device that will do these two things.

Making the soil sensor

First, let’s build a soil sensor to measure the soil’s dryness. There are prefabricated Arduino-compatible soil humidity sensors but we’re going to try something simpler in this article. The Arduino-compatible soil humidity sensor has two metal prongs that record a resistance value, which is the sensor reading. If the moisture content of the soil is high, current flows easily and the resistance value is low. Conversely, if the soil is dry, there is less electrical flow so the resistance value is high. When you understand this setup, you can test the this principle with 2 nails rather than using a special sensor.

*If you’re going to use this setup for a long period of time, iron nails will rust and the resistance value will change. In such case, it’s better to use the Arduino-compatible soil humidity sensor or rust proof nails.

An Arduino Plant Monitoring Watering Device

Figure 9: A DIY soil sensor made of 2 nails

Connect 2 nails to the conductive wires. These can be on the same circuit as the light sensor.

An Arduino Plant Monitoring Watering Device

Figure 10: Wiring diagram of temperature, light, and soil sensors

An Arduino Plant Monitoring Watering Device

Figure 11: Nails placed in soil

First, connect to Analog Pin 2 and read the soil sensor’s value with Analog Input. Next, fill the pot halfway with water. You can see that the value that was at 900-1000 lowers to around 600.

An Arduino Plant Monitoring Watering Device

Figure 12: Soil sensor readings

Since the resistance value drops as you add water, you can use these readings to determine the maximum resistance value. Again, high resistance value means the soil is dry. You can test and see what values you get by adding water.

Implementing the watering system

There are various ways to water your plants but I’ve used one that is simple and cost-effective. We can design a system that uses a simple pump nozzle from a bottle with a servo attached. It will be designed so that the servo will pump out the water by pressing the nozzle (Figure 14).

If you have a large plant that requires a lot of water, you can use a battery-powered oil pump. Depending on the size of your plant, there are all sorts of options you can try.

An Arduino Plant Monitoring Watering Device

A $1 bottle with pump spray nozzle

Servo-driven watering system

Figure 14: Servo-driven watering system

I bought 3 types of shampoo bottles to try. Since the servo I’m using isn’t very powerful, the servo failed to press down on two of the shampoo bottle nozzles. If your servo is weak, you can try to supply power from a separate battery and see if that works.

After much travail, I finally managed to put my watering system together (Figure 15).

Completed plant monitoring device

Figure 15: Completed plant monitoring device

Plant monitoring device circuit

Figure 16: Plant monitoring device circuit

Lastly, we need to write a program so we can save the soil sensor readings and water the plant whenever necessary. I set up a rule to pump 5 times whenever the resistance of the soil sensor is or above 700.

If you have any comments or questions, please leave them for us at Google +. Follow us there; we will be posting more soon.





Get IoT Essential Guide &  Enter to Win a Free Sensor Kit!