Automatic Cloth Protector From Rain Project

 Introduction: This project aims to create an automatic clothes protection system that saves your clothes from getting wet in the rain. The system detects rain and retracts the clothes under a roof. Once the rain stops, the clothes are extended back out to dry. This innovative solution ensures your laundry stays dry and protected.

Components Needed:

  • Arduino


Buy Arduino UNO CLICK TO BUY







  • Rain Sensor









Buy Rain SENSOR  CLICK TO BUY 


  • Servo Motor










Buy Servo Motor  CLICK TO BUY
  • 12V Battery










  • Arduino IDE

Connection Diagram:


















  • Connect the D0 pin of the rain sensor to pin 2 of the Arduino.
  • Connect the signal pin of the servo motor to pin 9 of the Arduino.
  • Connect the VCC of both the servo motor and the rain sensor to the 5V pin of the Arduino.
  • Finally, connect the GND of both the servo motor and the rain sensor to the GND pin of the Arduino.

Steps:

  1. Connect the Components:

    • Connect the D0 pin of the rain sensor to pin 2 of the Arduino.
    • Connect the signal pin of the servo motor to pin 9 of the Arduino.
    • Connect the VCC of both the servo motor and the rain sensor to the 5V pin of the Arduino.
    • Connect the GND of both the servo motor and the rain sensor to the GND pin of the Arduino.
  2. Upload the Code:

    • Connect the cable to your laptop.
    • Open the Arduino IDE.
    • Upload the code provided below.
  3. Test the System:

    • Ensure the system retracts the clothes when rain is detected and extends them when the rain stops.

Arduino Code:

#include <Servo.h>
const int rainSensorPin = 2; // Pin connected to the rain sensor const int servoPin = 9; // Pin connected to the servo motor Servo myServo; int rainThreshold = 500; // Adjust this value based on your sensor calibration void setup() { pinMode(rainSensorPin, INPUT); myServo.attach(servoPin); myServo.write(0); // Initial position (extended) Serial.begin(9600); } void loop() { int sensorValue = analogRead(rainSensorPin); Serial.println(sensorValue); if (sensorValue < rainThreshold) { // Assuming lower value indicates rain detected // Retract the clothes myServo.write(90); // Adjust the angle to retract } else { // Extend the clothes myServo.write(0); // Adjust the angle to extend } delay(1000); // Delay for stability }

Explanation:

  • Library Include: #include <Servo.h>: Includes the Servo library to control the servo motor.
  • Pin Definitions: const int rainSensorPin = 2;, const int servoPin = 9;: Defines the pins connected to the rain sensor and servo motor.
  • Servo Initialization: Servo myServo;, myServo.attach(servoPin);: Creates a Servo object and attaches the servo to the specified pin.
  • Setup Function: Sets the rain sensor pin as an input, initializes the servo to the extended position, and initializes serial communication for debugging.
  • Loop Function: Reads the value from the rain sensor. If the sensor value is below the threshold, it retracts the clothes (servo moves to 90 degrees). If the sensor value is above the threshold, it extends the clothes (servo moves to 0 degrees). A delay of 1 second is added for stability.

Adjustments:

  • Threshold Value: Calibrate the rainThreshold value based on your specific rain sensor.
  • Servo Angles: Adjust the servo angles (0 and 90) to fit the retraction and extension mechanism in your setup.

Video Tutorial: For more videos like this, follow Tech Zaid and subscribe to our YouTube channel. Visit our YouTube channel 

video tutorial

Comments

Popular posts from this blog

Indian Railway Recruitment 2024, 10th Pass, 1646 Vacancies, Apply Online

Real Madrid vs atlético Madrid