Back to Home
Completed
Breadboard Prototype

Rain-Sensing Clothesline.

A weather-responsive actuator that watches a conductive rain sensor and pulls hanging laundry under shelter at the first drop — then sends it back out once the surface dries.

PlatformArduino Uno R3
MCUATmega328P
SensingLM393 + Plate
ActuationSG-90 Servo
TelemetrySerial 9600
FirmwareArduino Sketch

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

Sensor StateArm Action
Droplets bridge the sensor traces → D0 LOW (0)Retract to 90°
Plate surface dry → D0 HIGH (1)Deploy to 0°
Sensor sampled every ~100 ms10 Hz poll
State logged every sample9600 baud

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.

Component Breakdown
Rain-Sensing Clothesline
├── Sensing
│   ├── Serpentine rain board   - exposed conductive grid
│   └── LM393 comparator module - potentiometer-set threshold, D0 out
├── Control
│   └── Arduino Uno R3          - poll D7 every 100 ms
├── Actuation
│   └── SG-90 Servo (D6)        - 0 deg deployed / 90 deg retracted
└── Observability
    └── Serial @ 9600 baud      - raw sensor state every sample

Hardware Build

Wiring & Pinout

Component / SignalArduino Pin
Rain module — D0 (digital out)D7
SG-90 — signal (orange)D6
Module power — shared bus5V / GND
Serial telemetry9600 baud

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

False Positives From Dew and Mist

The Problem

Morning condensation and light mist were enough to read as rain and retract the line on a clear morning.

The Solution

Tuned the LM393's onboard potentiometer so the comparator only trips once droplets actually bridge adjacent traces, keeping the trigger threshold in hardware where it belongs.

Result: Dew and humidity no longer trigger a retraction, while the first real drops still flip the state on the next 100 ms poll.

Flashing Firmware Across Two USB Stacks

The Problem

Uploads failed intermittently depending on which Uno was connected — the board's native ATmega16U2 CDC-ACM path and a third-party WCH CH340G USB-UART bridge enumerate differently.

The Solution

Diagnosed the driver mismatch with device-manager and lsusb inspection, installed the CH340/CH341 driver alongside the native CDC-ACM stack, and verified the correct COM/tty device before every upload.

Result: A repeatable flash workflow across boards and operating systems, no more guessing why a compile succeeded but the upload did not.

Deadband Between the Two States

The Problem

A two-state arm needs hard endpoints — a partially retracted line is the worst outcome in a downpour.

The Solution

Mapped the arm to absolute angles (0° deployed, 90° retracted) instead of incremental steps, so every command drives the servo to a known position from any previous state.

Result: Predictable covered or uncovered states with no drift, and recovery is just a power cycle back to a defined angle.

Results

LOWTrigger Polarity

Comparator D0 is active-low: droplets bridging the plate pull the line down, and retract is the safe default.

90°Arm Travel

0° deployed in open air, 90° retracted under cover, both absolute positions.

10 HzPoll Rate

Sensor sampled and logged every 100 ms over 9600 baud serial.


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.