Introduction: Arduino Project: Automatically Give Your Plants Water With Your Arduino

With this project you can set up your arduino to water your plant automatically based on its weight.

With the help of an OLED, three buttons and a menu we'll program you can set the minimum weight of the plant, how much gram water you want it to water the plant and you can see the current weight of the plant. There is also the option to give the plant water immediately if neccesary. If the Arduino loses power, the values you chose as minimum weight for the plant and the amount of water will be stored in EEPROM values, so you don't have to set up the arduino again.

A small water pump energized by four AA batteries and controlled by the Arduino with a relay will water the plant whenever it needs, from a water reservoir of your choosing (for example, a bucket). A small 5KG scale with a signal amplifier (the HX711) will weigh the plant every hour.

The water reservoir was left out of the design because some plants like Colocasia's need a lot of water, and a build-in water reservoir would never be enough for them. You'd still need to refill the water reservoir every three days. The aim of this project was to not have to water your plant for at least three weeks, so a big water reservoir is a must for some plants. You simply put the water pump in the water reservoir and that's it; let your specialized Arduino plant pot do all the work ;)

The program measures the weight of the plant every hour and 'remembers' the last three hours of weight in an array. If the last three hours are below the minimum weight value, the Arduino will water the plant until it weights the minimum weight value plus the amount of water in gram you wanted to add to it.

This program uses the metric system.

Supplies

  • Male to male cables
  • Arduino Uno
  • Arduino Uno cable for PC
  • 3 buttons
  • 1 relais (capable of 5V)
  • 0.96 inch OLED Display 128*32 pixels - I2C

  • Loading cell capable of max 5kg

  • HX711 chip to read the loading cell

  • 4x AA batteries of 1.2 volt

  • 4X AA battery holder with loose wires

  • Small waterpump, 3-6 volt

  • 3 resistances

Step 1: Download All the Libraries You Need

First we're going to set up the libraries we need for this project. In your toolbar on the top, see Tools -> Manage Libraries. Install this library:

HX711_ADC

The library for the OLED screen is installed separately. You can download the library here:

https://github.com/greiman/SSD1306Ascii

After downloading, import the library by opening your Arduino sketch, go to Sketch -> Include library > Add .zip library.

I used the Adafruit library for the OLED screen first, but that one is too big for this project. We can't add the HX711 library then because it costs too much SRAM, thus the Arduino can't run it. So I looked around and found a library that only refreshed the screen whenever something actually changed on the screen.

Step 2: Soldering According to the Fritzing Layout

In the image I provided a Fritzing scheme of how to wire all the parts together.

On your arduino:

pin 2 leads to the button for moving up the menu

pin 3 leads to the button 'click'

pin 4 leads to the data line (DT) for the HX711 module

pin 5 leads to the clock line (SCK) for the HX711 module

pin 6 leads to the button for moving down the menu

pin 7 leads to the relais for controlling the waterpump

pin A5 leads to the clock line (SCK) of your OLED

pin A4 leads to the data line (VDD) of your OLED

the 5V energizes your buttons, the OLED and the HX711 module

the ground grounds your buttons, the OLED and the HX711 module

The waterpump has it's own batteries in order to function. This is because powering the waterpump with your arduino would cause it to burn through, because it pulls too much energy. The Arduino pin 7 controls your water pump with the relay; put it on HIGH and it pumps water, put it on LOW and it stops.

You can connect the ground of the batteries and the waterpump together.

Step 3: Download the Code

Download the code I wrote for this project and run it!

Step 4: Finish Your Project

You've got it all soldered and working now. Make a case for the electronics, so they don't get covered with dust and can go on for a long time.

When you look at the photo's, you see my version of the outside plant pot.

I tried 3D printing a plantcase first, but quickly found out that what I wanted was too ambitious (too big) for a 3D printer. I then looked at editing an existing plastic plant pot but didn't know how to make that work. My last idea was having a base of chicken wire and using extra strong clay to cover that up and make the pot. Unfortunately, it all looks very DIY because I'm not very good at building things. I don't have any sort of insight in building something so I end up floundering a lot like I did with this project. If I were to re-do this, I would make the base from wood.