Prototype Automatic Clothesline Based on Arduino Uno

Prototype Automatic Clothesline Based on Arduino Uno © MPL-2.0

There are two sensors as detectors in this project, namely rain sensor and LDR. Rain sensor functions to detect the occurrence of rain/not.

  • 6,033 views
  • 7 comments
  • 28 respects

Components and supplies

Necessary tools and machines

About this project

"Prototype Automatic Clothesline Based Of Arduino-Uno"

The working principle of this project is when the rain sensor is hit by raindrops (High) and LDR is receiving light (bright), the DC motor will move forward (CCW) pulling clothes lines out of the room and the led off, and when the rain sensor is not exposed to raindrops (Low) but the LDR does not detect light (dark) then the DC motor will move backwards to pull clothesline into the room then the LED will light up and, when the rain sensor is hit by rain drops (High) and the LDR does not detect light (dark) then the DC motor will move backwards to pull clothes line into the room and the LED will light up.

Code

baru_tambah_delay.inoArduino
#define OutputDO 8 //nama alias pin 8 yaitu output DO
int Ldr = A1;  //inisialisasi 
int ldr;
int en1= 6; //inisialisasi en1 masuk pwm yaitu 6
int en2= 5; //inisialisasi en2 masuk pwm yaitu 5
int in1= 2;  //inisialisasi pin input1/in1 masuk pin 13
int in2= 12;  //inisialisasi pin input2/in2 masuk pin 12
int in3= 11;  //inisialisasi pin input3/in3 masuk pin 11
int in4= 10;  //inisialisasi pin input4/in4 masuk pin 10

int OutputAO=A0; //nama alias pin AO yaitu Output AO
int Led=13; //nama alias pin 13 yaitu LED


int val;//val sebagai buffer data
float sensor; //sebagai data buffer sensor

void setup() {
  pinMode(en1, OUTPUT); //pin en1 sebagai OUTPUT
  pinMode(en2, OUTPUT); //pin en2 sebagai OUTPUT
  pinMode(in1, OUTPUT); //pin in1 sebagai OUTPUT
  pinMode(in2, OUTPUT); //pin in2 sebagai OUTPUT
  pinMode(in3, OUTPUT); //pin in3 sebagai OUTPUT
  pinMode(in4, OUTPUT); //pin in4 sebagai OUTPUT

pinMode (Led, OUTPUT) ; //Defisini LED sebagai output
pinMode (OutputDO, INPUT) ; //Defisini OutputDO sebagai input
pinMode (OutputAO, INPUT) ; //Defisini OutputAO sebagai input
pinMode (ldr, INPUT);

//inisialisasi komunikasi serial
Serial.begin(9600);
  
}

void hujan(){
  digitalWrite (Led, HIGH);

  analogWrite(en1,125);
  digitalWrite(in1,LOW);
  digitalWrite(in2,HIGH);

  analogWrite(en2,125);
  digitalWrite(in3,LOW);
  digitalWrite(in4,HIGH);

  Serial.println("mundur");
  
}
void mendung(){
  digitalWrite (Led, HIGH);

  analogWrite(en1,125);
  digitalWrite(in1,LOW);
  digitalWrite(in2,HIGH);

  analogWrite(en2,125);
  digitalWrite(in3,LOW);
  digitalWrite(in4,HIGH);

  Serial.println("mundur");
}
void terang(){
  digitalWrite (Led, LOW);

  analogWrite(en1,125);
  digitalWrite(in1,HIGH);
  digitalWrite(in2,LOW);

  analogWrite(en2,125);
  digitalWrite(in3,HIGH);
  digitalWrite(in4,LOW);

  Serial.println("maju");
}
void mati(){
  analogWrite(en1,0);
  digitalWrite(in1,LOW);
  digitalWrite(in2,LOW);

  analogWrite(en2,0);
  digitalWrite(in3,LOW);
  digitalWrite(in4,LOW);

  Serial.println("mati");
  delay(5000);
}

void loop() {
sensor = analogRead(OutputAO);//Pembacaan nilai sensor
Serial.println(sensor); //hasil akan ditampilkan di serial monitor

ldr = analogRead(A1);
Serial.print("ldr : ");
Serial.println(ldr);
//pembacaan nilai sensor (logika 1 dan 0)
val = digitalRead (OutputDO);

//Pengondisian
 if (ldr <= 250 )  
 {
  if (sensor <=500)
    //lampu led akan menyala
   
    hujan(); delay(500);
    mati(); delay(5000);
   
 }

 else if(ldr <= 250 ){
  if (sensor > 500){
   mendung(); delay(400);
   mati(); delay(5000);
 }
 }
 
else if(ldr >= 250 ){
  if (sensor > 500){
   terang(); delay(10 00);
   mati(); delay(5000);
 }
 }
}

Custom parts and enclosures

img-20190512-wa0019_564YTo8FaT.jpg
Img 20190512 wa0019 564yto8fat

Schematics

fritzing_fix_bb_FRXrApJajz.jpg
Fritzing fix bb frxrapjajz

Comments

Similar projects you might like

Arduino-Based Automatic Water Tap Using IR Sensor

Project tutorial by Team Creatjet3D R&D Team

  • 13,386 views
  • 8 comments
  • 23 respects

The Zeus Electronic Weather Station (ZeWS)

Project in progress by moisi

  • 3,574 views
  • 0 comments
  • 16 respects

Smart Lock Door with Voice Activation Using Arduino Uno

Project showcase by bangkitwahyu

  • 2,542 views
  • 2 comments
  • 18 respects

RFID Based Automatic Door System

Project showcase by Robodia Technology

  • 55,118 views
  • 24 comments
  • 135 respects

Solar Charged Battery Powered Arduino Uno

Project in progress by Igor Fonseca Albuquerque

  • 89,387 views
  • 49 comments
  • 169 respects
Add projectSign up / Login