There are quite a few plant watering projects out there, but I needed the following improvements:
- As you add more plants, easily extend the current setup with little hardware additions and not be limited by number of pins on the Uno
You generally need 3 pins per plant. Analog pin to read in the soil moisture sensor data, digital pin to turn-on/off water pump and one more digital pin to control a LED that indicates the current soil moisture level. As you can see, you will run out of pins once you reach 5 to 6 plants (my goal was to have this setup for at-least 8 plants).
To control the water pump and the LED per plant, I decided to use a shift register (75HC595). It's very easy to extend this setup by adding more shift registers. For details on how to hook it up, I followed this tutorial. This way irrespective of number of plants I add, I just need 3 pins to control the shift register - CLK, serial data and latch.
Since there is no need for the Uno to read the soil moisture sensor continuously, I decide to MUX in moisture data from all the plants to just pin A0 using a 16:1 MUX (74HC4067). This way with just 5 pins, I can read moisture data from up-to 16 plants. For details on how to hook this up, I followed this tutorial.
This way, you can easily add more plants and automatically water them without having to worry about the number of pins on the Uno.
- Set unique care parameters for each plant. e.g. some plants need the soil to be on the dry side, while others require it to be damp
If you look at the config file for this project uploaded to the git repository, you will notice that each plant has the following parameters:
<PLANT NAME>_MOIST_LEVEL_LWM - Once the soil moisture level hits this level, plant watering begins
<PLANT NAME>_MOIST_LEVEL_HWM - Once the plant watering has started, it will continue till the moisture level goes above this mark
<PLANT NAME>_PUMP_ON_DURATION_MS - Duration for which the water pump will be on
<PLANT NAME>_SOIL_SOAK_DURATION_MS - Once the plant has been watered, wait for some time before taking another measurement of the soil moisture level and deciding to water the plant again or not.
This way you can take better care of each plant, based on their individual need to maintain different levels of soil moisture level.
- Log watering data per plant in the EEPROM
Dedicate a chunk of EEPROM per plant to store soil moisture level and number of times the plant was watered over a fixed period of time. In my case, the period was set to 12 hours. You can easily change it by updating this parameter in the config file.
#define LOG_DATA_FREQUENCY 43200000 //every 12hr in ms
- Whenever the water level goes low in the reservoir, have a RED LED flash to indicate things ain't looking good
Using a water level sensor to measure the water level in the reservoir and flash a RED LED whenever it falls below the following threshold in the config file
#define WATER_LEVEL_LWM 55
If you need more information on how to make SW changes and HW additions, please look at doc. I tried to cover most common cases. If there are any additional questions or changes needed, please comment below. Happy to help!
Edits:
Something I learnt in the last couple of days. Powering the Relay coils from the Arduino 5V pin causes a lot of bad things to happen. Power gets taken away from the board and you start reading bad sensor data.
Solution - Remove the JD-VCC & VCC jumper on the relay board. Connect the JD-VCC to a 5V power supply. This ensures the Arduino and the Relay module both draw current in parallel. Thus, current does not get taken away from the arduino and sensors.
Comments