49713 Designing for the Internet of Things
· 16 members
A hands-on introductory course exploring the Internet of Things and connected product experiences.
Found in DioT 2019: Internet of Plants
Lightly is an easy-to-use and effective IOT device that is designed to save your plants from insufficient sunlight intakes.
It is always a daunting experience to see a bunch of dried leaves twisted with a withered stem when you check with your plant after a few busy weeks. We often forget about our plants and they die unexpectedly. However, with lightly, this will not be a problem! The device will beep and flash catching lights when your plants are not getting enough sunlight they need.
In my opinion, the essence of this design is its minimalist nature. I approached this design by thinking about "how might I design something that is useful, usable, utilize the skills I have been learning in this class, and does not take a crazy amount of time since I am managing a number of projects with tight deadlines lately?" As such, the approach can be summarized as: maximized use of new skillsets learned from IOT class + minimized time spent on the workload + solving a real problem effectively.
The first thing I did was to go to the list of sensors to review their functions and to brainstorm which can work for this project. I quickly realized I can give the photoresistor a shot since it detects the amount of sunlight and plants need sunlight to survive. Then, an idea popped up in my head naturally that I can also use the speaker and led lights to serve as warning when the sunlight is below a certain level. Next, I concluded this is a viable idea that solves an actual need and went straight to building. Below is the building process:
1)Make a complete circuit with only the speaker
2)Run simple codes on speaker to test it is working (positive)
3)Add one led light to the circuit and run simple code to test (positive)
4)Realize two lights flashing back and forth is more attractive
5)Rearrange the position of 1st led light and added 2nd one
6)Test two lights are working with simple code (positive)
7)add sensor to the circuit and run simple code to test it is working (positive)
8)rewrite the code to make it serve the purpose of its design by adding if statements
9)test the finished design (positive)
int speakerPin = D8;
int melody[] = {1908,2551,2551,2273,2551,0,2024,1908};
int noteDurations[] = {4,8,8,4,4,4,4,4 };
int ledPin1 = D5;
int ledPin2 = D4;
int photoCellPin = A0;
int photoCellReading = 0;
int last_published = -1;
void setup() {
pinMode( speakerPin, OUTPUT );
pinMode(ledPin1, OUTPUT);
pinMode(ledPin2, OUTPUT);
Particle.variable("light", &photoCellReading, INT);
}
void loop() {
photoCellReading = analogRead(photoCellPin);
if(photoCellReading <2000 ){
digitalWrite(ledPin1, HIGH);
delay(100);
digitalWrite(ledPin1, LOW);
delay(100);
digitalWrite(ledPin2, HIGH);
delay(100);
digitalWrite(ledPin2, LOW);
delay(100);
digitalWrite(ledPin1, HIGH);
delay(100);
digitalWrite(ledPin1, LOW);
delay(100);
digitalWrite(ledPin2, HIGH);
delay(100);
digitalWrite(ledPin2, LOW);
delay(100);
digitalWrite(ledPin1, HIGH);
delay(100);
digitalWrite(ledPin1, LOW);
delay(100);
digitalWrite(ledPin2, HIGH);
delay(100);
digitalWrite(ledPin2, LOW);
delay(100);
digitalWrite(ledPin1, HIGH);
delay(100);
digitalWrite(ledPin1, LOW);
delay(100);
digitalWrite(ledPin2, HIGH);
delay(100);
digitalWrite(ledPin2, LOW);
delay(100);
digitalWrite(ledPin1, HIGH);
delay(100);
digitalWrite(ledPin1, LOW);
delay(100);
digitalWrite(ledPin2, HIGH);
delay(100);
digitalWrite(ledPin2, LOW);
delay(100);
playNotes();
}else{
digitalWrite(ledPin1, LOW );
digitalWrite(ledPin2, LOW );}
delay(2000);
}
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 log_to_spreadsheet( ){
// check if 1 minute has elapsed
if( last_published + 60000 < millis() ){
Particle.publish( "log_to_spreadsheet", String( photoCellReading ) );
last_published = millis();
}
}
Click to Expand
Couple things can be done for the next step:
1)give it a form: make it actually look nice and the size needs to be compact
2)extra reminder features: allow this device to send reminders via text or email as well
3)enable emergency response: if the plant does not get enough sunlight for a significant amount of time, call the owner to remind
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 12-hour monitor was then conducted. Interestingly, it was rare that when the light was not enough during the monitored time interval.
The only resource used was our class lab site:
https://diotlabs.daraghbyrne.me/docs/working-with-sensors/photoresistors/
A hands-on introductory course exploring the Internet of Things and connected product experiences.
Lightly is an easy-to-use and effective IOT device that is designed to save your plants from insufficient sunlight intakes.
November 6th, 2019