Back to Parent

Outcome


Approach

When I approached the problem, I realized that a plant's ability to survive is dependent on how the owner takes care of the plant and also the environmental conditions within the house. Water is a basic and necessary component to any plant survival, so I decided that a soil moisture sensor is a must. Next, I noticed that many cats like to knock over plants for fun. In the environment of a home, they are an enemy for the plant. If the pot is tipped over, then it might not be able to absorb as much sunlight as it does in its original upright position. 

Solution

The solution is in two folds: 

1)  Implement a tilt switch sensor to detect when the plant is knocked over. When a new orientation of the pot is detected, a red LED light will turn on. For cat owners, they may suspect that their cat knocks over the plant multiple times while they are not home. By logging whenever the pot is tilted in a Google spreadsheet, the owner can have more insight into whether their cat misbehaved, and how many treats it deserves. 

2) Implement a soil moisture sensor to monitor whether the plant has water. If there is water detected in the soil, a green LED light will turn on.

Process

In order to build my solution, I decided to incorporate 2 sensors: a Soil Moisture Sensor HL-69 and a Tilt Sensor AT407. Since I have never worked with these two sensors before, it was necessary to do some research to learn they work in practice and in code.  

I reviewed different code samples of how the 2 sensors worked. Then, I incorporated and combined snippets of code I found (in resources below) into my own code, to execute my desired actions. It was challenging to decide which snippets of code to incorporate, since I had to look up every syntax to understand what the code is doing first.

In the beginning, I didn't have a systematic way to format my code, so whenever my code did not work it was hard to troubleshoot. To make sure I could narrow down on what was not working in my code, I decided to write a pseudo code first. Then, every time an action executed successfully I checked it off and moved in. This helped me troubleshoot much faster. 

After I was able to get the code and circuit board working, I logged every time the plant was tilted on Google Spreadsheet through IFTTT.

Implementation

List of parts used: 

  • Particle Argon
  • AT 404 Tilt Sensor
  • Moisture Sensor YL-69
  • Red LED
  • Green LED
  • 2 of 1k-ohm resistors
  • 1 of 10k-ohm resistor
  • a cup of water (for testing)

Show Advanced Options
Img 7264
Show Advanced Options
Internet of plants
Show Advanced Options
Show Advanced Options
Screenshot of events 1 google sheet
Show Advanced Options

Next Steps

For the next step, I would like add more sensors to better protect the plant against a household cat. I suspect that the one sensor I have incorporated specifically to defend against a cat (a tilt sensor) is not enough for this purpose. For example, maybe the cat needs to hear a scary sound to be discouraged from approaching the plant. 

Reflection

I am new to coding and working with hardware. This project allowed me to learn how to navigate components I am unfamiliar with, complete a circuit, and practice writing code. Before this project, I did not even know how to structure my code (e.g. set up variables and functions). 

Reading sample codes and dissecting what each line does was immensely helpful for developing the logic and language to put together my own code. 

References

  • I learned how to work with the Soil Moisture Sensor from the sample code in Random Nerd Tutorials.  
  • I learned how to work with the tilt sensor from the sample code in Github.
  • I used Arduino language reference to learn what different syntax means in the above tutorials, as well as understand how I can create loops where I have multiple variables. 


Drop files here or click to select

You can upload files of up to 20MB using this form.