Projects / Fish pond aerator with oxygen-risk timer

Fish pond aerator with oxygen-risk timer

Intermediate1.5 hGuided buildReviewed

Build it step by step

0 of 8 done
  1. NANODS18B2023.1°C

    Test the probe

    Place it in pond water and read the temperature.

  2. NANO304 lux

    Test the light

    Note the LDR reading in sun, shade and dusk.

  3. NANO

    Set the cloudy level

    Adjust CLOUDY_BELOW to a reading between them.

  4. NANOON

    Wire the relay

    Run the air pump from the 12 V supply.

  5. NANODS323119:33

    Set the RTC

    Use a library example once.

  6. NANO

    Check the night rule

    Change NIGHT_START to the current hour and see it start.

  7. NANODS18B2023.1°C

    Check the sensor failure rule

    Unplug the probe and see it stay on.

  8. NANO

    Install

    Put the controller in a dry box above the water level.

In short

How do you build a fish pond aerator with oxygen-risk timer?

Aeration runs more at night and on hot, cloudy days when pond oxygen drops, using temperature and light as a simple guide. You need Arduino Nano, DS18B20 waterproof probe, Resistor 4.7 kΩ, LDR Photoresistor, Resistor 10 kΩ, Relay Module 5V, DS3231 RTC module, 16x2 LCD with I2C backpack (PCF8574) and 12 V 2 A DC adapter. It takes 8 steps and about 90 minutes.

Level
Intermediate
Time
About 90 min
Parts
9

Parts list

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

Wiring

FromToWhy
DS18B20 red and blackNano 5V and GNDPower
DS18B20 yellow dataNano D2 and 4.7 kΩ resistor to 5VWater temperature
LDR5V and Nano A0Light sensor, top of the divider
10 kΩ resistorNano A0 and GNDBottom of the divider
Relay module VCC, GNDNano 5V and GNDCoil power
Relay module INNano D7Control
12 V adapter +Relay COMAerator supply
Relay NO12 V DC air pump +Switched positive
Air pump - and adapter -JoinedReturn
DS3231 and LCD I2CNano A4 and A5, 5V and GNDClock and display

Code

Dissolved oxygen in a pond is lowest before dawn, and falls faster in warm water and under cloud because plants make less oxygen without sunlight. This controller uses that as a rough guide: aeration runs every night, and also in the day when the water is above 30 degrees and the light is low. If the probe fails the aerator stays on, since fish are safer with extra air. It is only a guide and does not measure oxygen; for a commercial pond a dissolved oxygen meter is the proper tool, and fish that gasp at the surface need action immediately. Use a 12 V DC air pump; mains aerators need wiring by a qualified electrician. Keep the electronics dry and away from the pond edge. Arduino IDE, board "Arduino Nano" (processor ATmega328P, or ATmega328P (Old Bootloader) for clones).

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).

// Libraries: OneWire, DallasTemperature, RTClib, LiquidCrystal_I2C.
#include <OneWire.h>
#include <DallasTemperature.h>
#include <Wire.h>
#include <RTClib.h>
#include <LiquidCrystal_I2C.h>

OneWire ow(2);
DallasTemperature ds(&ow);
RTC_DS3231 rtc;
LiquidCrystal_I2C lcd(0x27, 16, 2);
const byte RELAY = 7, LDR = A0;
const bool ACTIVE_LOW = true;
const float HOT_WATER_C = 30.0;
const int CLOUDY_BELOW = 400;               // LDR reading under this means cloudy, tune outdoors
const byte NIGHT_START = 0, NIGHT_END = 6;  // aerate from midnight to 6 am
bool on = false;

void aerator(bool v) { on = v; digitalWrite(RELAY, (v == ACTIVE_LOW) ? LOW : HIGH); }

void setup() {
  pinMode(RELAY, OUTPUT); aerator(true);    // fail on: fish are safer with air
  ds.begin(); rtc.begin();
  lcd.init(); lcd.backlight();
}

void loop() {
  DateTime now = rtc.now();
  ds.requestTemperatures();
  float t = ds.getTempCByIndex(0);
  int light = analogRead(LDR);

  bool night = now.hour() >= NIGHT_START && now.hour() < NIGHT_END;
  bool hotCloudy = (t > HOT_WATER_C) && (light < CLOUDY_BELOW);
  bool sensorFail = (t < -100);             // probe missing, stay on

  aerator(night || hotCloudy || sensorFail);

  lcd.setCursor(0, 0);
  lcd.print(t, 1); lcd.print("C L"); lcd.print(light); lcd.print("   ");
  lcd.setCursor(0, 1);
  lcd.print(on ? "Aerator ON  " : "Aerator off ");
  lcd.print(now.hour()); lcd.print(":"); if (now.minute() < 10) lcd.print("0"); lcd.print(now.minute());
  delay(2000);
}

Test checklist

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

CheckExpected
During the set night hoursAerator on
Hot water and low lightAerator on
Cool and brightAerator off
Probe unpluggedAerator on

If it does not work

Never turns on

Check the relay logic and the 12 V wiring.

Always on

Check the LDR threshold and the probe reading.

Temperature reads -127

Check the probe wiring and pull-up.

Wrong hours

Set the RTC again.

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

Ask Lark AI

Common questions

What parts do I need for the fish pond aerator with oxygen-risk timer?

Arduino Nano, DS18B20 waterproof probe, Resistor 4.7 kΩ, LDR Photoresistor, Resistor 10 kΩ, Relay Module 5V, DS3231 RTC module, 16x2 LCD with I2C backpack (PCF8574) and 12 V 2 A DC adapter.

How long does the fish pond aerator with oxygen-risk timer take to build?

About 90 minutes for a intermediate maker, in 8 steps.

How do I know the fish pond aerator with oxygen-risk timer works?

During the set night hours: Aerator on. Hot water and low light: Aerator on. Cool and bright: Aerator off.

Never turns on: what should I check?

Check the relay logic and the 12 V wiring.

Always on: what should I check?

Check the LDR threshold and the probe reading.

Temperature reads -127: what should I check?

Check the probe wiring and pull-up.

Wrong hours: what should I check?

Set the RTC again.