Bow – wow water!

Components:

  • 1x 10KΩ resistor
  • 2 nails
  • 1 DC motor
  • 2x AA batteries
  • Battery holder
  • Wire
  • Jumper wires
  • USB cable
  • Computer
  • Arduino Uno
  • Breadboard
  • Cardboard, pieces of wood, hot glue gun, cork

Description

For this week’s project I made a dog that will let me know when my plants need water.

When the soil is dry, Pantufla (the dog), will alert me by moving her tail, and moving. Once the soil gets wet, she will stop moving. To detect the level of the moisture I made a very low fidelity sensor using two nails.

Code

int sensorPin = A0;   // select the input pin for the potentiometer
int motorPin = 9; // select the pin for the Motor
int val = 0;      // variable to store the value coming from the sensor
int sensibility=600;

void setup() {
Serial.begin(9600);
pinMode(motorPin, OUTPUT);   // sets the pin as output
Serial.println(“Welcome to the Bow wow water project”);
}

void loop() {
val = analogRead(sensorPin);    // read the value from the sensor, between 0 – 1024
Serial.println(val);
if (val <= sensibility){
analogWrite(motorPin, 0); // analogWrite can be between 0-255
}
else
{
analogWrite(motorPin, val/4); // analogWrite can be between 0-255
}
}

20161011_193140

Leave a Reply