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 · UNLISTED (SHOWN IN POOLS)
This project is about an IoT plant monitoring device that encourages interaction with its owner.
The "lonely plan't" is an IoT plant interaction device, which encourages the owner to interact with the plant in order to maintain its health. In short, the device contains a soil moisture sensor. When the moisture is low, the device alerts the user in 2 ways: text and an illuminated blue light. In order to satisfy the plant, however, the owner must spend time with the plant. The first criteria is that the plant is in a well-lit area. Second, the owner could talk to the plant, play music for it, or other interactive activity that involves sound. This will trigger the device to water the plant. Once the plant is sufficiently watered, a green light will appear, indicating the plant is satisfied.
My thought from the beginning was to provide a way to measure the moisture content and then water the plant. However, I wanted to take this a step further. I initially thought of using a sound detector to process musical input. Being a musician myself, I thought this would be a good way to take care of the plant while also nudging me to practice my guitar. However, after a little more thought, I opened up the scope to include speaking to the plant as well. This also fits into the old wive's tale that speaking to a plant (in and of itself) helps the plant to be healthier.
In order to successfully implement my design, there were a few challenges. The biggest challenge was in sound detection. Using the SparkFun Sound Detector was my first choice, since it is able to detect the full sound wave. While this may have allowed for more functionality in my product, it was a little bit too advanced for my application. Really, I just needed to detect if sound was present. This led me to use and Electret Sound Detector, which is an On/Off detector, switching on when the sound elevates past a threshold.
I also decided to use a DIY moisture analyzer. This type of device was easy to construct: 2 metal screws, a wire attached to each via a heat-shrink wrap, and a spacer to keep the "leads" at a constant distance. The wiring for this sensor is then similar to most of the other resistive sensors. However, the sensitivity of this type of sensor is not very good. The range of detection between "dry" and "moist" is not very great, creating some problems when fine-tuning the code to work properly.
Workflow
List of parts
int ledBlue = D2;
int ledGreen = D3;
int micPin = D8;
int photoPin = A0;
int soilPin = A1;
int micReading = 0;
int photoReading = 0;
int soilReading = 0;
int soilReadingcomp = 0;
int last_published = -1;
void setup() {
pinMode(ledBlue, OUTPUT);
pinMode(ledGreen, OUTPUT);
pinMode(micPin, INPUT);
pinMode(photoPin, INPUT);
pinMode(soilPin, INPUT);
Particle.variable("photo", &photoReading, INT);
Particle.variable("soil", &soilReading, INT);
}
void loop() {
micReading = digitalRead(micPin);
photoReading = analogRead(photoPin);
soilReading = analogRead(soilPin);
soilReadingcomp = abs( 2800 - soilReading );
if (soilReadingcomp < 100 ){ // soil sensor has a lot of noise, so trying to code in some separation around threshold
soilReading = soilReading - 200;
}
if ( soilReading < 2800 ){ //if soil moisture is low, turn on blue light
digitalWrite(ledBlue, HIGH);
digitalWrite(ledGreen, LOW);
soilReading = analogRead(soilPin);
com_soil_reading(soilReading); //communicate low moisture reading - log and email
if (photoReading > 3700 && micReading == LOW){
//if light is bright and sound is coming in, blink blue light to represent water flowing
for (int i=0; i<10; i++){
digitalWrite(ledBlue, HIGH);
delay (500);
digitalWrite(ledBlue, LOW);
delay (500);
}
}
} else { //all is well, so let user know everything is OK with green light
digitalWrite(ledGreen, HIGH);
digitalWrite(ledBlue, LOW);
delay (1000);
}
}
void com_soil_reading( int sensorValue ){
// check if 1 minute has elapsed
if( last_published + 60000 < millis() ){
Particle.publish( "com_soil_reading", String( sensorValue ) );
last_published = millis();
}
}
Click to Expand
I would love to provide form to this project. It would also be interesting to understand how different types of plants need to be watered differently. I could set up an interface for the user to select what type of plant they have and it would monitor the soil moisture appropriate for their selection.
Sample Code for Sound Detector: https://tinkersphere.com/sensors/919-microphone-sound-detector-arduino-compatible.html
Soil Moisture Sensor: https://www.instructables.com/id/DIY-SOIL-MOISTURE-SENSOR-CHEAP-YET-ACCURATE-/
This project is only listed in this pool. Be considerate and think twice before sharing.
A hands-on introductory course exploring the Internet of Things and connected product experiences.
This project is about an IoT plant monitoring device that encourages interaction with its owner.
November 1st, 2019