Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Project Documentation

Arduino-Based Smart Clothes Drying Stand with Rain Sensor and LCD Display

Image of Arduino-Based Smart Clothes Drying Stand with Rain Sensor and LCD Display

Circuit Documentation

Summary

This circuit is designed to monitor rain using a rain sensor and control a servo motor to retract or extend a stand based on the rain detection. The status and rain sensor readings are displayed on a 16x2 I2C LCD. The circuit is controlled by an Arduino UNO microcontroller.

Component List

  1. RAIN SENSOR

    • Description: Detects the presence of rain.
    • Pins: AO, DO, GRD, VCC
  2. 16x2 I2C LCD

    • Description: Displays text information.
    • Pins: GND, VCC, SDA, SCL
  3. Arduino UNO

    • Description: Microcontroller board used to control the circuit.
    • Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
  4. Servo

    • Description: Motor used to retract or extend the stand.
    • Pins: GND, VCC, PWM

Wiring Details

RAIN SENSOR

  • AO: Connected to Arduino UNO A0
  • DO: Connected to Arduino UNO D2
  • GRD: Connected to Arduino UNO GND
  • VCC: Connected to Arduino UNO 5V, 16x2 I2C LCD VCC, and Servo VCC

16x2 I2C LCD

  • GND: Connected to Arduino UNO GND
  • VCC: Connected to Arduino UNO 5V, RAIN SENSOR VCC, and Servo VCC
  • SDA: Connected to Arduino UNO A1
  • SCL: Connected to Arduino UNO A2

Arduino UNO

  • A0: Connected to RAIN SENSOR AO
  • D2: Connected to RAIN SENSOR DO
  • GND: Connected to RAIN SENSOR GRD, 16x2 I2C LCD GND, and Servo GND
  • 5V: Connected to RAIN SENSOR VCC, 16x2 I2C LCD VCC, and Servo VCC
  • A1: Connected to 16x2 I2C LCD SDA
  • A2: Connected to 16x2 I2C LCD SCL
  • D9: Connected to Servo PWM

Servo

  • GND: Connected to Arduino UNO GND
  • VCC: Connected to Arduino UNO 5V, RAIN SENSOR VCC, and 16x2 I2C LCD VCC
  • PWM: Connected to Arduino UNO D9

Code Documentation

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Servo.h>

// Pin definitions
const int rainSensorDigitalPin = 2;
const int rainSensorAnalogPin = A0;
const int servoPin = 9;
const int lcdAddress = 0x27;
const int lcdColumns = 16;
const int lcdRows = 2;

// Create objects
LiquidCrystal_I2C lcd(lcdAddress, lcdColumns, lcdRows);
Servo servo;

void setup() {
  // Initialize serial communication
  Serial.begin(9600);
  
  // Initialize LCD
  lcd.begin(lcdColumns, lcdRows); // Corrected line
  lcd.backlight();
  lcd.setCursor(0, 0);
  lcd.print("Clothes Drying");
  lcd.setCursor(0, 1);
  lcd.print("Stand Ready");
  
  // Initialize servo
  servo.attach(servoPin);
  servo.write(0); // Initial position
  
  // Initialize rain sensor pin
  pinMode(rainSensorDigitalPin, INPUT);
}

void loop() {
  // Read rain sensor digital value
  int rainDetected = digitalRead(rainSensorDigitalPin);
  int rainAnalogValue = analogRead(rainSensorAnalogPin);
  
  // Display rain sensor value on LCD
  lcd.setCursor(0, 1);
  lcd.print("Rain: ");
  lcd.print(rainAnalogValue);
  
  if (rainDetected == LOW) { // Rain detected
    lcd.setCursor(0, 0);
    lcd.print("Rain Detected!");
    servo.write(90); // Retract stand
  } else { // No rain
    lcd.setCursor(0, 0);
    lcd.print("No Rain       ");
    servo.write(0); // Extend stand
  }
  
  delay(1000); // Wait for a second
}

This code initializes the LCD, servo, and rain sensor. It continuously reads the rain sensor values and updates the LCD display. If rain is detected, the servo retracts the stand; otherwise, it extends the stand.