When deciding what to do for this project, I tried to think of small problems in my life that I could possibly tackle with an embedded system. While it has definitely been done before, I've always wanted to make an automatic plant watering system because I am terrible at keeping plants alive. During the peak of the pandemic, I got really into the idea of doing a room re-vamp. This manifested as doing some DIY pot decoration and buying about 10 plants from home depot that proceeded to die within the next few weeks. My bedroom at home is a graveyard of dead and dying plants, and unfortunately I brought my reverse green thumb with my to Rice. I've had a string of plants that all seem to shrivel up and die immediately after entering my care, to the point where I've completely switched over to fake plastic plants.
I decided to create the Pocket Plant to enable me to keep my plants alive while on a busy college student schedule. I thought about the obstacles that prevent me from being a good plant mom, and tried to include those in my project. These challenges are as follows:
1. Watering: I struggle enough with remembering to fill up a water bottle for myself when I'm getting ready, so there's very little chance I'll remember to water my plants. And if I do remember, chances are I'll drown my plant. Additionally, I don't always have the tools to transport water from my sink to the plant.
2.Light Conditions: Plants need light (duh). However, the lighting situation in my dorm room, and I'd assume dorm rooms in general, are not always conducive to plant health. I have no way of knowing whether by plant is getting enough light or not, except when it dies.
3.Sustainably Harvesting (Herbs): I've been into the idea of an indoor herb garden for a while, but don't have a good way of knowing if I'm taking too much from my plants too soon.
With these three challenges in mind, I brainstormed how to customize my plant waterer to my needs, and improve upon existing solutions. Some elements of existing solutions I found were monitoring moisture level, monitoring light, automated watering, and text message reminders to water. Not all existing solutions had all of these, and none completely addressed the challenges I identified, so I decided to combine some of these features as well as add some of my own.
I came up with the following features I hope to implement:
- automatic watering
- light and moisture monitoring
- LCD display for data regarding watering (tank fullness, number of times watered), current moisture and light status, recording of number of harvests
- joystick to interface with display
- automatic light quality adjustment with tr-color LED
Due to challenges getting my project up and running and time constraints, I decided to modify my desired features slightly to make them more feasible to implement. Rather than an LCD to convey the desired information, I plant to use an 7 segment display (HT16K33) to show the number of harvests, incremented by a button rather than a joystick. To show light and water status, I plan to use a red and green LED.
These block diagrams were created for my original project plan, so they have changed slightly in my final implementation. In the block diagram, instead of a tri-color LED, I have a red and green LED. Instead of the joystick, I have a button, and the display is an HT13K33 seven segment display instead of the HD44780 LCD display. The power block diagram is slightly different as well. The green and red LEDs are 3.3 volt, as is the pump, button, and new display.
HardwareFor reference, this is the pocketbeagle pinout diagram:
ButtonWiring:
To wire the button, place it across the center of the breadboard. Connect one leg to ground, as shown by the grey wire. Connect the other to P2_02 (a gpio pin), shown by the yellow wire. In the same row as the connection to the pocketbeagle, connect the button to power with a 10K Ohm resisitor.
LEDWiring:
For each LED, connect the short leg to ground (grey wire) and long leg to the pocketbeagle. The red LED is connected to P2_6, and the green LED is connected to P2_4.
LightSensorWiring:
First, solder the headers onto the sensor. I made a simple jig using spare headers and a solderless breadboard to keep the sensor in place while soldering.
For wiring the light sensor, connect the first pin to power (red wire) and the second pin to ground (blue wire). The third pin is the SCL, which goes to P1_28 on the pocketbeagle (purple wire). The last pin is the SDA, which goes to P1_26 on the pocketbeagle (white wire).
MoistureSensorWiring:
Connect GND to ground (black wire), VCC to power (red wire), and AOUT to P1_21
PumpWiring:
Wiring the pump involves connecting it to the pocketbeagle through a relay. connect the power of the pump (thin red wire) to NO on the relay, and the ground of the pump (thin black wire) to COM on the relay. Connect DC+ to power (thick red wire), and DC- to ground (thick black wire). Lastly, connect IN to P2_35 (green wire).
HT16K33Wiring
Connect the first pin to power, and the second pin to ground. Connect D to P2_11 (purple wire). Also connect D to power through a 10K Ohm pull-up resistor. Connect C to P2_9 (white wire). Also connect C to power through a 10K Ohm pull-up resistor.
FullyWired Project
Setting up the hardware with a plant
To integrate the components of the project with an actual plant, future work would include creating an electronics box to house the majority of the wiring while displaying the user interface (status LEDs, display, and button). The soil sensor can be placed directly into the soil, while the light sensor can be mounted higher up as to get a better reading of the light quality. The pump will be placed in a tank, with a removable lid for easy re-fill. The electronics box could easily be laser-cut, while the tank would likely be a modification of an existing container with the necessary holes for wiring and tubing. The light sensor could be mounted in the correct orientation and location with a 3D printed part.
SoftwareFor the software, I created code for each hardware component that contain the functions necessary, and then combined what I needed to implement my main code. More detail about my software can be found in the README in my github repository.
SoftwareBlockDiagram
Since creating my software block diagram in the planning phase of this project, I have modified my objectives and methods. Mainly, the functionality of the display is now split between a lower resolution seven segment display and red and green LEDs. Additionally, I am currently not trying to implement the Tri-color LED, and am instead planning to just convey light quality through the LEDs and light sensor. The updated functionality is outlined below.
Setting up:
- wire up the components as discussed in the hardware section
- follow the instructions on the README in my github repository
Operation:
- If the program is set up to run on boot, it should start up when the pocketbeagle is connected to power. Otherwise, run the main program.
- On startup, the user can set the threshold values for light and water, as different plants have different lighting needs. To do this, press and hold the button. "H20" should appear on the display, and by clicking the button, the user can toggle between "lo", "med" and "hi" water needs.
- Pressing and holding the button again will set the water threshold, and display "lite", to indicate that the user can set the light threshold. Again, the user can toggle through "lo", "med", and "hi", then press and hold to set.
- After thresholds have been set, Pocket Plant goes into monitoring mode.
- If the soil moisture dips below the set threshold, the pump turns on and the red led flashes until the moisture level is above the threshold.
- If the light level goes below the threshold, the green led will turn off and the red led will turn on. Once the light level is above the threshold, the green led will turn on and the red led will turn off.
- To record harvests, press the button. The display will increase by one for each button press.
Unfortunately I did not have enough time to test and debug with all the components, so the code is not fully functional yet. Future work would include fully debugging the code to get things fully up and running. At it's current state, there is a good framework for the code to meet my updated objectives for the project. I have created drivers for all the components (pump, moisture sensor, light sensor, button, ht16k33), as well as a main file to run the project. For the main code, I have all the functions I thought would be needed, as well as a run function. The run function attempts to monitor as well as take user input to set the water and light threshold. I didn't have enough time to get this up and running with all the components, but I was able to make a solid attempt at it.
On this current iteration of the project, other future work would include making the actual hardware to enclose the electronics and improve the user experience.
To check that everything was wired correctly, I ran the code for individual components, like the LEDs, and made sure they worked.
To make more upgrades to my project, I would try to implement my initial plan. This would include bringing back the more complicated display and joystick, as well as not only monitoring light, but providing it as well.
Comments
Please log in or sign up to comment.