Community project

Automatic Pet Watering

Arduino
Photo of Automatic Pet Watering
Generated with AI

Oake Min Khant

Published October 4, 2026

This automatic pet watering system monitors a water bowl and activates a pump when the level drops too low, ensuring pets always have access to fresh water. Built around an Arduino Uno with a water level sensor, relay-controlled pump, OLED display, and traffic light indicators, the system provides visual feedback on water status and pump operation.

The guide includes a complete wiring diagram, parts list with supplier links, Arduino firmware with hysteresis-based water detection, and step-by-step assembly instructions. Builders will learn how to integrate analog sensors, control high-current devices through relays, and create a responsive user interface with display and LED indicators.

Wiring diagram

Wiring diagram for Automatic Pet Watering

Gather all the parts

QtyComponent
1

Water Level Sensor

An analog water level sensor module that outputs a voltage proportional to the water level. It uses ten interleaved copper traces and an S8050 NPN transistor to convert water conductivity into an analog voltage signal. The higher the water level, the higher the output voltage. Operates on 3.3V to 5V. To extend sensor lifespan, it is recommended to power the sensor only during readings by controlling the VCC pin via a digital output pin rather than connecting it permanently to 5V.

1

4-Channel 5 V Relay Module

A four-switch 5 V relay board; channel 1 switches the pump while the other three channels are unused.

1

5 V Mini DC Water Pump

A small two-wire 5 V pump that moves water when its positive wire receives power through relay channel 1.

1

Traffic Light

Three-channel red/yellow/green traffic-light LED module. Common Arduino modules expose one shared ground and three digital control pins; many boards include current-limiting resistors, while discrete-LED builds should still use one resistor per LED.

1

0.96 inch 128×64 I2C OLED Display (5 V-compatible SSD1306)

A small OLED screen that shows the water reading and whether the pump is running.

1

12 V DC Wall Power Adapter

A regulated wall adapter that supplies the pump directly and feeds the buck converter for the 5 V electronics.

1

USB Type-A to Type-B Programming Cable

A USB cable used only to upload firmware and view serial messages through the Nano's USB connector.

1

Arduino Nano Sensor Shield

A plug-on breakout board that brings the Nano pins out to clearly labeled signal, 5 V, and ground headers.

1

DC-DC Multi-Output Power Supply Module

12 V input; regulated 5 V logic and 5 V pump outputs

A regulated DC power module that accepts the wall adapter input and provides separate 5 V logic and pump output rails.

Assemble it in 7 steps

1. Fit the Nano into the sensor shield

With all power disconnected, press the Arduino Nano straight into the two socket rows on the Arduino Nano Sensor Shield. Match the printed labels and make sure no Nano pin is bent. The shield’s S, V, and G header holes provide the Nano’s signal, 5 V, and ground connections.

  • Do not connect the wall adapter while moving wires; a loose powered wire can damage the boards.

2. Connect the wall adapter to the power module

Connect the wall adapter positive output to the DC-DC multi-output module VIN+ input (power), and the adapter negative output to VIN− (ground). Set and check the module’s logic output at 5.0 V before connecting the Nano.

  • Never connect the 12 V adapter output to the 5 V logic terminals; that can damage the Nano, OLED, relay board, and sensor.

3. Make the 5 V logic rail

Connect the power module 5V LOGIC+ output to the Nano Sensor Shield 5V rail (power). Connect the power module LOGIC GND to the Sensor Shield GND rail (ground). This rail powers the Nano and the low-power modules.

  • Use red wire for 5 V and black wire for ground so the connections are easier to inspect.

4. Connect the water sensor, screen, and lights

Water sensor: + → shield 5V (power), − → shield GND (ground), S → A0-S (water-level signal). OLED: VCC → shield 5V (power), GND → shield GND (ground), SDA → A4-S (data), SCL → A5-S (clock). Traffic-light module: GND → shield GND (ground), RED → D3-S (low-water light), YELLOW → D4-S (status light), GREEN → D5-S (water-level-OK light).

  • Keep the display and shield dry; only the sensing end of the water sensor belongs near the water.
  • Make sure the traffic-light module has built-in LED resistors. Bare LEDs without resistors can damage the LEDs or the Nano pins.

5. Connect relay channel 1 and the pump circuit

Relay control side: VCC → shield 5V (power), GND → shield GND (ground), IN1 → D2-S (pump-control signal). Pump circuit: power module 5V PUMP+ → relay COM1 (power entering the switch), relay NO1 → pump PUMP+ (switched pump power), pump PUMP− → power module PUMP GND (ground return). Leave NC1, IN2, IN3, and IN4 unconnected.

  • This wiring is for the listed 5 V pump. Use a pump-output rail matching the pump label if you replace the pump with another voltage.
  • Keep the pump leads away from the OLED and water-sensor signal wires, and tighten the relay screw terminals.

6. Check the supply before wet testing

Verify that the logic output measures 5 V and that the pump output is set to the voltage printed on the pump. Confirm that COM1 and NO1 are the screw terminals printed for relay channel 1; do not rely on their left-to-right position. Keep the pump inlet submerged before allowing it to run.

  • If the Nano resets, the screen flickers, or the supply gets very hot when the pump starts, disconnect power. The power module needs a pump output with enough current capacity.

7. Connect the programming cable

Connect the programming cable between the computer and the Nano’s USB programming connector. It is only for programming and serial messages; the DC-DC power module supplies the circuit during use.

  • A standard Nano normally uses Mini-USB, not full-size USB-B. Check that your cable physically fits; do not force the connector.

Review all connections

1. Connections between "adapter_1" and "Arduino"

Functionadapter_1Arduino
powerDC+ → DC-DC Multi-Output Power Supply Module VIN+EXT
groundDC- → DC-DC Multi-Output Power Supply Module VIN-EXT

2. Connections between "power_module_1" and "Arduino"

Functionpower_module_1Arduino
power5V LOGIC+ → Arduino Nano Sensor Shield 5V railEXT
groundLOGIC GND → Arduino Nano Sensor Shield GND railEXT
power5V PUMP+ → 4-Channel 5 V Relay Module COM1EXT

3. Connections between "water_sensor_1" and "Arduino"

Functionwater_sensor_1Arduino
power+5V
ground-GND
analogSGPIO 14

4. Connections between "relay_4ch_1" and "Arduino"

Functionrelay_4ch_1Arduino
powerVCC5V
groundGNDGND
digitalIN1GPIO 2
powerNO1 → 5 V Mini DC Water Pump PUMP+EXT

5. Connections between "pump_1" and "Arduino"

Functionpump_1Arduino
groundPUMP- → DC-DC Multi-Output Power Supply Module PUMP GNDEXT

6. Connections between "traffic_light_1" and "Arduino"

Functiontraffic_light_1Arduino
groundGNDGND
dataREDGPIO 3
dataYELLOWGPIO 4
dataGREENGPIO 5

7. Connections between "oled_1" and "Arduino"

Functionoled_1Arduino
powerVCC5V
groundGNDGND
i2cSDAGPIO 18
i2cSCLGPIO 19

8. Connections between "usb_cable_1" and "Arduino"

Functionusb_cable_1Arduino
dataType-A end → Computer USB port for programming and serial onlyEXT
dataType-B end → Arduino Nano Sensor Shield Nano USB programming portEXT

Deploy the firmware

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

const uint8_t WATER_SENSOR_PIN = A0;
const uint8_t RELAY_PIN = 2;
const uint8_t LED_RED_PIN = 3;
const uint8_t LED_YELLOW_PIN = 4;
const uint8_t LED_GREEN_PIN = 5;

const uint8_t SCREEN_WIDTH = 128;
const uint8_t SCREEN_HEIGHT = 64;
const int LOW_WATER_THRESHOLD = 300;
const int HYSTERESIS = 30;
const unsigned long SAMPLE_INTERVAL_MS = 500;

Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);

bool pumpOn = false;
int waterReading = -1;
int shownReading = -1;
bool shownPumpState = false;
unsigned long lastSampleMs = 0;

void setPump(bool on) {
  pumpOn = on;
  // Most 4-channel relay boards are active-low: LOW energizes relay channel 1.
  digitalWrite(RELAY_PIN, on ? LOW : HIGH);

  digitalWrite(LED_RED_PIN, on ? HIGH : LOW);
  digitalWrite(LED_YELLOW_PIN, LOW);
  digitalWrite(LED_GREEN_PIN, on ? LOW : HIGH);
}

void drawStatus(bool force) {
  if (!force && waterReading == shownReading && pumpOn == shownPumpState) {
    return;
  }

  display.clearDisplay();
  display.setTextColor(SSD1306_WHITE);
  display.setTextSize(1);
  display.setCursor(0, 0);
  display.println(F("PET WATER DISPENSER"));
  display.drawLine(0, 11, 127, 11, SSD1306_WHITE);
  display.setCursor(0, 18);
  display.print(F("Water reading: "));
  display.println(waterReading);
  display.setCursor(0, 34);
  display.print(F("Level: "));
  display.println(waterReading < LOW_WATER_THRESHOLD ? F("LOW") : F("OK"));
  display.setCursor(0, 50);
  display.print(F("Pump: "));
  display.println(pumpOn ? F("FILLING") : F("OFF"));
  display.display();

  shownReading = waterReading;
  shownPumpState = pumpOn;
}

void setup() {
  pinMode(RELAY_PIN, OUTPUT);
  pinMode(LED_RED_PIN, OUTPUT);
  pinMode(LED_YELLOW_PIN, OUTPUT);
  pinMode(LED_GREEN_PIN, OUTPUT);
  setPump(false);

  Serial.begin(9600);
  Wire.begin();
  if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
    Serial.println(F("OLED not found at 0x3C"));
  } else {
    drawStatus(true);
  }
}

void loop() {
  const unsigned long now = millis();
  if (now - lastSampleMs < SAMPLE_INTERVAL_MS) {
    return;
  }
  lastSampleMs = now;

  waterReading = analogRead(WATER_SENSOR_PIN);
  if (!pumpOn && waterReading < LOW_WATER_THRESHOLD) {
    setPump(true);
  } else if (pumpOn && waterReading >= LOW_WATER_THRESHOLD + HYSTERESIS) {
    setPump(false);
  }

  Serial.print(F("Water reading: "));
  Serial.print(waterReading);
  Serial.print(F(", pump: "));
  Serial.println(pumpOn ? F("ON") : F("OFF"));
  drawStatus(false);
}

Remix this project

Make it yours in one click

Open a full copy of this project in your own Schematik workspace — diagram, code, parts, and assembly steps included. Swap the sensor, add features, or redesign the whole thing with AI. The author's original stays untouched.

Open in Schematik