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

Arduino Mega 2560 Hydroponic System with Solar Power and Sensor Monitoring

View and Edit Project In Cirkit DesignerImage of Arduino Mega 2560 Hydroponic System with Solar Power and Sensor Monitoring

Hydroponic System Circuit Documentation

Summary

This document provides a detailed overview of a hydroponic system circuit. The system includes various sensors to monitor temperature, dissolved oxygen (DO), electrical conductivity (EC), and pH levels. The data from these sensors is displayed on an OLED screen, and a water pump is controlled via a relay. The system is powered by a solar panel and a 12V battery, managed by a solar charge controller. An Arduino Mega 2560 microcontroller is used to read sensor data and control the relay.

Component List

  1. Solar Panel

    • Description: Converts sunlight into electrical energy.
    • Pins: +, -
  2. 12V 200Ah Battery

    • Description: Stores electrical energy for the system.
    • Pins: GND, 12V
  3. 12V Single Channel Relay

    • Description: Controls the water pump.
    • Pins: NC, COM, NO, IN, GND, VCC
  4. Solar Charge Controller

    • Description: Manages the charging of the battery from the solar panel.
    • Pins: Solar Cell +, Solar Cell -, Battery +, Battery -, Load +, Load -
  5. Arduino Mega 2560

    • Description: Microcontroller used to read sensor data and control the relay.
    • Pins: IOREF, RESET, 3V3, 5V, GND, VIN, A0-A15, D0-D53, SDA, SCL, AREF
  6. DFRobot EC Sensor

    • Description: Measures electrical conductivity of the water.
    • Pins: -, +, A
  7. DFRobot Dissolved Oxygen Sensor

    • Description: Measures dissolved oxygen levels in the water.
    • Pins: -, +, A
  8. pH Degree Sensor Module

    • Description: Measures the pH level of the water.
    • Pins: pH Negative, pH Positive, pH A
  9. Water Pump

    • Description: Pumps water in the hydroponic system.
    • Pins: VCC, GND
  10. MKE-S15 DS18B20 Waterproof Temperature Sensor

    • Description: Measures the temperature of the water.
    • Pins: SIG, 5V, GND
  11. Resistor

    • Description: Used in the temperature sensor circuit.
    • Pins: pin1, pin2
    • Properties: 4700 Ohms
  12. 128x64 OLED Display (I2C IIC SPI Serial)

    • Description: Displays sensor readings.
    • Pins: GND, SDA, SCL, VCC

Wiring Details

Solar Panel

12V 200Ah Battery

12V Single Channel Relay

Solar Charge Controller

Arduino Mega 2560

DFRobot EC Sensor

DFRobot Dissolved Oxygen Sensor

pH Degree Sensor Module

Water Pump

MKE-S15 DS18B20 Waterproof Temperature Sensor

Resistor

128x64 OLED Display (I2C IIC SPI Serial)

Code Documentation

/*
 * Arduino Sketch for Hydroponic System
 * This code reads data from temperature, dissolved oxygen (DO), electrical
 * conductivity (EC), and pH sensors, and displays the readings on an LCD
 * screen. The water pump is controlled via a relay.
 */

#include <LiquidCrystal.h>

// Pin definitions
const int tempPin = 53; // Connected via resistor
const int doPin = A6;
const int ecPin = A7;
const int phPin = A5;
const int relayPin = 22;
const int lcdRs = 12, lcdEn = 11, lcdD4 = 5, lcdD5 = 4, lcdD6 = 3, lcdD7 = 2;

// Initialize the LCD library with the numbers of the interface pins
LiquidCrystal lcd(lcdRs, lcdEn, lcdD4, lcdD5, lcdD6, lcdD7);

void setup() {
  // Initialize serial communication
  Serial.begin(9600);
  // Initialize the LCD
  lcd.begin(16, 2);
  // Print a message to the LCD
  lcd.print("Hydroponic System");
  // Set relay pin as output
  pinMode(relayPin, OUTPUT);
  // Turn off the relay initially
  digitalWrite(relayPin, LOW);
}

void loop() {
  // Read sensor values
  int tempValue = analogRead(tempPin);
  int doValue = analogRead(doPin);
  int ecValue = analogRead(ecPin);
  int phValue = analogRead(phPin);

  // Check for sensor read errors
  if (tempValue == -1 || doValue