Internet of Plants_Kitty Flounder

Made by Ariel Yu

Found in DioT 2019: Internet of Plants

To help your plant thrive with techy and interactive methods.

0

Solution

To help a plant thrive, the two things plant growers can control is the temperature and the water. So the Internet of Plants help solve the issue by detecting the temperature and soil moisture, and provide reminder for plant growers to make adjustments to the plants growing conditions.

Ways of reminder:

Distinct LED bulb: the device possess 2 LED bulbs, red and blue respectively. They show intuitive reminder when the temperature is too high(red LED) or too low(blue LED).

Sound: When the plants need water, a song of roll the boat will be played, as a notification for the plant grower to water the plants.

Twitter connection: The plant could have a unique twitter  account that plant growers can interact with. When the plant need watering, it will tweet and @ the plant grower.

Upload to Google Spreadsheet: Record the temperature of the growing condition in order for the growers to keep track of their plants.


0

Approach

The core of an IoT project is that its cleverness has to useful. In growing plants, the two major condition that could be controlled by plant growers are temperature and hydration. Hence, rather than making the plant seemingly "alive" by adding not functional features, I focused on the problem-solving features that could really help a plant grower keep track of the temperature and hydration level of their plants in order to adjust the growing condition and make it really "alive" and thriving.

0

Process

From the start, in view of functional and practical concerns of planting, I chose temperature and moisture sensor to be the input of my final device and connected them smoothly with the guidance of DIoT Lab. From not knowing anything about circuits to gradually learn the basic sense and know hows from the mechanical engineering background classmates and to being the one who can be helpful in debugging others' project, this process is backbreaking but fulfilling.

For me, most of my obstacles were about the functioning of my particle argon board. It broke down several times with the loss of the ability to either connect to the WiFi or the cloud, and thus being disabled for me to flash my code in. Though that was definitely the process of frustration, when I finished everything-- the code and the circuits-- but tasks just could not be done and I had noting to do in order to move on, I do appreciate all the help from the two TAs and the professor. I remember there was one Friday afternoon office hour, I brought my problem to the TA, and both of us worked on it for so long just trying to solve the issue. Looking from now, when the project is finally done and working, the comparison accelerate my sense of fulfillment and pride.


0

Implementation

List of Parts:

- Particle Argon Board

- Bread Board(s)

- Temp 36 Temperature Sensor

- Capacitor

- Soil Moisture Sensor

- Piezos

- Blue LED

- Red LED

- Resistors

- Wires

0
int tempPin = A4;
int led1 = D2;
int led2 = D4;
int soilSensor = A1;
int led4 = D7;
int tweeted = 0;
int speakerPin = D6;

// create an array for the notes in the melody:
//C4,G3,G3,A3,G3,0,B3,C4
int melody[] = {131,131,131,147,165,0,
165,147,165,175,196,0,
261,261,196,196,165,165,131,0,
196,175,165,147,131}; 

// create an array for the duration of notes.
// note durations: 4 = quarter note, 8 = eighth note, etc.:
int noteDurations[] = {4,4,2,8,4,8,2,8,4,4,4,4,4,4,4,4,4,4,4,8,4,4,4,4,4};

// store the time when you last published
int last_published = -1;



// Create a variable that will store the temperature value
double temperature = 0.0;
double temperatureF = 0.0;


void setup()
{
  // Register a Particle variable here
  Particle.variable("temperature", &temperature, DOUBLE);
  Particle.variable("temperatureF", &temperatureF, DOUBLE);

  // Connect the temperature sensor to A0 and configure it
  // to be an input
  //Connect led1 and led2 to be the output
  pinMode(tempPin, INPUT);
  pinMode(led1, OUTPUT);
  pinMode(led2, OUTPUT);
  
  //connect the soil moisture sensor to A1 to be an input
  //connect led3 and led4 to be the output
   Serial.begin(9600);
    Particle.variable("soilSensor", &soilSensor, INT);
    pinMode(A1, INPUT);
    pinMode(led4, OUTPUT);
    
//Piezos:setup sketch and play notes
  pinMode( speakerPin, OUTPUT );
  playNotes();
}

void playNotes()
{
    // 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);
    }
}

void loop()
{
  // Keep reading the sensor value so when we make an API
  // call to read its value, we have the latest one
  int reading = analogRead(tempPin);

  // The returned value from the device is going to be in the range from 0 to 4095
  // Calculate the voltage from the sensor reading
  double voltage = (reading * 3.3) / 4095.0;

  // Calculate the temperature and update our static variable
  temperature = (voltage - 0.5) * 100;

  // Now convert to Farenheight
  temperatureF = ((temperature * 9.0) / 5.0) + 32.0;
  
  //Low temp notification
  if (temperature < 18)
  {
  digitalWrite(led1,HIGH);
  digitalWrite(led2,LOW);
  }
  
  //High temp notification
  if (temperature > 24)
  {
  digitalWrite(led2,HIGH);
  digitalWrite(led1,LOW);
  }
  
  //Publish temp data to particle
  Particle.publish("TemperatureReadingC", String(temperature));
  delay(10000);
  //Particle.publish("TemperatureReadingF", String(temperatureF));
  
  //soil sensor record and notification
  soilSensor = analogRead(A1);
    if (soilSensor < 1000 && tweeted == 0) {
     // Generic copy for the tweet
     String data = "Hey, @Ariel__Yu__! I need some water! #";
     // Twitter won't post identical tweets. I generate a random integer between 1 and 30 and append it.
     data += random (30);
     // Trigger the integration
     Particle.publish("tweet", data, PRIVATE);
     // Set tweeted variable to 1
     tweeted = 1;
     // Wait 60 seconds
     delay(6000);
 }
 
 else if (soilSensor < 1000 && tweeted != 0){
   // Let's blink the D7 LED, in case I missed the tweet
   playNotes();
   digitalWrite(led1, HIGH);
   delay(1000);
   digitalWrite(led1, LOW);
   delay(1000);
 }
 
 else {
 // Moisture is OK, let's set the tweeted variable to 0
 tweeted = 0;
 digitalWrite(led4,HIGH);
 // Let's wait for another 10 minutes before reading A0 again
 delay(10000);
 }
    //publish soil sensor data to particle
    Particle.publish("SoilSensorReading", String(soilSensor));
    delay(10000);
    to_spreadsheet();
    delay(10000);
}



void to_spreadsheet(){
   // Particle.publish("Test_lastpub", String(last_published));
    //Particle.publish("Test_milli", String(millis()));
 //check if 1 minute has elapsed
//	if( last_published + 6000 < millis() ){
		Particle.publish( "log_to_spreadsheet", String(temperature));
		//Particle.publish( "log_to_spreadsheet", String(temperatureF));
		//Particle.publish( "log_to_spreadsheet", String(soilSensor));
//		last_published = millis();
//	}

}
Click to Expand
0

Next Steps

By now, my device is simply plays a reminding and tracking role in taking care of the plant. For the well-being of the plant and the convenience of the plant grower, it would be great for the device to help taking care of the plants in action, for example, additional automatic watering system after detected water needed and connection to the AC system to adjust the room temperature when detected the temperature is not in the adequate range for growing plant could all be good improvements and next steps.

0

Reflection

From this project I get to work with software and hardware engineer at the same time. I do enjoy the process of realizing the thoughts and plan in mind by implementation. The process of conveying my concept in the computer science logic makes me in order for the system and device to work is challenging but inspiring. Also, finally officially get to code makes me feeling more like a CMU student.

Last but not least, Particle Argon boards are very fragile. It was indeed a prominent obstacle in the our process, especially mine. It's a pity that Due to hardware issue, I wasn't able to flash my code to my final circuit project to make it work.

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.


About

To help your plant thrive with techy and interactive methods.

Created

November 7th, 2019