Ever wondered how car wipers automatically activate when it rains? 🌧️🚗
This fun and beginner-friendly Arduino project shows you how to build a miniature rain-sensing wiper system. Using an Arduino Uno, a rain sensor, and two servo motors, this setup mimics the way real car wipers work—detecting water and sweeping back and forth automatically.
It’s similar to the Smart Laundry Bot project, but instead of moving a clothesline, the servos control wipers on a model windshield. The concept is the same: detect rain → trigger movement automatically.
Perfect for hobbyists and students, this project is inexpensive, teaches sensor interfacing, servo control (PWM), and simple automation logic. Once you’ve built the base version, you can easily add upgrades like potentiometer speed control, a manual/auto switch, or even a 3D-printed wiper frame.
What You’ll Need

Electronic Components
- Rain Sensor – detects water droplets on its surface
- Mini Servo – sweeps the wipers left and right
- Arduino Uno – the brain of the system
- 8 Slot Battery Holder – powers the servos and Arduino
- Battery AA – main power source
- USB Cable Type B – for uploading code to Arduino
- Jumper Wires – connections between components
Circuit Diagram:

To assemble the project:
1, Connect the rain sensor’s output pin to digital pin D2 on the Arduino.
2. Power the sensor from the Arduino’s 3.3V and GND pins.
3. Connect each servo to a separate digital pin:
- Servo 1 → D9
- Servo 2 → D10
- Power each servo with 5V and GND from Arduino.
4. Mount the servos so they act like wipers.
Pin Mapping:
- Rain Sensor: VCC → 3.3V | GND → GND | DO → D2
- Servo 1: VCC → 5V | GND → GND | Signal → D9
- Servo 2: VCC → 5V | GND → GND | Signal → D10
Code:
How it Works?
- The rain sensor detects water droplets.
- It sends a signal to the Arduino Uno.
- Arduino activates two servos, sweeping them like wipers.
- When no rain is detected, servos return to rest.
You can adjust in the code:
- Wiping Speed – change delay time.
- Wiping Range – modify servo angle values.
- Sensor Sensitivity – tune rain sensor threshold (light drizzle = intermittent, heavy rain = continuous).
Sample Code
#include <Servo.h>
Servo wiperLeft;
Servo wiperRight;
const int rainSensorPin = 2;
const int servo1Pin = 9;
const int servo2Pin = 10;
void setup() {
pinMode(rainSensorPin, INPUT);
wiperLeft.attach(servo1Pin);
wiperRight.attach(servo2Pin);
// Start at initial angle
wiperLeft.write(180);
wiperRight.write(180);
}
void loop() {
int rainDetected = digitalRead(rainSensorPin);
if (rainDetected == LOW) { // Rain detected
// Swipe like wipers
wiperLeft.write(90);
wiperRight.write(90);
delay(500);
wiperLeft.write(180);
wiperRight.write(180);
delay(500);
} else {
// Stop at resting position
wiperLeft.write(180);
wiperRight.write(180);
}
delay(100);
}