Self-watered plant "Paudha"

Made by Rahul Sridhar

Found in DioT 2019: Internet of Plants

Experiment with Particle (controller and cloud), Soil Moisture Sensor, a Servo motor, and an LED to demonstrate the automatic watering capability of a plant. Using IFTTT, the user is sent an SMS only when the plant is in distress and requires further intervention.

0
//declare pins to be used
//for servo motor
int servoPin = A3;
Servo myServo;
int servoPos = 0;

//variables for soil moisture
int soilMoistureLed = D3;
int moistPin = A1;
int moistVal = 0;

//variable to store piezo value
int speakerPin = A4;

//melody tune array
int melody[] = {2000,0,2000,0,2000,0,2000,0}; 

//duration of each of the notes
int noteDurations[] = {4,8,8,4,4,4,4,4};

//set counter for SMS function
int last_published = -1;

void setup() {
    
    pinMode (soilMoistureLed, OUTPUT);
    
    Serial.begin(9600);
    
    //declare particle variable to track and use value on cloud
    Particle.variable( "soil", moistVal );


  // attaches the servo on the A3 pin to the servo object
    myServo.attach( A3 );

   //Register our Particle to control the servo
    //Particle.function("servo", servoControl);

  // Keep a cloud variable for the current position
//Particle.variable(  "servoPos" , &servoPos , INT );

}

void loop() {
    
moistVal = analogRead(moistPin);
Serial.println(moistVal);
//log_to_spreadsheet(  );

    
//extreme condition - water content is extremely low. Send alert to user to take action.
//servo arm moves 90 degrees to open valve
if (moistVal > 3000){
    myServo.write(45);
    digitalWrite (soilMoistureLed, HIGH);
    delay (50);
    digitalWrite (soilMoistureLed, LOW);
    delay (50);
    sendSMS();
    
 
//moderate condition - water content is low. Water the plant but don't send alert to user
//servo arm moves 90 degrees to open valve
 }else if (moistVal > 2000 and moistVal <3000){
    myServo.write(45);
    digitalWrite (soilMoistureLed, HIGH);
    delay (500);
    digitalWrite (soilMoistureLed, LOW);
    delay (500);
    
}else {
    digitalWrite (soilMoistureLed, LOW);
    
    //servo arm moves -90 degrees to close valve
    myServo.write(0);
}
}


//function for piezo - symbolizes Amazon Echo
void alexa()
{
    // iterate over the notes of the melody:
    for (int thisNote = 0; thisNote < 8; thisNote++) {

      // to calculate the note duration, take one second
      // divided by the note type.
      //e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc.
      int noteDuration = 1000/noteDurations[thisNote];
      tone(speakerPin, melody[thisNote],noteDuration);

      // to distinguish the notes, set a minimum time between them.
      // the note's duration + 30% seems to work well:
      int pauseBetweenNotes = noteDuration * 1.30;
      delay(pauseBetweenNotes);
      // stop the tone playing:
      noTone(speakerPin);
    }
}


//function for sending SMS
void sendSMS(  ){
    
    	Particle.publish( "SendSMS", String( moistVal  ) );
		last_published = millis();
    		//only send message once to user. Increase delay between messages even if condition is met.
		
	//delay(1000);
    }


//function to log values to spreadsheet

void log_to_spreadsheet(  ){

  // check if 1 minute has elapsed
	if( last_published + 1000 < millis() ){
		Particle.publish( "Log", String( moistVal  ) );
		last_published = millis();
	}

}
Click to Expand
0

Solution

With millennials delaying parenthood, plants have become the new pets, fulfilling a desire to connect to nature and the blossoming “wellness” movement. One of the biggest reasons why a lot of these plants wilt or die is because the owners forget to water their plants regularly and appropriately. This was the inspiration for developing a quick prototype to automatically water plants based on the moisture level in the soil. 

The idea is to calibrate the appropriate moisture content in the soil of an indoor plant and monitor this variable to make a decision on when to water and how much to water. Along the way, there are subtle nudges for the owner like a glowing LED as a visual indicator (with different blink rates associated to represent different states) and text message alerts when conditions are critical. This allows for user intervention when absolutely necessary and a sufficient level of automation for the plant to survive and thrive without the users' intervention.

Here is a short video of how this low-fidelity prototype works -  https://youtu.be/u3wxPjMjpGw

Approach

While there are a lot of similar solutions in the market for watering a plant, they were all 'fully automated' solutions without any user interaction. I felt that there was a place for both automation and human intervention to co-exist. The IoT device would do most of the heavy lifting in terms of division of labor, but the humans will have to intervene (the IoT device can provide this nudge) at critical moments.

Hence the idea of building this solution which augments the existing solutions. 

Process

The initial idea I had was to integrate voice (Amazon Echo) commands to control the actions to be taken on the plant. Inspiration for this was the idea of a water bomb (basically a water-balloon situated in the pot) which was at the arm of a pointed head connected to a servo motor. Sending a text message with "DETONATE" would trigger the servo arm which would burst the balloon to release the water in the pot. I felt this idea of controlling when and how the action (in this case a function) is executed was cool and had experiential appeal. I had to move away from this idea because of the complexity of working with Lambda functions on AWS, js scripts, and libraries that authenticate and communicate with the Particle device. This is definitely an area I would like to work on in the future but not for this first creative project.

The other idea was to keep it really basic and get a combination of lights and sensors to behave in a certain way to represent behavior. I realized that I wanted to challenge myself further on this creative project and experimented with new equipment and sensors to build something a little more complex.

Finally, I chose the exciting parts of both ideas - working with watering the plant (as identified, the main cause for plants to wilt or die) and using a new device (like a servo motor) to create a simple experience.  

Implementation

Be able to illustrate the final outcome and how you produced it. Your documentation for this section must include:

  • Completed code - uploaded in section above
  • Circuit diagram - 


  • A list of parts

Illustrative diagrams of the circuit and components - 

Circuit - 



Other components - Soil Moisture Sensor



  Other components - Servo motor with a foam core model of a water container

  

Moisture value vs Time


Next Steps

What would you do if you took this project forward and why? What would you do differently?

I would like to explore the integration of voice to create a meaningful interaction with the plant. I would also like to work on the form of the solution - as this prototype is just an illustration of the concept. 

I would definitely build-in more functionality in terms of handling all scenarios and fallbacks. At the moment, this prototype works for a limited set of situations. I would also like to start early and get feedback on proof of concept before moving ahead with the final option. Lastly, I would regularly take a back-up of the code block that 'works' so that things don't go awry when adding new functionality.    

 

Reflection

Key learnings

The biggest learning for me was that you can define how simple or complex you want to make an idea. Coding seemed daunting at first, but breaking down the code into smaller chunks of discrete functionality really helps to build the program. Finally, there is so much documentation on the web around a device, an idea, a function, and integration, that you don't feel limited by your knowledge of the technology and implementation; and can really think creatively.

Skills acquired 

I definitely feel more comfortable working with Particle and Particle Cloud. I also experimented with some foam core modeling to give the solution form, so that was interesting as well. Lastly, writing pseudocode helps zoom-out of the problem and focuses on the logic of what you are building.  

References

1. Code for the Servo motor and how to control its position  https://forum.arduino.cc/index.php?topic=118465.0  

2. A useful guide to creating an integration with Amazon Echo https://medium.com/@thebelgiumesekid/how-to-create-an-alexa-enabled-smart-home-with-particle-photon-part-1-d8c4da3702e9

3. Resource put together on the Basics of circuitry and equipment https://diotlabs.daraghbyrne.me/

4. Bloomberg article on the trends in plant buying behavior https://www.bloomberg.com/news/features/2019-04-11/the-one-thing-millennials-haven-t-killed-is-houseplants

5. Support from colleagues - Swapnil, Shreyas, Ipsita, and Saumya - from ideating, validating, and implementation of logic to testing and finalization.

x
Share this Project

This project is only accessible by signed in users. Be considerate and think twice before sharing.


Courses

49713 Designing for the Internet of Things

· 16 members

A hands-on introductory course exploring the Internet of Things and connected product experiences.


Focused on
About

Experiment with Particle (controller and cloud), Soil Moisture Sensor, a Servo motor, and an LED to demonstrate the automatic watering capability of a plant. Using IFTTT, the user is sent an SMS only when the plant is in distress and requires further intervention.

Created

November 7th, 2019