# Plant Caring

Found in DioT 2019: Internet of Plants

This IoT device is designed to protect the plant from hurt. It will release a sound and light when someone is touching or treading on it.

0

## Solution

How to protect a plant can always brother a plant-owner, especially for some parents with young kids. The young kids always touch even squeeze the plant hardly driving by their strong curiosity. For some poor plants, their life ended miserably by this torment. In order to solve this problem, I built up a device that is able to beep and lighten when it detects touch and squeeze. The plant owners can attract by the noise and light and stop their naughty kids, then save the plant on time.

0

## Approach

As a  novice in IoT, my approach is to minimize my work and maximize my utility to solve a real-life problem. I came up with my idea by using the sensor I have had already and familiar with. Since my family has a young kid who always kills the plant, this becomes the problem that I desire to solve the most.

0

## Process

1. Complete a circuit with only the LED lightbulb

2.  Write the code and transfer to the Argon to check the LED lightbulb can work or not

3. The LED lightbulb works

4. Complete a circuit with the LED light and speaker

5. Write the code and transfer to the Argon to check the speaker can beep or not

6. The speaker beeps

8. Write the code and make sure when I squeeze the FSR resistor, the speaker would beep and the LED lightbulb would shine simultaneously. When I release the FSR, there is no sound and the light is off.

9. Share sensor information on the internet

0

## Implementation

Parts Used:

Particle Microcontroller

Jumper Wires

1 FSR resistor

2 1kΩ Resistor

1 Red LED

1 10kΩ Resistor

1 Speaker

0

0

0
0

## Code

0
``````int ledPin = D2;
int speakerPin = D4;
int melody[] = {1908,2551,2551,2273,2551,0,2024,1908};
int noteDurations[] = {4,8,8,4,4,4,4,4 };
int fsrPin = A0;
int last_published = -1;

void setup() {
pinMode(ledPin, OUTPUT);
}

void loop() {

digitalWrite(ledPin, HIGH);
delay(100);
digitalWrite(ledPin, LOW);
delay(100);

digitalWrite(ledPin, HIGH);
delay(100);
digitalWrite(ledPin, LOW);
delay(100);

digitalWrite(ledPin, HIGH);
delay(100);
digitalWrite(ledPin, LOW);
delay(100);

playNotes();
}else{
digitalWrite(ledPin, LOW );
}

}

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);
}
}

// check if 1 minute has elapsed
if( last_published + 60000 < millis() ){
last_published = millis();
}

}``````
Click to Expand
0

## Reflection

I am excited about my work and I think it can solve the problem that my family has. I feel good because I can utilize the thing I learned from the class to a real-life project.

0

## Next Steps

1. Volume up the speaker so it can attract the attention from the plant-owner more effectively

2. Enable to connect the device to the phone or other removable devices, so the plant-owners can check the plant anytime and anywhere

3. Make the FSR resistor invisible and stick on the plants to make sure it can work out successfully

0

Connect to the Internet

This device is connected to Google Drive via IFTTT. A Google Sheet was generated with collected data on the amount of light detected on a per-minute basis. A 10-hour monitor was then conducted.

0