Afif Muhammad
Published © CC BY

Jemuran anti hujan

Jemuran ini dirancang untuk dapat menggerakkan jemuran ketempat teduh secara otomatis apabila cuaca hujan.

EasyWork in progress3 hours204
Jemuran anti hujan

Things used in this project

Hardware components

NodeMCU ESP8266 Breakout Board
NodeMCU ESP8266 Breakout Board
×1
Relay (generic)
×2
DC motor (generic)
×2
water sensor
×1
Jumper wires (generic)
Jumper wires (generic)
×1
9V battery (generic)
9V battery (generic)
×1
Breadboard (generic)
Breadboard (generic)
×1
USB-A to Micro-USB Cable
USB-A to Micro-USB Cable
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Skema wiring Jemuran anti hujan

Untitled sketch 2 bb deucw3rjlp

Code

JemuranAntiHujan

Arduino
int relayInput = 2;
int relayInputB = 4;
int kondisi = 1;
float liquid_level;
void setup(){

Serial.begin(9600);
pinMode(relayInput, OUTPUT);
pinMode(relayInputB, OUTPUT);
 digitalWrite(relayInput , HIGH);
 digitalWrite(relayInputB , HIGH);
}
 
void loop(){

Serial.print("Water level Sensor Value:");
Serial.println(analogRead(A0));
liquid_level = analogRead(A0);

if (liquid_level >= 250 and kondisi == 1){
  digitalWrite(relayInputB , LOW);
  delay(150);
  kondisi = 2;
}
if (liquid_level < 20 and kondisi == 2 ){
  digitalWrite(relayInput , LOW);
  delay(400);
  kondisi = 1;
}
 digitalWrite(relayInput , HIGH);
 digitalWrite(relayInputB , HIGH);
}

Credits

Afif Muhammad

Afif Muhammad

1 project • 0 followers

Comments

Add projectSign up / Login