Save your plant from the severe weather

Made by Yuan Sun

Found in DioT 2019: Internet of Plants

Your plant needs your protection to grow sturdily. Don't forget to save it from severe weather outdoors when you have it outside for fresh air and sunshine.

0

Solution

This Internet of Plant is designed for people like my mother who keep flowers outdoors on the balcony. They sometimes forget to bring their plants inside when the weather is extreme, which will do harm to the plants. My design is to show them the weather condition and help remind them when they need to take actions.

0

Approach

  • First, I thought about the problem we have when we want to take care of the plants and interviewed some people.
  • Then, from my research, I found an opportunity that people like my mom might keep their plants outdoors, and they don’t know when or just forget to bring the plants inside in an extreme weather.
  • I figured that I could use Flex sensor to detect the wind, photoresister to detect the sunlight and temperature sensor for temperature. These are the factors that influence the plants’ well being outdoors.
  • I determined the priority these environmental factors to the plant, and used two LEDs and a piezo to simulate the interaction to show how the environment influences the plant.
  • Lastly, I wrote code according to my designed functions.    


0

Process

1.     Components:

  • Photoresister to detect the sunlight
  • Flex sensor to detect the wind
  • DB18B20 Temperature sensor to detect the temperature
  • Red LED to indicate temperature and wind condition
  • RGB LED to indicate intensity of illumination
  • Piezo to alarm when weather is extreme    


0

2.     Photos and videos of the circuits assembled:

0

3.   Code (versions):  

3.1 Experient code to realize the functions of the RGB LED 

0
   3.2  When only have Flex sensor and Photoregister    
0

3.3  After adding temperature sensor and a Red LED, and made adjustments to the way to indicate the user. 

0

4.     Reflections:

The code and functions are very basic at this phase. So I think the idea of the project is very important like the space for further development, the creativity and the interaction. Besides, it is helpful to pay attention to the structure of the code for further development of complex functions.


5.     Challenges encountered and solutions:

5.1  Technically, it’s a challenge to measure which turning point of the value I should put in the code so that the LED can change to indicate the change of the sensor data effectively. I did experiments to identify how the data of the sensor change with the change of the real environment.

5.2  For design, it is challenging to come up with a way to indicate the change to the user. As I only choose to use two LEDs and a piezo, I need to use the blinks and color of LEDs to show the interaction, and use piezo at an appropriate point. I would think in a way that if I could have more resources, how I would transform the current interaction into a more mature one.    

0

Implementation

1. List of part:

  • The Particle pad
  • A Photoresister
  • A Flex sensor
  • The DB18B20 Temperature sensor
  • A Red LED
  • A RGB LED
  • A Piezo
  • Three registers


2. Circuit diagram:  


0

Next Steps

1. Use IFTTT to send the alarm to send email or message to the user to remind them in time.

2. Test the Photoregister with the change of illumination intensity, and correspond the data to the real illumination intensity level (eg. LUX).

3. Do desktop researches of how these environmental indicators influence the growth of plants, and then adjust the changes of LEDs and buzzer.    

0

Reflection

Through this project, I managed to put together what we learned and practiced during the last two weeks and added some interesting ideas of my own as well. It is more meaningful when using sensors and LEDs to realize functions for things in the real world. I hope I can further develop my ideas as well as my coding skills and deepen my understanding of IoT, so that I can come up with a more mature design at the end of this course.    

0

References

https://www.pinterest.com/pin/16536723619230692/?nic=1a&sender=357473426581096237

https://diotlabs.daraghbyrne.me/docs/getting-inputs/buttons/    

0
#include <libfixmath.h>
#include <spark-dallas-temperature.h>
#include <OneWire.h>

int sensorBend=A2;
int sensorLight=A4;
int ledRed=D2;
int ledBlue=D3;
int ledGreen=D4;
int sensorValueBend;
int sensorValueLight;

int ledAlarm=D7;


float tempC;

int BendBright;
int LightBright;


int speakerPin = D5;

// create an array for the notes in the melody:
//C4,G3,G3,A3,G3,0,B3,C4
int melody[] = {1908,2551,2551,2273,2551,0,2024,1908}; 

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

OneWire oneWire( D6 );

// Pass our oneWire reference to Dallas Temperature.
DallasTemperature dallas(&oneWire);

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

void setup() {
    pinMode (ledRed, OUTPUT);
    pinMode (ledBlue, OUTPUT);
    pinMode (ledGreen, OUTPUT);
    
    pinMode (sensorBend, INPUT);
    pinMode (sensorLight, INPUT);
    
    pinMode( speakerPin, OUTPUT );
    pinMode(ledAlarm, OUTPUT);
     //Particle.variable ("fsr", sensorValue);
    
    Particle.variable("temperature", &temperature, DOUBLE);
    // setup the library
    dallas.begin();

}

void loop() {
    sensorValueBend = analogRead (sensorBend);
    sensorValueLight = analogRead (sensorLight);

    temp();
    setLight();
    setAlarm();
    log_to_spreadsheet();
    
    delay(2000);
    
}

void setColor (int red, int green, int blue){
    analogWrite(ledRed, red);
    analogWrite(ledBlue, blue);
    analogWrite(ledGreen, green);
}


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

void log_to_spreadsheet(  ){

  // check if 1 minute has elapsed
	if( last_published + 60000 < millis() ){
		Particle.publish( "log_to_spreadsheet", String( sensorValueBend  ) );
		Particle.publish( "log_to_spreadsheet", String( sensorValueLight  ) );
		Particle.publish( "log_to_spreadsheet", String( temperature  ) );
		last_published = millis();
	}

}

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 setAlarm (){
    
    if (sensorValueBend>1000 && ((temperature<15)||(temperature>30))) {
        playNotes();
    }//bend & extreme temperature, meaning too windy and cold/hot
        
    if (sensorValueBend>1000 && ((temperature>=15)&&(temperature<=30))) {
        digitalWrite(ledAlarm, HIGH);
        delay(500);
        digitalWrite(ledAlarm, LOW);
        delay(500);
    }//bend & moderate temperature, meaning too windy but warm
        
    if (sensorValueBend<1000 && ((temperature<15)||(temperature>30))) {
        digitalWrite (ledAlarm, HIGH);
        delay(1000);
        digitalWrite (ledAlarm, LOW);
        delay(1000);
    }//straight & extreme temperature, meaning not windy but cold/hot
        
    if (sensorValueBend<1000 && ((temperature>=15)&&(temperature<=30))) {
        digitalWrite (ledAlarm, LOW);
        delay(2000);
    }//straight & moderate temperature, meaning not windy and warm
}

void setLight(){
    if ((sensorValueLight>=0)&&(sensorValueLight<500))
        setColor(255,255,255);
    else if ((sensorValueLight>=500)&&(sensorValueLight<1500))
        setColor(0,255,255);
    else if((sensorValueLight>=1500)&&(sensorValueLight<2500))
        setColor(255,255,0);
    else if((sensorValueLight>=2500)&&(sensorValueLight<=4095))
        setColor(0,0,0);
}

void temp()
{
  // Request temperature conversion
  dallas.requestTemperatures();

  // get the temperature in Celcius
  tempC = dallas.getTempCByIndex(0);
  // convert to double
  temperature = (double)tempC;

  delay(5000);

}
Click to Expand
0
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

Your plant needs your protection to grow sturdily. Don't forget to save it from severe weather outdoors when you have it outside for fresh air and sunshine.

Created

November 6th, 2019