Introduction: Smart Irrigation System

This project is created for the Digilent Design Contest 2015. It is a smart irrigation system which controlled by a ChipKit MX3 board. The board is monitored by an android device, but can work stand alone. The system check the sensor values and if the values are outside the presetted values then start the irrigation or if the temperature is to high then start the airing.

You can monitor the whole system with an android device and you can override it with a single button. The buttons can start and stop the irrigation and airing, also give feedback about temperature, light level, moisture and its raining or not. If its raining then the automatic irrigation will disabled for a certain time.

Parts:

  • ChipKit MX3 board
  • PmodALS - Ambient Light Sensor
  • PmodTMP3 - Temperature Sensor
  • PmodWiFi - 802.11b WiFi Interface
  • GWS Servo Kit
  • H Bridge
  • Mini Water Pump
  • Rain sensor
  • 3 x Moisture sensor
  • Water tank
  • Power source
  • Silicone water pipe
  • Wires
  • Greenhouse

WARNING: This water pump need about 8A to start so choose the right H Bridge and Power supply!

Step 1: Build the Greenhouse

To build the greenhouse you only need wood fibreboard (MDF) and plastic sheet roll. The top part need to be removable. The nails are used to fix the parts.

Step 2: Using MPIDE

  1. To install the MPIDE just download the compressed directory for your OS version. (download)
  2. To use MPIDE with the Chipkit MX3 board: Tools -> Board -> ChipKit -> ChipKit MX3
  3. For further details on using MPIDE visit this link

Step 3: Programming the ChipKit MX3

I put a part of my MPIDE code below. This part is reading the sensor values in every 10 minutes and sends to the android device if its connected.

I created a library to read the sensors you can download it from attachments.

This is the function to test the library:

void readSensors()
{ Feedback = ""; char numstr[5]; //Temperature tempValue = sensor.temp( addr ); Serial.print("Temp: "); Serial.println(tempValue); Feedback = Feedback + itoa(tempValue, numstr, 10) + " "; //Light level lightValue = sensor.light(); Serial.print("Light: "); Serial.println(lightValue); Feedback = Feedback + itoa(lightValue, numstr, 10) + " "; //Moisture 1 moistureValue = sensor.moisture(A1); Serial.print("Moisture 1: "); Serial.println(moistureValue); Feedback = Feedback + itoa(moistureValue, numstr, 10) + " "; //Moisture 2 moistureValue = sensor.moisture(A2); Serial.print("Moisture 2: "); Serial.println(moistureValue); Feedback = Feedback + itoa(moistureValue, numstr, 10) + " "; //Moisture 3 moistureValue = sensor.moisture(A3); Serial.print("Moisture 3: "); Serial.println(moistureValue); Feedback = Feedback + itoa(moistureValue, numstr, 10) + " "; //Rain rainValue = sensor.rain(); Serial.print("Rain: "); Serial.println(rainValue); Feedback = Feedback + itoa(rainValue, numstr, 10) + " "; Serial.print(""); Serial.println(Feedback); tcpClient.println(Feedback); }

Step 4: Android Application

The android application was written in Android Studio for Android 4.4.2 (API17) and over.

With this application we can monitor the system and send commands to the board. The android app is a TCP client what automatically connect to the board on start.

To use the android application with your board you need to change the SERVERPORT and SERVER_IP to your server port and ip.

Code:

private static final int SERVERPORT = 44300;
private static final String SERVER_IP = "your ip";

The project is in pre evaluation form so the full source code will be uploaded just in final form.

Step 5: All Together

In this step we can see all parts together.

On the first picture we can see:

  • Power supply
  • H Bridge
  • ChipKit MX3 board
  • Water tank
  • Mini water pump

On the second picture are:

  • Light sensor
  • Temperature sensor
  • GWS servo motor
  • 3 x Moisture sensors
  • Rain sensor

Depending on which moisture sensor value is over the pre set value the servo motor moves to the right pot and start the irrigation. The wiring can be various depending on board pin setup.

Step 6: The Result

The result will be seen on a video but encountered a problem with the H Bridge because our Dual H Bridge is capable of max 2A but the water pump need at least 8A to start, so the video will be available soon!