Projects / Rain wiper for a model car

Rain wiper for a model car

Beginner1.5 hGuided buildReviewed

Build it step by step

0 of 7 done
  1. NANORAIN

    Wire the rain module

    VCC to 5V, GND to GND, AO to A0.

  2. NANO59°

    Wire the servo

    Signal to D9, red to 5V, brown to GND.

  3. NANO

    Upload the sketch

    Open the Serial Monitor at 9600 baud.

  4. NANO

    Note the dry reading

    A high number, often above 900.

  5. NANORAIN

    Add a few drops of water on the tracks

    The number falls and the arm wipes slowly.

  6. NANO

    Add more water

    The arm wipes faster.

  7. NANO

    Wipe the board dry

    The arm returns to its parked angle.

In short

How do you build a rain wiper for a model car?

A rain drop sensor tells a Nano how wet the windscreen of a model car is, and a micro servo swings a wiper arm slowly in light rain and quickly in heavy rain. It parks the arm when the glass is dry. You need Arduino Nano, Rain drop sensor module, SG90 Micro Servo, Breadboard 830 Tie Points and Jumper wires male to male (40 pcs, 20 cm). It takes 7 steps and about 90 minutes.

Level
Beginner
Time
About 90 min
Parts
5

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
Rain module VCCNano 5VPower the sensor board
Rain module GNDNano GNDCommon ground
Rain module AONano A0Analog wetness reading
Servo signal (orange or yellow)Nano D9Wiper arm
Servo plus (red)Nano 5VPower (a small servo from USB is fine, see the notes)
Servo minus (brown)Nano GNDCommon ground

Code

The rain drop sensor board has a set of bare copper tracks that water bridges, which lowers the analog reading. The sketch averages eight readings to calm the noise and compares the result with two limits. Above the first limit the glass is dry and the arm waits at its parked angle. Between the two it makes a slow wipe with a long pause, and below the second it wipes quickly with only a short pause. Open the Serial Monitor at 9600 baud to see the raw numbers and set the limits for your own board, which can read quite differently from another. Add water with a dropper or a spray bottle on the sensor tracks only, and keep the connector, the Nano and the wires dry. This is a model for learning and has nothing to do with a real vehicle.

Runs on a virtual Arduino Nano in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).

#include <Servo.h>

Servo wiper;
const uint8_t SERVO_PIN = 9;
const uint8_t RAIN_PIN = A0;
const int PARK_ANGLE = 10;
const int SWEEP_ANGLE = 100;

// The rain board reads high when dry and lower as water covers the tracks.
const int DRY_LIMIT = 900;      // above this: dry, arm parked
const int LIGHT_LIMIT = 700;    // between the two: light rain
// below LIGHT_LIMIT: heavy rain

int readRain() {
  long sum = 0;
  for (int i = 0; i < 8; i++) sum += analogRead(RAIN_PIN);
  return sum / 8;
}

void sweep(int stepDelayMs) {
  for (int a = PARK_ANGLE; a <= SWEEP_ANGLE; a += 4) { wiper.write(a); delay(stepDelayMs); }
  for (int a = SWEEP_ANGLE; a >= PARK_ANGLE; a -= 4) { wiper.write(a); delay(stepDelayMs); }
}

void setup() {
  wiper.attach(SERVO_PIN);
  wiper.write(PARK_ANGLE);
  Serial.begin(9600);
}

void loop() {
  int rain = readRain();
  Serial.println(rain);
  if (rain > DRY_LIMIT) {
    wiper.write(PARK_ANGLE);
    delay(300);
  } else if (rain > LIGHT_LIMIT) {
    sweep(25);          // slow wipe
    delay(2500);        // long pause between wipes
  } else {
    sweep(8);           // fast wipe
    delay(300);
  }
}

What the serial monitor should show

Open the serial monitor at the baud rate in the code. This is what our simulator prints for a virtual Arduino Nano with its sensors at their default values. Your numbers will follow your real readings, but the format should match.

512
511
512
511
512
511

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
Dry boardHigh reading, arm parked
A few dropsSlow wipe with a pause
A wet filmFast wipe
Dry againArm parked within a few seconds
Wrong limitsChange DRY_LIMIT and LIGHT_LIMIT from your own readings

If it does not work

Arm always wipes

Raise DRY_LIMIT above your dry reading.

Arm never moves

Check the servo signal on D9 and the shared ground.

Servo twitches or the Nano resets

Power the servo from a separate 5 V supply with a shared ground.

Readings jump

Dry the board and keep wires still.

Sensor corrodes

Dry the board after each test and power it only while testing.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the rain wiper for a model car?

Arduino Nano, Rain drop sensor module, SG90 Micro Servo, Breadboard 830 Tie Points and Jumper wires male to male (40 pcs, 20 cm).

How long does the rain wiper for a model car take to build?

About 90 minutes for a beginner maker, in 7 steps.

How do I know the rain wiper for a model car works?

Dry board: High reading, arm parked. A few drops: Slow wipe with a pause. A wet film: Fast wipe.

Arm always wipes: what should I check?

Raise DRY_LIMIT above your dry reading.

Arm never moves: what should I check?

Check the servo signal on D9 and the shared ground.

Servo twitches or the Nano resets: what should I check?

Power the servo from a separate 5 V supply with a shared ground.

Readings jump: what should I check?

Dry the board and keep wires still.