Fish pond aerator with oxygen-risk timer
Build it step by step
0 of 8 doneTest the probe
Place it in pond water and read the temperature.
Test the light
Note the LDR reading in sun, shade and dusk.
Set the cloudy level
Adjust CLOUDY_BELOW to a reading between them.
Wire the relay
Run the air pump from the 12 V supply.
Set the RTC
Use a library example once.
Check the night rule
Change NIGHT_START to the current hour and see it start.
Check the sensor failure rule
Unplug the probe and see it stay on.
Install
Put the controller in a dry box above the water level.
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
- Development BoardsBuyArduino Nano × 1
- SensorsBuy
- PassivesBuyResistor 4.7 kΩ × 1
- SensorsBuy
- PassivesBuyResistor 10 kΩ × 1
- InterfacesBuyRelay Module 5V × 1
- SensorsBuy
- DisplaysBuy
- PowerBuy
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| DS18B20 red and black | Nano 5V and GND | Power |
| DS18B20 yellow data | Nano D2 and 4.7 kΩ resistor to 5V | Water temperature |
| LDR | 5V and Nano A0 | Light sensor, top of the divider |
| 10 kΩ resistor | Nano A0 and GND | Bottom of the divider |
| Relay module VCC, GND | Nano 5V and GND | Coil power |
| Relay module IN | Nano D7 | Control |
| 12 V adapter + | Relay COM | Aerator supply |
| Relay NO | 12 V DC air pump + | Switched positive |
| Air pump - and adapter - | Joined | Return |
| DS3231 and LCD I2C | Nano A4 and A5, 5V and GND | Clock 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.
| Check | Expected |
|---|---|
| During the set night hours | Aerator on |
| Hot water and low light | Aerator on |
| Cool and bright | Aerator off |
| Probe unplugged | Aerator 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 →
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.
