Introduction: Intel Automated Gardening System

About: The Green Energy Harvester, loves to make things related to Arduino, Solar Energy, and Crafts from used stuff.

[ Play Video ]

Hello Everyone !!!

This is my first Instructabe on Intel Edison. This instructable is a guide for making an automated watering (Drip Irrigation) system for small potted plants or herbs by using an Intel Edison and other cheap electronic sensors. This is perfect to grow an indoor herb plants.But this idea can be implemented for a larger system.

I am belong to a village and we have our own firm.During staying at my village we were getting plenty of fresh vegetables/herb leaves from our firm(see above images).But now the situation is different,as I am staying in a city no more fresh vegetables/herb leaves.I have to buy these from the store which are not at all fresh.Apart from these they are grown by using harmful pesticides which is not good for health.So I am planning to firming herbs at my balcony which is completely fresh and harmless.But firming is a time consuming process. I always forget to give water in my flower plants. This leads to give the idea of automated gardening system.

The system is designed to sense soil moisture, amount of light falling on the plants and water flow rate . When the moisture content in the soil is too low, the system will give command to start a pump and water the soil.The flow meter monitor the water consumption.

Apart from this the Intel Edison will transmit information on moisture level,ambient light and flow rate to the web .You can monitor all the data from your smart phone by using Blynk apps.Then a twit can be send to your account automatically if the moisture falls below a given threshold value.

Care for the environment has become very important in recent years and there is an increasing demand for "green" applications that can help reduce CO2 emissions or make a more efficient management of energy consumed.To make the project more reliable and eco friendly, I used solar power to power the whole system.

Step 1: Parts Required

1. Intel Edison Board (Amazon)

2.Moisture Sensor ( Amazon )

3. Flow Sensor ( Amazon )

4.DC pump ( Amazon )

5.Photocell /LDR ( Amazon )

6. MOSFET (IRF540 or IRL540 ) ( Amazon )

7. Transistor ( 2N3904) ( Amazon )

8. Diode (1N4001 ) ( Amazon )

9. Resistors ( 10K x2 ,1K x1, 330R x1)

10. Capacitor -10uF ( Amazon )

11. Green LED

12. Double side Prototype Board ( 5cm x 7cm) ( Amazon )

13. JST M/F connectors with wires ( 2 pin x 3, 3pin x1) ( eBay )

14. DC Jack- Male ( Amazon )

15. Header Pins ( Amazon )

16.Solar Panel 10W ( Voc = 20V-25V) ( Amazon )

17. Solar Charge Controller ( Amazon )

18. Sealed Lead Acid Battery ( Amazon )

Tools Required :

1. Soldering Iron ( Amazon )

2. Wire Cutter /Stripper ( Amazon )

3.Hot Glue Gun ( Amazon )

4.Drill ( Amazon )

Step 2: How the System Works

The heart of the project is Intel Edison board.It is hooked up to the various sensors (like soil moisture,light,temperature,water flow etc) and a Water Pump.The sensors monitor the different parameters like Soil Moisture, Sun Light and Water flow/ Consumption then fed to Intel Board. Then the Intel board process the data coming from the sensors and give command to the Water Pump for watering the plant.

The various parameters are then send to web through the the Intel Edison inbuilt WiFi.Then it is interfaced with Blynk apps for monitoring the plant from your Smartphone/Tablets.

For easy understanding I divided the projects in to smaller sections as below

1. Getting Started With Edison

2. Power Supply for the Project

3. Connecting and testing the Sensors

4. Making Circuit / Shield

5. Interfacing with Blynk App

6.Software

7. Preparing the Enclosure

8.Final Testing

Step 3: Setting of Intel Edison

I buy this Intel Edison and Arduino Expansion Board from Amazon. I am very unlucky as did not get it from Instructable Campaign. I am familiar with Arduino, but I found getting up and running with the Intel Edison to be a bit difficult. Anyway after few days of try, I found its quite easy to use.I will guide you,by the following few steps to get started quickly.So don't scare :)

Just follow the following instructables which well cover how to get started with Edison

If you are absolute beginner then follow the following Instructable

An Absolute Beginners Guide To The Intel Edison

If you are Mac user then follow the following Instructable

REAL beginner's guide to setting up the Intel Edison (with Mac OS)

Apart from these Sparkfun and Intel have a great tutorials to getting started with Edison.

1. Sparkfun Tutorial

2. Intel Tutorial

Download the all the required software from the Intel website

https://software.intel.com/en-us/iot/hardware/edison/downloads

After downloading the software, you have to installed the drivers,IDE and OS

Drivers :

1. FTDI Driver

2. Edison Driver

IDE :

Arduino IDE

Flashing the OS :

Edison with Yocto Linux Image

After installing all ,you have to set up for WiFi connection

Step 4: Power Supply

We need power for this project for two purpose

1. To power the Intel Edison (7-12V DC) and different sensors( 5V DC)

2. To run the DC pump (9V DC)

I choose a 12V sealed lead acid battery for power the entire project.Because I got it from a old computer UPS.Then I thought to use Solar Power to charge the battery.So now my project is completely reliable and eco friendly.

See the above images for preparing the Power Supply.

The Solar Charging System is consists of two main components

1. Solar Panel : It convert sun light to electrical energy

2.Solar Charge Controller : To charge the battery in a optimum way and control the load

I have written 3 instructables on making a Solar Charge Controller.So you can follow it to make your own.

ARDUINO-SOLAR-CHARGE-CONTROLLER

If you don't want to make, then just buy it from eBay or Amazon.

Connection :

Most of the charge controller have commonly 3 terminals : Solar,Battery and load.

Connect the Charge Controller to the Battery first, because this allows the Charge Controller to get calibrated to appropriate system voltage. Connect the negative terminal first and then positive. Connect the solar panel(negative first and then positive) At last connect to the DC load terminal.In our case the load is Intel Edison and DC pump.

But Intel Board and pump needs a stable voltage.So a DC-DC buck converter is connected at DC load terminal of the Charge controller.

Step 5: Moisture Sensor

The moisture sensors working is based on the resistivity of water to determine the moisture level of the soil. The sensors measure the resistance between two separate two probes by sending a current through one of them and reading a corresponding voltage drop due to a known resistor value.

The more water the lower the resistance, and using this we can determine threshold values for moisture content.When the soil is dry, the resistance will be high and the LM-393 will show a high value on the output.When the soil is wet, it will show a low value in the output.

LM-393 DRIVER (moisture sensor) -> Intel Edison

GND -> GND

5 V -> 5

VOUT -> A0

Test Code :

int moist_sensor_Pin = A0;    // Sensor is connected to analog pin A0

int moist_sensor_Value = 0;  // variable to store the value coming from the sensor
 
void setup() {
   Serial.begin(9600);  
}
 
void loop() {
  // read the value from the sensor:
  moist_sensor_Value = analogRead(moist_sensor_Pin);    
  delay(1000);          
  Serial.print("Moisture sensor Reading = " );                       
  Serial.println(moist_sensor_Value);                   
}


Step 6: Light Sensor

To monitor the amount of sun light falling on the plant we need a light sensor.You can buy a ready made sensor for it.But I prefer to make my own by using a photocell/LDR.It is very low cost, easy to get in many sizes and specifications.

How it Works ?

A Photocell is basically a resistor that changes its resistive value (in ohms) depending on how much light is shining onto the squiggly face.Higher the amount of light falling on it,lower the resistance and vice versa.

To know more on the Photocell, click here

Bread Board Circuit :

The light sensor can be made by making a voltage divider circuit with upper resistance (R1) as Photocell/LDR and a and lower resistance (R2) as a 10K resistor.See the circuit shown above.

To know more on it , you can see the adafruit tutorial.

Connection :

LDR one pin ---> 5V

Junction -----> A1

10K Rresistor one pin ---> GND

Optional noise filter circuit : Connect a 0.1uF capacitor across the 10K resistor to filter out the unwanted noise.

Test Code:

Result :

The serial monitor reading shows that the sensor value is higher for bright sun light and lower during the shadow.

int LDR = A1;     // LDR is connected to analog pin A1

int LDRValue = 0;      //that’s a variable to store LDR values
void setup()
  {
    Serial.begin(9600);          //start the serial monitor with 9600 buad
  }
 
void loop()
  {
    LDRValue = analogRead(LDR);      //reads the ldr’s value through LDR 
     Serial.print("Light Sensor Value: ");
     Serial.println(LDRValue);       //prints the LDR values to serial monitor
     delay(50);        //This is the speed by which LDR sends value to arduino
  }

Step 7: Make the Light Sensor

If you have a Seeedstudio groove light sensor then you can skip this step.But I do not have groove sensor, so I made my own.If you will make no doubt you will learn more and feels great pleasure after completion.

Take two pieces of wires with desired length and stripped out the insulation at the ends.Connect a two pin JST connector at the end.You can buy connector with wires also.

The photocell have long legs which still needs to have its clipped down to short stubs to match the lead wires.

Cut two short pieces of heat-shrink to insulate each leg.Insert the heat shrink tube to the wires.

Then the photocell is soldered onto the end of the lead wires.

Now the sensor is ready.So you can just easily strap this to the desired location.The 10K resistor and 0.1uF capacitor will be solder on the main circuit board which I will explain later.

Step 8: Flow Sensor

The flow sensor is used to measure liquid flowing through a pipe / container.You may think why we need this sensor. There two main reasons

1.To measure the amount of water used to water the plants , to prevent wastage

2. To switch off the pump to avoid dry run.

How the Sensor Works ?

It works on the principle of “Hall Effect”.A voltage difference is induced in a conductor perpendicular to the electric current and the magnetic field perpendicular to it. A small fan/propeller rotor is placed in the path of the liquid flowing, when the liquid flows the rotor rotates. The shaft of the rotor is connected to a hall effect sensor. It is an arrangement of a current flowing coil and a magnet connected to the shaft of the rotor. Thus a voltage/pulse is induced as this rotor rotates. In this flow meter, for every litre of liquid passing through it per minute it outputs about few pulses.The flow rate in L/hr can be calculated by counting the pulses from the output of the sensor.The Intel Edison will do the counting job.

The Flow Sensors comes with three wires:

1. Red/VCC (5-24V DC Input)

2.Black/GND (0V)

3. Yellow/OUT (Pulse Output)

Preparing the Pump Connector : The pump comes with JST connector and wires.But the female connector in my stock did not match with it and the wire length is also small.So I cut the original connector and solder a new connector with suitable size.

Connection :

Sensor ------> Intel

Vcc ----> 5V

GND----> GND

OUT ----> D2

Test Code :

The pulse out pin of the flow sensor is connected to digital pin 2. The pin-2 serves as an external interrupt pin.

This is used to read the output pulses coming from the water flow sensor. When the Intel board detects the pulse, it immediately triggers a function.

To know more on Interrupt you can see the Arduino Reference page.

The test code is taken form SeeedStudio. For more details you can see here

Note : For flow calculation you have to changei the equation as per your pump data sheet.

// reading liquid flow rate using Seeeduino and Water Flow Sensor from Seeedstudio.com
// Code adapted by Charles Gantt from PC Fan RPM code written by Crenn @thebestcasescenario.com // http:/themakersworkbench.com http://thebestcasescenario.com http://seeedstudio.com volatile int NbTopsFan; //measuring the rising edges of the signal int Calc; int hallsensor = 2; //The pin location of the sensor void rpm () //This is the function that the interupt calls { NbTopsFan++; //This function measures the rising and falling edge of the hall effect sensors signal } // The setup() method runs once, when the sketch starts void setup() // { pinMode(hallsensor, INPUT); //initializes digital pin 2 as an input Serial.begin(9600); //This is the setup function where the serial port is initialised, attachInterrupt(0, rpm, RISING); //and the interrupt is attached } // the loop() method runs over and over again, // as long as the Arduino has power void loop () { NbTopsFan = 0; //Set NbTops to 0 ready for calculations sei(); //Enables interrupts delay (1000); //Wait 1 second cli(); //Disable interrupts Calc = (NbTopsFan * 60 / 73); //(Pulse frequency x 60) / 73Q, = flow rate in L/hour Serial.print (Calc, DEC); //Prints the number calculated above Serial.print (" L/hour\r\n"); //Prints "L/hour" and returns a new line }

Step 9: DC Pump

The pump is basically a geared down DC motor, so it has a lot of torque. Inside the pump is a ‘clover’ pattern of rollers. As the motor turns, the clover presses on the tube to press the fluid though. The pump does not need to be primed and in fact can self-prime itself with water a half meter with ease.

The pump is not a submersible type.So it never touches the fluid and makes this an excellent choice for small gardening.

Driver Circuit :

We can't power the pump directly from the Edision pins as the Edison pins can only supply a small amount of current. So to drive the pump we need a separate driver circuit.The driver can be make by using a n Channel MOSFET.

You can see the driver circuit shown in above picture.

The pump have two terminals.The terminal marked with a red dot is positive.See the image.

The Dc pump is recommend to run at 3V to 9V . But our power source is 12V battery.To achieve the desired voltage we need to step down the voltage.This is done by a DC Buck Converter.The out put is set to 9V by adjusting the on board potentiometer.

Note : If you are using IRL540 MOSFET then no need to make the driver circuit as it is logic level.

Preparing the Pump Connector:

Take two pin JST connector with wire.Then solder the red wire to the polarity with dot mark and black wire to the other terminal.

Note: Please do not test long time with no-load, inside is with plastic leaves, can't suction impurity.

Step 10: Prepare the Sield

As I did not have groove shield for sensors connection.To make the connection easier, I made my own.

I used a double sided prototype board ( 5 cm x 7 cm) for making it.

Cut 3 strips of straight male header pin as shown in picture.

Insert the header to the Intel female headers.

Place the prototype board just above it and mark the position by a marker.

Then solder all the headers.

Step 11: Make the Cicrcuit

The shield is consists of :

1. Power Supply Connector ( 2 pin )

2. Pump Connector (2 pin ) and its driver circuit ( IRF540 MOSFET ,2N3904 Transistor,10K and 1K Resistors and 1N4001 anti parallel diode)

3. Sensor Connectors :

  • Moisture sensor - The connector for moisture sensor is made with 3 pin straight male headers.
  • Light Sensor - The light sensor connector is a 2 pin JST female connector, the associated circuit (10K resistor and 0.1uF Capacitor) is made on the shield
  • Flow Sensor : The flow sensor connector is a 3 pin JST female connector.

4. Pump LED : A green LED is used for knowing the pump status. ( Green LED and 330R resistor )

Solder all the connectors and other components as per the schematic shown above.

Step 12: Install Blynk App and Library

As the Intel Edision have inbuilt WiFi, I thought to connect it with my router and monitor the plants from my Smartphone.But making a suitable apps need some sorts of coding. I searched for simple option so that any one with little experience can make it.The best option I found is using the Blynk App.

Blynk is an app that allows full control over Arduino, Rasberry, Intel Edision and many more hardware.It is compatible for both Android and IPhone.Right now the Blynk app is available with free of cost.

You can download the app from the following link

1. For Android

2. For Iphone

After downloading the app, installed it on your smartphone.

Then you have to import the library on to your Arduino IDE.

Download the Library

When you run the app for the first time, you need to sign in – so enter an email address and password.

Click the “+” at the top-right of the display to create a new project.Then name it.I named it " Automated Garden ".

Select the target hardware Intel Edision

Then click “E-mail” to send that auth token to yourself – you will need it in the code

Step 13: Making the Dashboard

The Dashboard is consists of different widgets.To add widgets follow the steps below :

Click “Create” to enter the main Dashboard screen.

Next, press “+” again to get the “Widget Box”

Then drag 2 Graphs.

Click on the graphs,it will pop up a settings menu as shown above.

You have to change the name "Moisture",Select the Virtual Pin V1, then change the range from 0 -100.

Change the slider position for different graph patterns.Like Bar or Line.

You can change the colour also by clicking the circle icon on the right side of the Name.

Then add two Gauges, 1 Value Display and Twiter.

Follow the same procedure for setting.You can refer images shown above.

Step 14: Programming :

In the earlier steps you have tested all the sensors code.Now it is time to combined them together.

You can download the code from the link below.

Open the Arduino IDE and select the board name " Intel Edison" and PORT No.

Upload the code. Click the triangle icon at the top right corner on the Blynk App Now you should visualise the graphs and other parameters.

Updates on on WiFi Data Logging ( 27/10/2015 ) : Working of Blynk App tested for moisture and light sensor.I am working on Flow Sensor and Twiter .

So be in touch for updates.

Step 15: Preparing Enclosure

To make the system compact and portable, I put all the parts inside a plastic enclosure.

First a place all the components and marked for making holes ( for pipe,Cable Tie to fix the pump and Wires)

Bind the pump by help of a cable tie.

Cut a small silicon tube and connect between pump discharge and flow sensor.

Insert a long silicon tube at the holes near to the Pump Suction.

Insert another silicon tube and connect it to the flow sensor.

Install the buck converter at the one side wall of the enclosure.You may apply glue or 3M pad just like me.

Apply hot glue at the base of flow sensor.

Place the Intel board with the prepared shield.I applied 3M mounting squares for sticking to the enclosure.

Finally connect all the sensors to the corresponding headers on the shield.

Step 16: Final Testing

Open the Blynk App and press the play button ( triangle shape icon ) to run the project.After waiting for few seconds the graphs and gauges should active.It indicates that your Intel Edison connected to the router.

Moisture Sensor test :

Took a dry soil pot and insert the moisture sensor.Then pour water gradually and observe the readings on your smartphone.It should be increased.

Light Sensor :

The light sensor can be checked by showing the light sensor towards the light and away from it.The changes should be reflected on your Smartphone graph and gauges.

DC Pump :

When the moisture level falls below 40% then pump will starts and green LED will ON.You can remove the probe from the wet soil to simulate the situation.

Flow Sensor :

The flow sensor code is working on Arduino but giving some error on Intel Edison.I am working on it.

Twiter twit :

Not tested yet.I will do it as soon as possible.Stay tuned for updates.

You can also see the demo Video

If you enjoyed this article, don’t forget to pass it along!
Follow me for more DIY projects and ideas. Thank you !!!

Intel® IoT Invitational

First Prize in the
Intel® IoT Invitational

Epilog Contest VII

Participated in the
Epilog Contest VII