Overview
Open-air drying is a race against the weather. Laundry left out during a sudden downpour comes back wetter than it went out, and nothing about a manual clothesline notices the first drops.
This build turns the clothesline into a small closed-loop machine: a nickel-plated serpentine sensor board (conditioned by an LM393 comparator) reports rain, and an SG-90 servo swings an arm that retracts the line under cover. When the plate dries, the arm extends again.
Key focus areas:
- Detecting the first drops without false triggers from dew or mist
- Two-state actuation with a hard, repeatable arm position at each end
- Continuous serial visibility into what the sensor is reporting
- One firmware image that tolerates multiple Uno board revisions
Operational Logic
The comparator's polarity is what makes the logic so short: moisture is a LOW, so the retract branch is the safety-default and a disconnected or failed jumper reads as dry rather than falsely raining.
System Architecture
Sense, Compare, Actuate
The LM393 board does the analog work; firmware is a two-branch state check driven by a single digital pin.
Hardware Build
Wiring & Pinout
Firmware
#include <Servo.h> // servo library
Servo s1;
int val = 0;
void setup()
{
Serial.begin(9600);
pinMode(7, INPUT); // Rain sensor output pin connected
s1.attach(6); // Servo Motor
}
void loop()
{
val = digitalRead(7); // Rain sensor output pin connected
Serial.println(val); // see the value in serial monitor
delay(100);
if (val == 0)
{
s1.write(90); // Servo Rotate 90 Degree
delay(500); // delay time
}
if (val == 1)
{
s1.write(0); // Servo Rotate 0 Degree
}
}Technical Challenges
Results
Lessons Learned
- Put thresholds in hardware when you can: one trimpot replaced a pile of software filtering for mist and dew.
- Absolute positions beat increments: angle-based commands make a two-state mechanism self-recovering.
- Instrument everything: printing the raw sensor value each loop turned a vague "it didn't trigger" into an obvious wiring or polarity problem.
- Drivers are part of the stack: knowing which USB-UART bridge a board uses saves hours of "why won't it upload" debugging.
- Next iteration: add a debounce window and a hold-off timer so a single stray drop does not cause a retract-and-redeploy cycle.
Liked this project?
Check out more of my work or get in touch.