This project was developed for EDES 301: Introduction to Practical Electrical Engineering at Rice University.
As described in this post, I designed and built a PocketBeagle-based plant conditions monitor that measures environmental conditions such as soil moisture and temperature, displays them on an LCD screen, and provides visual feedback through LEDs. The system is designed to help prevent common plant-care mistakes, such as overwatering or neglect, which I have been guilty of in the past. I wanted to find a way to keep track of and improve the conditions of my plant before it withers and dies.
Device OverviewThis is an embedded system designed to help users maintain healthy houseplants by continuously monitoring environmental conditions. Using a PocketBeagle microcontroller, the device measures soil moisture and temperature, displays real-time data on an LCD screen, and provides visual feedback through LEDs. A button-controlled interface allows users to cycle through display modes. The device runs on auto-boot and is designed as a practical and simple application of embedded systems and electrical engineering concepts.
For my system, soil moisture is measured as a percentage and I've established this condition into four categories: Soil Wet (≥70%), Optimal (40–69%), Dry (20–39%), and Very Dry (<20%). Temperature is monitored in degree Celsius to ensure safe operating conditions and provide environmental context, helping me understand how heat may affect soil dryness / plant health.
HardwareFor my project I used a PocketBeagle as the microcontroller. Below is its pinout diagram.
All PocketBeagle pins (P1 and P2) to component pins (either on component or on breadboard) is captured below for easy reference. These pins were decided on what PocketBeagle were responsive when I was testing my system.
I began this project by first connecting 3.3 V from the PB (P1_14) to the positive power rail of my breadboard. I also connected GND from PB (P1_15) to the negative power rail. This was so all sensors, LEDs, button, potentiometer and other components could share a common ground and all be supplied 3.3 V.
LCD Screen(HD44780, 16x2)
I wired the LCD screen to the PB using the connections shown in Fig. 2. I wired in 4-bit mode using GPIO pins: RS, Enable (E), and data lines (D4-D7) connected to PB GPIO (P2_24, P2_22, P2_18, P2_20, P2_17, P2_10). Then I connected BLK, RW and ground pins to ground (ground bread board rail). A potentiometer was used on the VO pin to control contrast. The LCD screen itself (VDD) was powered using 5 V (the 5 V from USB, P1_5). Additionally, the backlight (BLA) was connected to 5 V using a 220 ohm resistor.
I used a potentiometer as a voltage divider to control the LCD contrast, with the middle pin connected to the LCD’s VO pin, one side tied to 3.3 V, and the other to ground. I then manually adjusted the contrast by turning the pot, while the LCD was powered using my PC. The wiring resembles Fig. 3 below (note that wiring changed after this iteration due to unresponsive preliminary pin connections, however image was inserted for visual aid).
Soil Moisture Sensor (STEMMA I2C)
Referencing Fig. 2 and using the accompanying JST PH 2mm 4-pin to male header cable, I connected the sensor SDA to P1_26 and the SCL to P1_28. GND was connected to ground and VIN was connected to the 3.3 V power rail. These connections can be shown below in Fig. 4.
The soil moisture sensor communicates with the I2C bus 2 (address 0x36) on the PB in my device.
Temperature Sensor (BMP280)
Using male-to-male jumper wires, I connected SDA to P2_11, SCL to P2_09, GND and SDO to ground and VCC to 3.3 V. The temp. sensor communicates with I2C bus 1 (address 0x76). I originally, intended on using a BME280 temperature and humidity sensor, but BMP280s (temperature and pressure) were the only sensors available after I fried my original BME280.
LEDs
Each LED used a 220 ohms resistor in series with the anode (long leg). Then, from the resistor, the red LED was connected to P2_19, yellow LED to P2_25 Green LED to P2_29. The cathodes (short leg) of the LEDs were grounded. The wiring is illustrated below in Fig. 5.
Button
Using male-to-male jumper wires, I wired a momentary pushbutton in a pull-down configuration. One terminal of the button was connected to P2_27 (GPIO input), while the opposite terminal was connected to the 3.3 V rail. The same GPIO node (P2_27) was tied to ground through a 10 Kohms pull-down resistor to ensure a defined LOW state when the button was not pressed. When pressed, the button drives P2_27 HIGH, allowing the PocketBeagle to detect a clean rising-edge input for screen toggling.
CodeTo functionalize the system, I wrote python drivers for the LCD, soil moisture sensor, BMP280, LEDs, and button. A main driver then reads soil moisture, computes status + dryness level (using simple calculator), updates LEDs (moisture-based), reads temperature and updates LCD screen. The button code was written to allow for switching/cycling between 4 display screens:
- Screen 0 - shows soil moisture percentage and overall status.
- Screen 1 - displays a simplified dryness level and status.
- Screen 2 - provides a brief project title and user prompt to press for the next screen.
- Screen 3 - shows temperature alongside soil moisture for combined monitoring.
I first configured the PocketBeagle pins using a custom configure_pins.sh script to set all GPIO, I2C, and peripheral pins into the correct modes at startup. I then created a run.sh script that changes into the project directory, runs the pin configuration, waits for power and I2C devices to stabilize, and then launches the main python progra. Finally, I enabled auto-boot by creating a systemd service that calls run.sh on startup, ensuring the plant monitor runs automatically whenever the PocketBeagle is powered on (using 5-volt USB charging adapter) without requiring a computer connection. Alternatively, you could set up auto-boot using logs and a cronlog file and using the command sudo crontab -e to edit the cron.
ImplementationSimply power the device by connecting the PocketBeagle to 5V using a Micro USB to USB-A cable and 5-volt USB charging adapter. After 30 seconds, the device will start up and perform as shown in the video below.
Future worksThere is a lot of room for improvement, including remedying the LCD’s electrical stability and initialization to eliminate occasional display glitches after long hours of operation. I would also like to add a joystick input to replace the single button, allowing smoother and more intuitive navigation between screens. Expanding the sensor suite to include humidity, ambient light, and additional temperature probes would also provide a more complete picture of plant health. With an addition of a Wi-Fi module, the system could send real-time alerts or notifications to a phone when conditions become unfavourable. Finally, I would laser-cut or 3D-print an enclosure to improve durability, organization, and overall presentation of the device.












_3u05Tpwasz.png?auto=compress%2Cformat&w=40&h=40&fit=fillmax&bg=fff&dpr=2)
Comments