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

Arduino Mega 2560-Based Automatic Filling Device with Humidity, Temperature, and Water Level Monitoring

View and Edit Project In Cirkit DesignerImage of Arduino Mega 2560-Based Automatic Filling Device with Humidity, Temperature, and Water Level Monitoring

Circuit Documentation

Summary

This circuit is an automatic filling device that controls a fan, compressor, and monitors humidity, water level, and temperature. The fan speed is adjusted based on humidity levels, the compressor is controlled via a relay module, and the water level is monitored using a capacitive sensor. The system is powered by a solar panel and battery setup, with an MPPT charge controller and a solar inverter for DC to AC conversion.

Component List

  1. Arduino Mega 2560

    • Description: Microcontroller board based on the ATmega2560.
    • Pins: IOREF, RESET, 3V3, 5V, GND, VIN, A0-A15, D0-D53, AREF, SDA, SCL.
  2. Capacitive Sensor

    • Description: Sensor to measure water level.
    • Pins: GND, VCC, SIGNAL.
  3. Temperature Sensor

    • Description: Sensor to measure temperature.
    • Pins: Temp GND Black, Temp VDD Red, Temp DQ Data Yellow.
  4. Humiture Sensor

    • Description: Sensor to measure humidity.
    • Pins: SIG, VCC, GND.
  5. PC Fan

    • Description: Fan for cooling purposes.
    • Pins: 12V, GND, PWM.
  6. PWM Motor Speed Controller

    • Description: Controller to adjust motor speed using PWM.
    • Pins: Motor+, Motor-, Power-, Power+, PWM.
  7. 2ch Relay

    • Description: Relay module to control high-power devices.
    • Pins: NC, COM, NO, VCC, IN2, IN1, GND.
  8. Solar Panel 380W

    • Description: Solar panel to generate electricity.
    • Pins: -, +.
  9. MPPT SCC

    • Description: Maximum Power Point Tracking Solar Charge Controller.
    • Pins: SOLAR+, SOLAR-, BATTERY+, BATTERY-, LOAD+, LOAD-.
  10. 12V 200Ah Battery

    • Description: Battery to store energy.
    • Pins: GND, 12V.
  11. Solar Inverter DC TO AC

    • Description: Inverter to convert DC to AC.
    • Pins: SOLAR +, Solar -, OUT -, OUT +, Battery +, Battery -.

Wiring Details

Arduino Mega 2560

Capacitive Sensor

Temperature Sensor

Humiture Sensor

PC Fan

PWM Motor Speed Controller

2ch Relay

Solar Panel 380W

MPPT SCC

12V 200Ah Battery

Solar Inverter DC TO AC

Code Documentation

/*
 * Automatic Filling Device
 * This code controls a fan, compressor, and monitors humidity, water level,
 * and temperature. The fan speed is adjusted based on humidity levels. The
 * compressor is controlled via a relay module, and the water level is monitored
 * using a capacitive sensor.
 */

#include <DHT.h>

#define HUMIDITY_SENSOR_PIN A0
#define CAPACITIVE_SENSOR_PIN A1
#define TEMP_SENSOR_PIN A2
#define FAN_PWM_PIN 3
#define RELAY_PIN 4

DHT dht(HUMIDITY_SENSOR_PIN, DHT11);

void setup() {
  Serial.begin(9600);
  dht.begin();
  pinMode(CAPACITIVE_SENSOR_PIN, INPUT);
  pinMode(TEMP_SENSOR_PIN, INPUT);
  pinMode(FAN_PWM_PIN, OUTPUT);
  pinMode(RELAY_PIN, OUTPUT);
}

void loop() {
  float humidity = dht.readHumidity();
  int waterLevel = analogRead(CAPACITIVE_SENSOR_PIN);
  int temperature = analogRead(TEMP_SENSOR_PIN);

  Serial.print("Humidity: ");
  Serial.print(humidity);
  Serial.print("%\tWater Level: ");
  Serial.print(waterLevel);
  Serial.print("%\tTemperature: ");
  Serial.print(temperature);
  Serial.println("C");

  // Control fan speed based on humidity
  int fanSpeed = map(humidity, 0, 100, 255, 0);
  analogWrite(FAN_PWM_PIN, fanSpeed);

  // Control compressor based on water level
  if (waterLevel > 500) { // Threshold for water level
    digitalWrite(RELAY_PIN, HIGH); // Turn on compressor
  } else {
    digitalWrite(RELAY_PIN, LOW); // Turn off compressor
  }

  delay(2000); // Wait for 2 seconds before next reading
}

This code initializes the sensors and actuators, reads the sensor values, and controls the fan speed and compressor based on the humidity and water level readings. The data is also printed to the serial monitor for debugging and monitoring purposes.