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.



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.



  • 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.    



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    


2.     Photos and videos of the circuits assembled:


3.   Code (versions):  

3.1 Experient code to realize the functions of the RGB LED 

   3.2  When only have Flex sensor and Photoregister    

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


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.    



1. List of part:

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

2. Circuit diagram:  


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.    



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.    



#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:
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


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


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;
      // stop the tone playing:

void setAlarm (){
    if (sensorValueBend>1000 && ((temperature<15)||(temperature>30))) {
    }//bend & extreme temperature, meaning too windy and cold/hot
    if (sensorValueBend>1000 && ((temperature>=15)&&(temperature<=30))) {
        digitalWrite(ledAlarm, HIGH);
        digitalWrite(ledAlarm, LOW);
    }//bend & moderate temperature, meaning too windy but warm
    if (sensorValueBend<1000 && ((temperature<15)||(temperature>30))) {
        digitalWrite (ledAlarm, HIGH);
        digitalWrite (ledAlarm, LOW);
    }//straight & extreme temperature, meaning not windy but cold/hot
    if (sensorValueBend<1000 && ((temperature>=15)&&(temperature<=30))) {
        digitalWrite (ledAlarm, LOW);
    }//straight & moderate temperature, meaning not windy and warm

void setLight(){
    if ((sensorValueLight>=0)&&(sensorValueLight<500))
    else if ((sensorValueLight>=500)&&(sensorValueLight<1500))
    else if((sensorValueLight>=1500)&&(sensorValueLight<2500))
    else if((sensorValueLight>=2500)&&(sensorValueLight<=4095))

void temp()
  // Request temperature conversion

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


Click to Expand
Share this Project


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

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.


November 6th, 2019