Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino Uno-Based Soil and pH Monitoring System with OLED Display

View and Edit Project In Cirkit DesignerImage of Arduino Uno-Based Soil and pH Monitoring System with OLED Display

Circuit Documentation

Summary

This circuit is designed to monitor pH levels and soil moisture using an Arduino Uno R3. The data from the sensors is displayed on a 0.96" OLED screen. The circuit includes a pH meter, a soil moisture sensor, and an OLED display, all connected to the Arduino Uno R3.

Component List

  1. Arduino Uno R3

    • Description: A microcontroller board based on the ATmega328P.
    • Pins: D8, D9, D10, D11, D12, D13, GND, AREF, SDA, SCL, D0/RX, D1/Tx, D2, D3, D4, D5, 6, D7, A5/SCL, A4/SDA, A3, A2, A1, A0, Vin, 5V, 3.3V, RESET, IOREF, NONE, USB Jack, Power Jack
  2. PH Meter

    • Description: A sensor used to measure the pH level of a solution.
    • Pins: Signal, VCC, GND
  3. Soil Moisture Sensor

    • Description: A sensor used to measure the moisture content in the soil.
    • Pins: VCC, GND, SIG
  4. 0.96" OLED

    • Description: A small OLED display used to show sensor readings.
    • Pins: GND, VDD, SCK, SDA

Wiring Details

Arduino Uno R3

PH Meter

Soil Moisture Sensor

0.96" OLED

Code Documentation

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

// Inisialisasi OLED (alamat I2C default: 0x3C)
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);

// Pin untuk sensor
const int pH_Pin = A0;
const int Soil_Pin = A1;

void setup() {
  // Inisialisasi Serial Monitor
  Serial.begin(9600);

  // Inisialisasi OLED
  if (!display.begin(SSD1306_I2C_ADDRESS, 0x3C)) {
    Serial.println(F("OLED tidak ditemukan, periksa koneksi!"));
    for (;;);
  }
  display.clearDisplay();
  display.setTextSize(1);
  display.setTextColor(SSD1306_WHITE);

  // Tampilkan pesan awal
  display.setCursor(0, 0);
  display.println("Inisialisasi...");
  display.display();
  delay(2000);
}

void loop() {
  // Baca data dari sensor
  float pH_Value = analogRead(pH_Pin) * (5.0 / 1023.0); // Konversi ADC ke tegangan
  int Soil_Value = analogRead(Soil_Pin); // Nilai kelembapan tanah

  // Tampilkan data di Serial Monitor
  Serial.print("pH: ");
  Serial.println(pH_Value);
  Serial.print("Soil Moisture: ");
  Serial.println(Soil_Value);

  // Tampilkan data di OLED
  display.clearDisplay();
  display.setCursor(0, 0);
  display.println("Sensor Readings:");
  display.setCursor(0, 15);
  display.print("pH: ");
  display.println(pH_Value);
  display.setCursor(0, 30);
  display.print("Soil: ");
  display.println(Soil_Value);
  display.display();

  delay(1000);
}

This code initializes the OLED display and reads data from the pH meter and soil moisture sensor. The sensor readings are displayed on both the Serial Monitor and the OLED display.