Pluto the Plant

Made by Melody Her

Found in DioT 2019: Internet of Plants

A two-way helping system that shows you the plant's status when you need it so you know how to help the plant, and allows the plant to help you turn on the light by phone calls when needed.

0

Solution

Pluto the Plant is your plant friend that will express the moisture and sunlight level he gets, and be your little helper to control the light when you are not at home.

When you press the button, it will show you the soil moisture level though different colors of light with red representing dry soil, and getting greener if the moisture level rises. It will also sing a song to express his mood corresponding to 3 levels of sunlight: happier tune if the level of sunlight is higher.

If you don't want to come back to a dark, lonely home, you can call Pluto and let him turn on a light with the mood you prefer and wait for you to come home.

(Want to try it out? Call Pluto at +1-425-312-2142! You won't be able to see the LED light but you can see your input of color been updated in column C of the Google Sheet. *Valid before 2019/11/30)

0

Approach

Level of moisture and sunlight are two crucial factors when growing a plant. Considering there are already too much screen time and disturbance in our daily life, I want to find an ambient solution to monitor plant status without disturbing the user or asking the user to check any web or app interface. Also, I want it to show the information only when it's needed to reduce unnecessary energy waste.

To enhance the "friend" feature of the plant, I want to create a way for people to build a two-way connection with their plants, so that they can have a plant friend that warms their heart.

0

Process

Choice of Components

For the output, in order to design an ambient display showing plant status, I decided to go with sound (piezo) and light (LED light) elements, since they are easier to relate to the emotions, making it suitable to express the characteristic of a plant friend. As for the input, I choose a FSR sensor to detect the action of user pressing the button as a trigger, a photoresistor to detect the level of sunlight, and a DIY moisture sensor to detect the level of soil moisture.

Choice of Technical Approaches

Since I would like to enhance the bonding and communication between user and the plant, I originally decided to use DialogFlow to create a chatbot that enables you to chat with your plant via social platforms like Facebook Messenger, Slack, etc. But you will need to chat with your plant by staring at your screen, which seems to be unhealthy and a little unnatural/indirect in a desired scenario as talking to a friend. So I go with the idea of "calling your plant" by phone so you can literally talk to your plant friend.

The next problem to be solved is how to link DialogFlow with Particle. I tried to connect them directly with IFTTT but they don't have DialogFlow as one of the supporting application. Then I tried with Microsoft Flow but the "receiving HTTP request" trigger is only in the premium version. So I landed on connecting Particle to Google Sheets via IFTTT, then linking Google Sheets to DialogFlow with its Inline Editor.

0

Implementation

Workflow - Show Status of the Plant

User press the button
→ light up LED (dry: red, moist: green)
→ sing a song (higher level of light: more energetic tune)  

0

Workflow - Turn On Light via Phone Call

Users call Pluto
→ trigger DialogFlow for the conversation
→ collect user's input on Google Sheets
→ trigger IFTTT
→ collect value from Google Sheets and send it to Particle function
→ send signal to Pluto and light up desired color

0

List of Parts

  • FSR Sensor *1
  • Piezo Speaker *1
  • RGB LED *1
  • 1kΩ Resistor *6
  • Photoresistor *1
  • Particle Argon *1
0
Circuit diagram
Untitled sketch 2 bb
0
Completed code for Pluto the Plant - Particle
//FSR detection
int fsrPin = A0;
int fsrReading = 0;

//moisture detection
int moistPin = A1;
int moistVal = 0;

//sunlight detection
int photoCellPin = A2;
int photoCellReading = 0;

//Define the pins for LED light
int redPin = D4;
int greenPin = D5;

//Create variables to store LED brightness.
int redLedBrightness = 0;
int greenLedBrightness = 0;

//Define the pin for piezo
int speakerPin = D3;

//Define melody1
int melody1[] = {2637,2093,2637,2093,2794,2093,2637,2093}; 
int noteDurations1[] = {2,2,2,2,2,2,2,2 };

//Define melody2
int melody2[] = {2637,1568,2093,2349,2794,2349,2637,2093}; 
int noteDurations2[] = {4,4,4,4,4,4,4,4};

//Define melody3
int melody3[] = {2637,1568,2093,1568,2093,1568,2093,2349,2794,3136,2794,2349,2637,2349,2637,2093}; 
int noteDurations3[] = {8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8};

void setup()
{
  //set up a cloud function for phone calls processed via DialogFlow
  Particle.function("callPlant", phoneCall);
  
  //set up LED as output
  pinMode(redPin, OUTPUT);
  pinMode(greenPin, OUTPUT);
  //set up speaker as output
  pinMode( speakerPin, OUTPUT );
  
  //create cloud variables of type integer
  Particle.variable("force", &fsrReading, INT);
  Particle.variable("light", &photoCellReading, INT);
  
  Serial.begin(9600);
  Particle.variable( "soil", moistVal );
}

void loop()
{
  //use analogRead to read sensor readings
  //this gives us a value from 0 to 4095
  fsrReading = analogRead(fsrPin);
  moistVal = analogRead(moistPin);
  photoCellReading = analogRead(photoCellPin);
  Serial.println(moistVal);
  
  //map moisture level into the PWM range (0-255) and use it to decide the color of LED light
  redLedBrightness = map(moistVal, 0, 150, 0, 255);
  greenLedBrightness = 255 - redLedBrightness;

  //detect pressing force on FSR sensor as the trigger to show information
  if (fsrReading >= 4000){
    analogWrite(redPin, 255);
    analogWrite(greenPin, 255);
  }
  else {
    // fade the LED to the desired brightness
    analogWrite(redPin, redLedBrightness);
    analogWrite(greenPin, greenLedBrightness);
    delay(100);
    
    //detect level of sunlight to decide the melody, which represents plant's mood
    if (photoCellReading <= 700) {
        playNotes1();
        delay(100);
    }
    else if (photoCellReading >700 && photoCellReading <=1200){
      playNotes2();
      delay(100);
    }
    else{
        playNotes3();
        delay(100);
    }
  }

// wait 1/10th of a second and then loop
delay(100);
}

//lowest status: calm mood; low level of sunlight
void playNotes1()
{
    //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/noteDurations1[thisNote];
      tone(speakerPin, melody1[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);
    }
}

//mid status: normal mood; medium level of sunlight
void playNotes2()
{
    //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/noteDurations2[thisNote];
      tone(speakerPin, melody2[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);
    }
}

//highest status: happiest mood; highest level of sunlight
void playNotes3()
{
    //iterate over the notes of the melody:
    for (int thisNote = 0; thisNote < 16; 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/noteDurations3[thisNote];
      tone(speakerPin, melody3[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 to operate when a row is added in the Google Sheets by DialogFlow
int phoneCall(String command)
{
    //take the input from user to decide the color of the light
    if (command == "red"){
      analogWrite(redPin, 0);
    }
    else {
      analogWrite(greenPin, 0);
    }
    
    //turn on the light for 10 sec for demo purpose
    //should set to a longer period of time (e.g. 10~30 min) for practical use 
    delay(10000);
}
Melody Her (2019) Click to Expand
0

Next Steps

One major adjustment/improvement I might make when taking this project forward is trying to link Particle and DialogFlow directly. Currently, the device is having a 10 to 30 seconds delay when getting input from the user. The delay can be captured in the backstage of IFTTT. Plus, it's restrictive to work with IFTTT when the functions are getting more and more complex. Connecting Particle and DialogFlow directly might reduce the delay and open up more possibilities. (Or maybe start with connecting the two through Google Sheets first as a more approachable solution.) 

In the sense of the project's future direction, I think of two possible applications: green smart home device, or chatting system encouraging people to support tree planting events by improving the level of how much people feel they are bonding with the tree they plant.

0

Reflection

There are a lot of resources online about different levels of different applications, and also lots of people sharing their projects, problems and solutions with the community. This opensource spirit in the community is a positive cycle that is super helpful, making it possible for everyone to learn how to build and code, and also allowing all the creators build upon others' work to achieve greater outcome. It is really challenging and interesting to combine different applications with no coding background, and the integration applications like IFTTT are providing some new ways to work around it and achieve what you want.

0

References

    0
    Show status of the plant: Change the color of the light according to moisture level, and tunes according to sunlight level.
    Melody Her - https://www.youtube.com/watch?v=FK1VN5Yqf6U
    0
    Call your plant to turn on the light for you. Call Pluto to let him turn on a light for you with your desired color. [00:00 - 01:50]: demo for turning on the red light by phone; [01:51 - 05:40]: demo for turning on the green light by phone. You can also turn on a disco light if you feel like it ;-)
    Melody Her - https://youtu.be/bhTr9AEl26E
    x
    Share this Project

    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

    A two-way helping system that shows you the plant's status when you need it so you know how to help the plant, and allows the plant to help you turn on the light by phone calls when needed.

    Created

    November 6th, 2019