scaryPlant

Made by akrakora

Found in DioT 2019: Internet of Plants

Light is essential to your plant’s well being just as much as it is to yours. Keep an eye on the ever- encroaching dark side with a scaryPlant system. Warnings about low light levels and excessive force will be logged through your Google Drive so you’ll know when to change your habits.

0

Solution 

Light is essential to your plant’s well being just as much as it is to yours. Keep an eye on the ever- encroaching dark side with a scaryPlant system. Warnings about low light levels and excessive force will be logged through your Google Drive so you’ll know when to change your habits.

One of the primary reasons that plants don’t survive in the apartments of busy graduate students (or Jedi knights)  is that they are placed in spots where light levels are too low to sustain life. To solve this problem, a photo-resistor sits in the pot and sends a warning if light levels dip below a critical threshold. When this event occurs and the plant needs to be moved to a brighter environment, it sends a message to your Google Drive to remind you that it needs a little TLC.

Sometimes the dark side starts to encroach on your life, too. The scaryPlant’s force sensor will let you know if the dark side is gaining strength. If you touch the sensor with a death grip, it will send out an SOS message in Morse code so you know to chill out. If you escalate a step further with a force choke, you’ll hear the imperial march.

0
scaryPlant
scaryPlant - https://youtu.be/Mp6ooiig3Ls
0

Approach  

I began this project by focusing on the need for monitoring the light my plants receive over a period of time. This chore is something that I often forget to complete at home and would like a reminder for. Once I found a practical solution for this problem, I began looking for a humorous reminder that would nudge me check my plants daily. 

0

Process  

After deciding on the above approach, I began learning about how to use sensors, LEDs, and a piezo buzzer to relay information between the Particle board, the user, the environment, and the internet. After this stage, I followed the following steps to build the project:

1. Discovery: Research different IoT devices built with plants

2. Outline scaryPlant’s functionality and work flow

3. Build circuit and code for first stage, measuring light levels and then turning on indicator light

4. Build circuit and code for second stage, measuring force levels and turning on indicator light

5. Connect to IFTT and create applet in order to send information to Google Sheets

6. Build circuit and code for piezo buzzer, experiment and research how to play different tones and songs

7. Add piezo to circuit, code for loop that determines which sounds are played in which cases

8. Test full system, including Google Sheets connectivity

0

Below is the process the plant will follow to sense information from the environment and then choose the appropriate output.

0

Technical Documentation  

This project can be reproduced with the following bill of materials, schematic, and code.

0
//Designing for IoT 10/31/2019
//Anna Krakora
//Creative Project 1, Internet of Plants

//Code outline from https://diotlabs.daraghbyrne.me/docs/working-with-sensors
//Imperial march code from https://gist.github.com/nicksort/4736535

//Initiate photoresistor components
int lightSensorPin = A0;
int lightSensorValue = 0;
int ledPinRed = D2;
int ledBrightnessRed = 0;

//Initiate force sensor components
int forceSensorPin = A1;
int forceSensorValue = 0;
int ledPinGreen = D3;
int ledBrightnessGreen = 0;
int forceval = 0;

//initiate speaker components
int speakerPin = D4;

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


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

//initialize beep counter
int counter = 0;

//initialize musical notes
const int c = 261;
const int d = 294;
const int e = 329;
const int f = 349;
const int g = 391;
const int gS = 415;
const int a = 440;
const int aS = 455;
const int b = 466;
const int cH = 523;
const int cSH = 554;
const int dH = 587;
const int dSH = 622;
const int eH = 659;
const int fH = 698;
const int fSH = 740;
const int gH = 784;
const int gSH = 830;
const int aH = 880;

//initiate pulishing to IFTTT
int last_published = -1;


void setup() {
//setup leds
    pinMode ( ledPinRed, OUTPUT );
    pinMode ( ledPinGreen, OUTPUT );
//setup sensors
    pinMode( lightSensorPin, INPUT );
    pinMode( forceSensorPin, INPUT );
//output sensor values to particle console  
    Particle.variable( "lightValue", &lightSensorValue, INT);
    Particle.variable( "forceValue", &forceSensorValue, INT);
    
//setup Piezo
 // pinMode( speakerPin, OUTPUT );
 // playNotes();
 // firstSection();
 
 //Ready beep
 readybeep();

}

void loop() {
//read sensors
    lightSensorValue = analogRead ( lightSensorPin );
    forceSensorValue = analogRead ( forceSensorPin );
    
//map sensor readings to led values
    int lightBrightness = map (lightSensorValue, 0, 3000, 255, 0);
    //int touchBrightness = map (forceSensorValue, 100, 2500, 0, 255);

 //set photoresitor led values
    ledBrightnessRed = lightBrightness;
 //write led values to led pins
    analogWrite( ledPinRed, ledBrightnessRed );
    
    delay (500);
    
    if (forceSensorValue >= 3000){
       ledBrightnessRed = 0; 
       firstSection();
       forceval = 6000;
    }

        else if (forceSensorValue >= 500 && forceSensorValue <= 2500){
             //if force sensor is pressed, turn on green led
        analogWrite( ledPinGreen, 250 );
       
        //if force sensor is pressed, play a tone
        playNotes();
        
        analogWrite( ledPinGreen, 0);
        
        ledBrightnessRed = 0;
        forceval = 10;
        }
        
    //send light data to spreadsheet
        Plant_status2();
        
        forceSensorValue == 0;
        analogWrite (ledPinRed, 0); 
}

//function to play sound
void playNotes()
{
    // iterate over the notes of the melody:
    for (int thisNote = 0; thisNote < 11; 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);
    }
}

//play a note
void beep(int note, int duration)
{
  //Play tone on buzzerPin
  tone(speakerPin, note, duration);
 
  //Play different LED depending on value of 'counter'
  if(counter % 2 == 0)
  {
    digitalWrite(ledPinGreen, HIGH);
    delay(duration);
    digitalWrite(ledPinGreen, LOW);
  }else
  {
    digitalWrite(ledPinRed, HIGH);
    delay(duration);
    digitalWrite(ledPinRed, LOW);
  }
}
  
  //initialize beep
   void readybeep(){
    beep(a, 650);
   }
    
   
  // song1
  void firstSection()
{
  beep(a, 500);
  beep(a, 500);    
  beep(a, 500);
  beep(f, 350);
  beep(cH, 150);  
  beep(a, 500);
  beep(f, 350);
  beep(cH, 150);
  beep(a, 650);
 
  delay(500);
 
  beep(eH, 500);
  beep(eH, 500);
  beep(eH, 500);  
  beep(fH, 350);
  beep(cH, 150);
  beep(gS, 500);
  beep(f, 350);
  beep(cH, 150);
  beep(a, 650);
 
  delay(500);
}
 

//Send to spreadsheet funtion
void Plant_status2(){

  // check if 1 minute has elapsed
	if (last_published + 60000 < millis() && forceval == 6000){
	    Particle.publish( "Plant_status2", String("The dark side is getting stronger. Be gentle with the force."));
		last_published = millis();
	}
	else if (last_published + 60000 < millis() && forceval == 10 ){
        Particle.publish( "Plant_status2", String("The dark side is warning you. SOS. Lighten up"));
		last_published = millis();
	}
    else if 
		( last_published + 60000 < millis() && ledBrightnessRed <= 3000 ){
		Particle.publish( "Plant_status2", String("Hey! Its too dark in here.  Use the force to bring in more light"));
		last_published = millis();
}
}
Click to Expand
0

Next Steps  

1. Tweak IFTT applet and particle code so that it only sends and update once per day when necessary instead of every time the warning is triggered.  This event occurs so often that the IFTT usage limit is quickly exceeded.

2. Improve usability and design focus.  The story line behind the object is not very intuitive and would be confusing to a first time user.

3. Update code so that the photo resistor automatically initializes a correct threshold for triggering a warning.  This process is currently hard coded into the program.

0

Reflection  

The majority of the time I spent on this project went towards learning how to use the particle board, sensors, circuits, and IFTT together to form a system.  My initial goal was to partner with Austin Van Vark's "Listening Plant" project so that our plants could send messages to each other or have a conversation.  I didn't reach that goal on this project, but I learned the fundamentals of the IoT design process and how to debug a system that includes many different types of inputs and outputs.  These skills will be very useful on the next creative design project.

x
Share this Project

This project is only accessible by signed in users. Be considerate and think twice before sharing.


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

Light is essential to your plant’s well being just as much as it is to yours. Keep an eye on the ever- encroaching dark side with a scaryPlant system. Warnings about low light levels and excessive force will be logged through your Google Drive so you’ll know when to change your habits.

Created

November 6th, 2019