Concept
Don´t Drown The Plants is a project developed in the Programming and Physical Computing Seminar. The project is aimed to help certain residential self-sufficient buildings that allow water the plants via rain water collected on the roofs of buildings. If the green light turns on this indicates that the ultrasonic sensor is detecting movement of water down the drain. If the red light then appears then the soil moisture sensor detects that there is a lot of water. This alert notifies the residents about this while they can be sitting in the comfort of their house. Therefor the residents manage their plant species so that they don´t drown.
Further Development
In my project I used a servo motor (powered by a push button) rotation to take place of rain water falling from a drainage pipe to activate the ultrasonic sensor. In possible further development of this project, it could be programmed that once one pot has enough water, a motor might redirect the water to a different plant, or altogether redirect the water away from plants.
Arduino Code
#include <Servo.h>
Servo Myservo;
int pos=0;
const int trigPin = 5;
const int echoPin = 4;
const int LED1 = A5;
const int LED2 = A1;
int duration = 0;
int distance = 0;
#define SensorPin A0
float sensorValue = 0;
int goodMoisture = 600;
void setup()
{
pinMode(2,INPUT);
Myservo.attach(3);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(LED1, OUTPUT);
Serial.begin(9600);
}
void loop()
{
if(digitalRead(2)==LOW){
Myservo.write(180);
}
else
Myservo.write(0);
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = duration/58.2;
if ( distance <= 1, distance >=4)
{
digitalWrite(LED1, HIGH);
}
else
{
digitalWrite(LED1, LOW);
}
for (int i = 0; i <= 100; i++)
{
sensorValue = sensorValue + analogRead(SensorPin);
delay(1);
}
sensorValue = sensorValue/100.0;
Serial.println(sensorValue);
delay(30);
if (sensorValue < goodMoisture){
digitalWrite(LED2, HIGH);
}
Don´t Drown The Plants is a project of IAAC, Institute for Advanced Architecture of Catalonia developed at Masters in Advanced Architecture in 2021.
Student: James Alcock
Faculty: Angel Muñoz; faculty assistant: Antoine Jaunard.