This project creates an automated plant watering system that combines:
- Arduino-compatible hardware (Grove board) running Firmata
- Java program using Firmata4j for communication
- Soil moisture sensing and water pump control
The system monitors soil moisture levels and automatically waters the plant when the soil becomes too dry, helping maintain optimal growing conditions.
- Real-time soil moisture monitoring
- Automated water pump control
- Data display on Grove OLED screen
- Java-based control system
- Event-driven architecture
- Testing and Debugging: Unit testing and voltage verification of soil moisture sensor
- API Implementation: Using Firmata4j to interface with Arduino hardware
- Data Collection: Using Java Collections (ArrayList/HashMap) for sensor data
- Event-Driven Programming: State machine implementation for watering logic
- Object-Oriented Design: Applying OOP principles in Java implementation
- Grove Beginner Kit for Arduino (or equivalent)
- Soil moisture sensor
- Water pump with tubing
- Water reservoir
- Plant with pot and soil
- Multimeter (for voltage testing)
- Java Development Kit (JDK)
- Firmata firmware on Arduino
- Firmata4j library
- Optional data visualization libraries (JFreeChart, Princeton StdLib)
- Upload StandardFirmata to your Arduino/Grove board
- Clone this repository
- Import required Java libraries
- Connect hardware components:
- Soil moisture sensor to analog pin
- Water pump to digital pin
- OLED display (if used)
- Download the Arduino IDE
- Connect the Grove board to your computer
- Open the Arduino IDE
- Go to
Tools > Boardand selectArduino Uno - Go to
File > Examples > Firmata > StandardFirmata - Compile and upload the sketch to your device
- Identify your Arduino port:
- Go to
Tools > Port - Note which ports are listed
- Disconnect the USB cable from your board
- Check
Tools > Portagain - the missing port is your Arduino - Reconnect the USB cable and verify the port reappears
- This is the port you'll use in Java
- Go to
- Create a new Java project with a main class
- Add required libraries via Maven:
<dependencies>
<!-- JSSC -->
<dependency>
<groupId>io.github.java-native</groupId>
<artifactId>jssc</artifactId>
<version>2.9.4</version>
</dependency>
<!-- Firmata4J -->
<dependency>
<groupId>com.github.kurbatov</groupId>
<artifactId>firmata4j</artifactId>
<version>2.3.8</version>
</dependency>
<!-- SLF4J -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jcl</artifactId>
<version>1.7.3</version>
</dependency>
</dependencies><dependencies>
<!-- Firmata4J -->
<dependency>
<groupId>com.github.kurbatov</groupId>
<artifactId>firmata4j</artifactId>
<version>2.3.8</version>
</dependency>
<!-- SLF4J -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jcl</artifactId>
<version>1.7.3</version>
</dependency>
</dependencies>Download Firmata4J v2.3.9 JAR and add to your project libraries.
- Programming Language: Java
- Hardware: Arduino (UNO or compatible), Grove Seed Board
- Development Tools: IntelliJ IDEA, Arduino IDE
- Libraries/Frameworks: Firmata4J, JSSC, SLF4J
- Run the Java application
- The system will:
- Continuously monitor soil moisture
- Display current status on OLED
- Activate pump when soil is dry
- Log sensor data for analysis
/src
/main
/java
PlantWateringSystem.java # Main control class
SensorMonitor.java # Handles sensor data
WaterPumpController.java # Manages pump operations
DataLogger.java # Handles data collection
/test
/java
SystemTests.java # Unit tests
/docs
report.pdf # Final project report
video.mp4 # Demonstration video
- Unit tests for critical functions
- Voltage measurements at different soil conditions:
- Dry soil: ~2V
- Wet soil: ~4V
- Graph of sensor values over time
- Project Example
- Firmata4j Documentation
- State Machine Guide
- James Andrew Smith, Associate Professor, Department of Electrical Engineering and Computer Science, Lassonde School of Engineering.
Copyright © 2025 Auhona Basu - For educational use at York University only. Not for distribution.
Solutions and Project by Auhona Basu
Note: This project is part of EECS 1021 coursework at York University. All work must be original and not generated by AI tools per course requirements. You are free to refer but do not copy. Thank You.