ProtoPalette

Soil Sentry

[youtube id=”uBtkw97WAPc” align=”center” mode=”normal” autoplay=”no” aspect_ratio=”16:9″ maxwidth=”1170″]

ProtoPalette Soil Sentry kit

What’s in the tube?

  • Arduino Nano
  • 4 5mm LEDs
  • ProtoPalette Kit Base
  • Wooden LED Stalk
  • Jumper Wires
  • 9 Volt Battery Connector
  • Female-to-Male Power Cable
  • Project¬†Tube
  • Mini USB Cable
  • Moisture Sensor
  • 3D-printed mounting base

 

Understand the Arduino Code


/*
ProtoPalette.com
Soil Sentry
Soil Moisture Sensor Project

A0 - Soil Mosture Sensor

D2 - LED1a (positive, or anode side. The long wire coming out of the LED)
D3 - LED1c (Negative, or cathode side. The shorter wire coming out the LED)
D4 - LED2a (positive, or anode side. The long wire coming out of the LED)
D5 - LED2c (Negative, or cathode side. The shorter wire coming out the LED)
D6 - LED3a (positive, or anode side. The long wire coming out of the LED)
D7 - LED3c (Negative, or cathode side. The shorter wire coming out the LED)
D8 - LED4a (positive, or anode side. The long wire coming out of the LED)
D9 - LED4c (Negative, or cathode side. The shorter wire coming out the LED)

LED1a - Red
LED2a - Green
LED3a - Green
LED4a - Yellow

Connect the Soil Mosture Sensor to anolog input pin 0,
and your 4 LEDs to the digital pins as described above.
REMEMBER! You can find a video and instructions at
www.protopalette.com/soilsentry

*/
int LED1a = 2;
int LED1c = 3;
int LED2a = 4;
int LED2c = 5;
int LED3a = 6;
int LED3c = 7;
int LED4a = 8;
int LED4c = 9;
int GND13 = 13;
int mostureSensor = 0;

void setup() {
// Serial Begin so we can see the data from the mosture sensor in our serial input window.
Serial.begin(9600);
// setting the led pins to outputs
pinMode(LED1a, OUTPUT);
pinMode(LED1c, OUTPUT);
digitalWrite(LED1c,LOW); //This command sets Digital Pin to a Ground.
pinMode(LED2a, OUTPUT);
pinMode(LED2c, OUTPUT);
digitalWrite(LED2c,LOW); //This command sets Digital Pin to a Ground.
pinMode(LED3a, OUTPUT);
pinMode(LED3c, OUTPUT);
digitalWrite(LED3c,LOW); //This command sets Digital Pin to a Ground.
pinMode(LED4a, OUTPUT);
pinMode(LED4c, OUTPUT);
digitalWrite(LED3c,LOW); //This command sets Digital Pin to a Ground.
pinMode(GND13, OUTPUT);
digitalWrite(GND13, LOW);
}

// the loop routine runs over and over again for as long as the system is powered:
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(mostureSensor);
// this will print out the value your moisture sensor reads:

Serial.println(sensorValue);

if (sensorValue >= 800) //This condition is where the probe is really, really dry.
//So, we turn the red light on by sending 2.5 volts through PIN D2,
//which we've named LED1a.
{
analogWrite(LED1a, 128); //The red LED is turned On, using 2.5 volts.
analogWrite(LED2a, 0); //The first Green LED is OFF.
analogWrite(LED3a, 0); //The second Green LED is OFF.
analogWrite(LED4a, 0); //The Yellow LED is OFF.
}
else if (sensorValue >= 650 && sensorValue < 800) //you can set these values wherever you like
//we set it for the dryest plant we could find
//this side of a cactus in the desert.

{
analogWrite(LED1a, 0); //The Red LED is now OFF becuase there is some moisture detected.
analogWrite(LED2a, 128); //The first Green LED is now ON. Fairly happy plant.
analogWrite(LED3a, 0); //The second Green LED is now OFF.
analogWrite(LED4a, 0); //The Yellow LED is now OFF.
}
else if (sensorValue >= 500 && sensorValue < 650)
{
analogWrite(LED1a, 0); //The Red LED is now OFF becuase there is some moisture detected.
analogWrite(LED2a, 128); //The first Green LED is now ON.
analogWrite(LED3a, 128); //The second Green LED is now ON. A Well Watered Plant.
analogWrite(LED4a, 0); //The Yellow LED is now OFF.
}
else if (sensorValue >= 0 && sensorValue < 500)
{
analogWrite(LED1a, 0); //The Red LED is now OFF because there is some moisture detected.
analogWrite(LED2a, 128); //The first Green LED is now ON.
analogWrite(LED3a, 128); //The second Green LED is now ON.
analogWrite(LED4a, 128); //The Yellow LED is now ON. This might be an overwatered plant.
}

delay(250); // delay 1/4th of a second between reads
}

 

Assemble the Electronic Components

Soil sentry assembly instructions

Assemble the Kit

soil sentry

soil sentry assembly

2 Responses on Soil Sentry"

  1. Profile photo of Ben Pawsey Ben Pawsey says:

    If you’re stuck or have any questions about the Soil Sentry kit leave a message here and we’ll troubleshoot together!

  2. Vandana Deep says:

    Can I find some details on the values I read from the moisture sensor and what do the values imply?

Leave a Message

Your email address will not be published. Required fields are marked *


ProtoPalette Newsletter

Keep up to date with new projects, events and more!

Quotes in the Media

This board is to Makers, as a palette is to artists. @protopalette makes building @Arduino projects easier. #MFBA15

Atmel logo

@Atmel

top
Copyright © ProtoPalette EdTech, Inc. All Rights Reserved
Skip to toolbar