In the beginning of this semester, I got my first personal plant. As I got busier during the semester, I found myself forgetting to water and care for the plant, and as a result it began to wither. To remind myself when to care for it, I decided to make this plant care device.
Description & Video
The device takes in temperature and humidity readings from the plant's environment and a moisture sensor is used to monitor the amount of water in the soil. These three metrics are displayed on an LCD screen. Once the moisture level reaches below a specific percentage, the buzzer will play a song each minute to remind the user to add water. The percentage level depends on the plant. For testing purposes, I used 70% as the threshold.
Getting Started With Pocket Beagle for This Project
1. Set up the Pocketbeagle by downloading Etcher (https://etcher.io/), then follow the directions below
a. Download the image file “bone-debian-10.11-iot-armhf-2022-02-03-4gb.img.xz” from the following link https://rcn-ee.com/rootfs/bb.org/testing/2022-02-03/buster-iot/
2. Using the following site, connect the PocketBeagle to the internet https://ofitselfso.com/BeagleNotes/HowToConnectPocketBeagleToTheInternetViaUSB.php
3. Use the following commands to download and update appropriate libraries necessary for this project.
a. sudo apt-get update3
b. sudo apt-get update3. sudo apt-get install build-essential python-dev python-setuptools python-smbus -y
c. sudo pip3 install --upgrade Adafruit_BBIO
Now, on putting the hardware together.
Putting Together the Electronics
LCDDisplay
I started by connecting the 16x2 LCD screen to the Pocketbeagle. I wired it with the following configuration:
Once wired, I ran the LCD test driver to ensure connection was correct. Typically, LCD displays will have 16 pins, but this one has 18. The last 3 pins all are for backlights but each of them provide different colors. Functionally, they do the same thing.
Potentiometer
I wired the potentiometer with the following configuration:
Once wired, I tested it by running the potentiometer.py file. The resistor was added in order to reduce the voltage through the potentiometer to reach the full range of its effect.
MoistureSensor
I wired the moisture sensor with the following configuration.
Once wired, I tested it by running moisture_sensor.py.
Temperature& Humidity Sensor
I wired the temperature and humidity sensor using the following configuration:
Once wired, I tested it using the temphum_sensor.py file.
Buzzer
I wired the buzzer using the following configuration:
Once wired, I tested it using the buzzer driver file.
The power supply can get confusing, but the resistors are necessary for the moisture sensor and potentiometer to send a full range of data to the PocketBeagle at the available voltage outputs. Once all of the hardware components were working and connected, I implemented the code that can be found in the linked github directory, and voila!
However, I was not completely done. The last step was to make the program run on bootup. I created a folder "logs" and a cronlog file, then, using the command sudo crontab -e, I edited the cron with the following line of code:
@reboot sleep 30 && bash /var/lib/cloud9/ENGI301/python/plant_care_device/run > /var/lib/cloud9/logs/cronlog 2>&1
At first, I had the above line, with
@reboot sleep 30 && sh /var/lib/cloud9/ENGI301/python/plant_care_device/run > /var/lib/cloud9/logs/cronlog 2>&1
However, this was not able to run on bootup because the run file had the line #!/bin/bash, which uses the bash shell, so I needed to run the file with the bash shell instead of sh.
Now, the project runs 30 seconds after the PocketBeagle boots up, and I'm done!
Future Plans
This project is completely functional as of now, but there are some aesthetic and feature upgrades that can be added to it in the future. The first would be a box to cover the wiring and electronics inside to give it a better look. There could also be a feature where it sends a text notification instead of playing a song to remind me to water the plant. Finally, I could upload the moisture data to an excel sheet or website where I can graph the behavior of the environment over time.
Hope you all enjoy!
Comments