This Java application reads moisture levels from a sensor and controls a water pump based on those readings. It also displays the moisture level on an OLED screen and plots the data over time using StdDraw
.
- Moisture Sensing: Continuously reads moisture levels from a connected sensor.
- Water Pump Control: Activates a water pump based on moisture levels.
- Data Visualization: Plots moisture levels over time using
StdDraw
. - OLED Display: Shows real-time moisture levels and status messages on an OLED display.
- Java: Ensure you have Java installed on your system.
- Libraries:
- Firmata4j: For communication with the Arduino board.
- StdDraw: For plotting the moisture levels.
- JSSC: For serial communication (Windows users).
- Hardware:
- Arduino board
- Moisture sensor
- Water pump
- OLED display
-
Connect Hardware:
- Connect the moisture sensor to the analog pin (Pin 14).
- Connect the water pump to the digital output pin (Pin 2).
- Connect the OLED display via I2C.
-
Configure the Port:
- Update the
myPort
variable in the code with the correct port name for your Arduino board (e.g.,COM3
for Windows or/dev/ttyUSB0
for Linux). - Update the Hardware pins or addresses for your Arduino Circuit/Board.
- Update the
- Connection Issues: Ensure the correct port is specified and that all hardware is properly connected.
- Library Issues: Verify that all required libraries are included in the classpath.
- Grove Beginner Kit Manual: User Manual
- Firmata Intro: Intro
- I2C & Firmata Example: Example