loading

This project came about after I came back from a 3 weeks holiday and my little lemon seedlings had met their demise due to dehydration. So i had a look around and thought this could be easily solved. Turned out, its a lot harder then i thought, here is how i did it. Big thanks to all of helpful people here and on youTube (ref below). This Project is an Self Sustained Automatic Watering System, using the awesome Atmega328 (in a bareduino configuration) to control the hydration levels of a plant, using the power from 4 AA rechargeable batteries, a Mini Solar Cell (to charge the batteries) and a water reservoir.

Step 1: BOM

What is used to get this up and running. You will need to know how to program the Atmega328 , i used a FTDI serial board. You can do this is many different ways using different items. There are definitely room for improvement, but here is what i used.

B.O.M:
1 * Ultra-quiet Mini DC 3-6V 120L/H Brushless Motor Submersible Water Pump New (http://www.ebay.co.uk/itm/Ultra-quiet-Mini-DC-3-6V-120L-H-Brushless-Motor-Submersible-Water-Pump-New-/281890867872?hash=item41a2014aa0:g:fnUAAOSw3xJVeP2X)

2 * galvanised nails 1 * Display 84*48 LCD Module Blue Backlight Adapter PCB for Nokia 5110 (http://www.ebay.co.uk/itm/New-84-48-LCD-Module-Blue-Backlight-Adapter-PCB-for-Nokia-5110-TR-/282158241304?var=&hash=item41b1f11618:m:mrQ6BVPJ3pDttJnDIi4zVzg)

1 M 1/4" (6mm ID) PVC TUBE CLEAR - FOOD GRADE - FISH/ POND/ CAR/ AQUARIUMS/ AIR (http://www.ebay.co.uk/itm/151389654765?_trksid=p2057872.m2749.l2649&var=450569741641&ssPageName=STRK%3AMEBIDX%3AIT)

1 * T junction 3 way connector (6mm)(http://www.ebay.co.uk/itm/390940260524?_trksid=p2055119.m1438.l2649&var=660302617122&ssPageName=STRK%3AMEBIDX%3AIT)

1 * Atmege328p (http://www.ebay.co.uk/itm/181954046884?_trksid=p2055119.m1438.l2649&ssPageName=STRK%3AMEBIDX%3AIT )

1 * Breadboard (http://www.ebay.co.uk/itm/Solderless-Prototype-PCB-Breadboard-with-65pcs-Jumper-Leads-Wires-/261998632121?var=&hash=item3d0055dcb9:m:m6coIpghzIqLDZoIj6y0n8g)

Cables

4 AA Rechargeable Batteries (http://www.ebay.co.uk/itm/390067662769?_trksid=p2057872.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT)

1 * Solar panel 6v (not needed if you don’t want to keep the batteries charged) (http://www.ebay.co.uk/itm/Mini-6V-1W-Solar-Power-Panel-Module-DIY-For-Battery-Cell-Phone-Chargers-/262577011791?hash=item3d22cf3c4f:g:iTgAAOSwV0RXr-3H)

1* Diode (not needed if your not using the solar panel)

1 * Old Coke Bottle (Old Milk jug) or whatever to hold water.

1 * 10k resistors

2 * Push buttons (not necessary)

Step 2: How Does It Work

So at set intervals the Arduino micro controller will check the soil moisture level at a preset interval (in the code it’s set to every 2 seconds but i suggest to change that to twice a day or something).

If the moisture level goes below the set value (in my case it’s 350) then the water pump will turn on and start water the plant in 5, 4 second intervals. If the watering process have been run 5 times it will not turn on again until the moisture levels have been reset, in case there is a malfunction or there is no water in the water reservoir (so we don’t wast energy, deplete the batteries, burn out the motor or flood our room). During normal operations my project draws 0.2 MaH running the Nokia 5110 display all the time, this is because most of it’s time the chip is sleeping and only wakes up for a very short while taking measurements then back to sleep.

Hook it all up as per above diagram, edit the code to suit your needs and upload it to your Arduino, and set it of

Step 3: Put It Togheter

This is my first instructable, and i wanted to contribute as i have learnt a lot from people here and from people on YouTube, some shout outs below to some great tutorials.

The brains of the operations is an Atmega328 chip, configured as a bareduino (on a breadboard, without external clock) to save on power consumption. There are many good tutorials on how to do burn the boot loader and upload code to the chip on a bread board on here and on youtube, so at this time i won’t go into that.

The chip is run of 4 rechargeable AA batteries, that is charged by a mini solar panel in order to be self sustained.

The chip is connected to the 2 Nails inserted into plant pot and the soil (you could use a properly made soils sensor), which will read the soil moisture level and if it is below the set level the watering of the plan till commence.

The chip controls the water pump with it is just able to run of the pin power when connected to 4 AA batteries, and the water pump is submerged into water reservoir of your choice (mine is an old milk container), which will pump water to the plant through the PVC tubing.

The hose is connected from the water pump to the plant with a t connector in a ring with holes in it so that the watering is more uniform in the plant. It is worth noting that the water reservoir has to be on a similar level to the plant pot as the pump is not able to do wonders with the pine power, but this could be improved with a relay so that the pump can be used to it’s full effect and the difference between the water and plant could be greater.

I also wanted to be able to see what was going on, so i added a Nokia5110 LCD display too for monitoring, feedback and output.

Here is how to make a Bare minimal Arduino setup like the one i used for this project: (https://www.instructables.com/id/BareDuino-How-to-P...)

Step 4: Code

#include "LowPower.h"
#include LCD5110 myGLCD(8,9,10,12,11); extern uint8_t SmallFont[]; extern uint8_t MediumNumbers[];
int sensor = A0;
int LightSensor = A5;
int Soilval;
int num;
int LightVal;
int WaterAttempts;
int SetButton;
int MoistLevel = 351;     // Value defined for how dry the soil can get before watering starts
//---------------- Setup ------------------------------
void setup() {
  myGLCD.InitLCD();
  pinMode(7, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(5, OUTPUT);
}
//================ Main Loop =====================================
void loop() {
 num++;                               // counts the number of times the program have run through the main loop and stores the number in the variable
 if (num <= 3){Blink();}              // LED (pin 13) Blinks the first 3 times the program runns through the loop, to indicate first startup
 //InitSetup();
 ReadSoil();  
 //ReadLight();
 LcdDisplay();
 if (Soilval < MoistLevel){Water();}  // if the soil is dryer than the moistlevel (350) then start the watering function
 for (int i=0; i <= 1440; i++){       // Sleep for 4 hrs
    LowPower.powerDown(SLEEP_2S, ADC_OFF, BOD_OFF); 
    LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF); 
 } 
}// =============== Main Loop ==================================
///////////////////////////////////////////////////////
////////////////////// Functions //////////////////////
///////////////////////////////////////////////////////
void InitSetup(){}
///////////////////////////////////////////////////////
void ReadLight(){
  digitalWrite(5, HIGH);
  LowPower.powerDown(SLEEP_120MS, ADC_OFF, BOD_OFF); 
  LightVal = analogRead(LightSensor);
  digitalWrite(5, LOW);
}
///////////////////////////////////////////////////////
void ReadSoil(){
  digitalWrite(7, HIGH);
  LowPower.powerDown(SLEEP_120MS, ADC_OFF, BOD_OFF); 
  Soilval = analogRead(sensor);
  digitalWrite(7, LOW);
}
///////////////////////////////////////////////////////
void LcdDisplay(){
  //myGLCD.disableSleep();
  myGLCD.setFont(SmallFont);
  myGLCD.setContrast(64);
  myGLCD.clrScr();
  
  myGLCD.print("Soil Val = ", LEFT, 0);
  myGLCD.printNumI(Soilval, RIGHT, 0);
//  myGLCD.print("Light Val= ", LEFT, 10);
//  myGLCD.printNumI(LightVal, RIGHT, 10);
  myGLCD.print("Water Att= ", LEFT, 20);
  myGLCD.printNumI(WaterAttempts, RIGHT, 20);
  myGLCD.print("Set Level= ", LEFT, 30);
  myGLCD.printNumI(MoistLevel, RIGHT, 30);
  myGLCD.print("Loops = ", LEFT, 40);
  myGLCD.printNumI(num, RIGHT, 40);
  myGLCD.update();
//  myGLCD.enableSleep();
}
///////////////////////////////////////////////////////
void Water(){
  if (WaterAttempts >= 5){}
  else{
    while(Soilval < MoistLevel){
      if (WaterAttempts >= 5){break;}   // Checks that the watering is not overdone
      digitalWrite(6, HIGH);            // power to the pump, turnes it on
      LowPower.powerDown(SLEEP_4S, ADC_OFF, BOD_OFF);
      digitalWrite(6, LOW);             // turns the pump off
      WaterAttempts++;
      ReadSoil();
      if (Soilval > MoistLevel){WaterAttempts = 0;}    
     }
  }
}
///////////////////////////////////////////////////////
void Blink(){
  digitalWrite(13, HIGH);   
  LowPower.powerDown(SLEEP_60MS, ADC_OFF, BOD_OFF); 
  digitalWrite(13, LOW);   
  LowPower.powerDown(SLEEP_120MS, ADC_OFF, BOD_OFF);
  digitalWrite(13, HIGH);   
  LowPower.powerDown(SLEEP_60MS, ADC_OFF, BOD_OFF);
  digitalWrite(13, LOW);  
}

Step 5: Thanks to . . .


Nick at educ8s.tv :https://www.youtube.com/user/educ8s

Julian at: https://www.youtube.com/user/julius256

Ronnie Tucker at: https://www.youtube.com/channel/UCh2T8YmAfkQfHlcgcGdmrpg

<p>Thanks for sharing :)</p>
<p>Cheers ! :)</p>

About This Instructable

2,343views

67favorites

License:

More by Skorekaj: Instant InfraredRed Solar Charged Thermometer All the colours of the RainboW but no RBG LED in sight . . . How to Burn the Arduino BootLoader on to a AtMega328p Chip 
Add instructable to: