Arduino Aquarium Controller: Heater, Lights and Auto Feeder
Build an Arduino aquarium controller: DS18B20 temperature, relay heater control, RTC sunrise LED lighting, servo fish feeder and ESP32 phone monitoring.
An Arduino aquarium controller is a small automation box that measures the water temperature and runs the heater, fades the lights on and off slowly like a sunrise and sunset, and feeds your fish at the times you choose. Commercial aquarium controllers are expensive and most of them do only one job; when you build your own, you get everything on one board, set the thresholds for your own fish and can even monitor it from your phone.
In this guide we build it step by step: measuring temperature with a waterproof DS18B20, driving the heater through a relay like a thermostat with hysteresis, giving 12 V LED lighting a sunrise effect with a DS3231 clock module and a MOSFET, and feeding automatically with a servo. You'll also find a temperature table by fish species, safety measures and an ESP32 version you can monitor from your phone. Because we switch a 230 V heater right next to water, please don't skip the safety section.

What does an aquarium controller do? The parts of the system
| Task | Part | How does it work? |
|---|---|---|
| Measuring water temperature | Waterproof DS18B20 | 1-Wire bus, 0.0625 °C resolution |
| Switching the heater on and off | Relay module or SSR | Thermostat logic with hysteresis |
| Sunrise and sunset | 12 V LED strip + logic-level MOSFET | Smooth 60-minute fade with PWM |
| Keeping time | DS3231 RTC module | Battery backup; doesn't forget the time during a power cut |
| Feeding | SG90 servo + small food cup | Twice a day, no food on Sundays |
| Showing the status | 16x2 I2C LCD | Temperature, heater state, time and light percentage |
| Monitoring from your phone (optional) | ESP32 | Wi-Fi web page and JSON output |
Water temperature by fish species
Tropical fish are cold-blooded; their metabolism, appetite and immune system depend directly on the water temperature. In an aquarium the goal isn't just the right temperature but a stable one: keeping the daily swing under 1 °C avoids stressing the fish. When choosing a heater, aquarists use a rule of thumb of about 1 W per litre. For example, in a 60-litre tank a 100 W heater would warm the water by about 100 × 3600 / (60 × 4186) = 1.4 °C per hour if there were no heat loss at all; in reality the lid, room temperature and filter make it lower. The ranges below are typical values for common species; always double-check your own fish's needs in species-specific sources too.
| Species | Typical temperature | Note |
|---|---|---|
| Neon tetra | 22–26 °C | Schooling fish, sensitive to sudden temperature changes |
| Guppy | 22–28 °C | Hardy, good for beginners |
| Betta (Betta splendens) | 24–28 °C | Needs a heater even in a small tank |
| Goldfish | 15–22 °C | Cold-water fish, no heater needed |
| Angelfish | 24–28 °C | Tall tank for the long fins |
| Corydoras | 22–26 °C | Bottom dweller, likes soft substrate |
| Zebra danio | 18–24 °C | Tolerates unheated room temperature |
| Discus | 28–31 °C | The common species that wants the warmest water |
| Malawi cichlids | 24–27 °C | Likes hard, alkaline water |
| Red cherry shrimp | 18–26 °C | Wide range, but sensitive to sudden changes |
Circuit wiring
| Part | Arduino Uno | ESP32 | Note |
|---|---|---|---|
| DS18B20 data (yellow) | D2 | GPIO 4 | 4.7 kΩ pull-up between data and VCC |
| DS18B20 red / black | 5V / GND | 3V3 / GND | The sensor works on 3.0–5.5 V |
| Relay IN (heater) | D7 | GPIO 26 | On the ESP32, pick a module that triggers at 3.3 V |
| MOSFET gate (LED strip) | D5 | GPIO 25 | 220 Ω series resistor, 100 kΩ from gate to GND |
| Servo signal (orange) | D9 | – | Power the servo from a separate 5 V supply |
| Active buzzer | D8 | – | For the alarm |
| DS3231 SDA / SCL | A4 / A5 | – (uses NTP) | Same I2C bus as the LCD |
| I2C LCD SDA / SCL | A4 / A5 | – | Address is usually 0x27 |
On the waterproof DS18B20 the red wire is power, the black wire is ground and the yellow (sometimes white) wire is data; without a 4.7 kΩ resistor between the data line and power, the sensor can't be read. Details are in the DS18B20 temperature sensor article. The LED strip's positive goes to the 12 V adapter and its negative to the MOSFET's drain; the source goes to GND, and the adapter's GND is tied to the Arduino's GND. Choose a logic-level MOSFET that switches fully on at 5 V, such as the IRLZ44N. For the clock we use a DS3231: thanks to its temperature-compensated crystal it drifts about one minute per year, while a DS1307 can lose a few seconds a day. If your module is a DS1307, changing a single line in the code is enough; the difference between the two is explained in the RTC clock module article.
Hysteresis: why the heater shouldn't keep switching on and off
The simplest thermostat says "below 25 °C turn the heater on, above it turn it off". But because of the sensor's 0.0625 °C steps and small fluctuations in the water, the temperature bounces between 25.00 and 25.06 and the relay clicks every second. That wears out the relay contacts quickly and stresses the heater. Hysteresis uses two separate thresholds for on and off: with the ±0.3 °C in the code, the heater turns on at 24.7 °C, turns off at 25.3 °C and keeps its last state in between. The heater then runs in regular cycles of a few minutes and the water stays in a narrow 0.6 °C band. We explain the same logic in more detail in the Arduino thermostat article.
| Water temperature | Heater | Why? |
|---|---|---|
| 24.6 °C | On | Below the lower threshold of 24.7 °C |
| 24.9 °C (warming up) | Stays on | Inside the band, last state is kept |
| 25.3 °C | Off | Upper threshold reached |
| 25.0 °C (cooling down) | Stays off | Inside the band, last state is kept |
| 30 °C and above | Off + alarm | Overheat limit (MAX_TEMP) |
| -127 or 85 °C | Off + alarm | Sensor disconnected or unreadable |
Sunrise and sunset: LED lighting
Lights snapping on all at once startle fish; in nature the light changes slowly in the morning and evening. The code reads the time from the RTC, brings the light from zero to full brightness between 09:00 and 10:00 and slowly dims it between 20:00 and 21:00. With these settings the daily photoperiod is about 11 hours, counting half of each fade; aquarists consider 8–10 hours enough for most planted tanks, and longer lighting feeds algae, so adjust the times to your own routine. Because the human eye doesn't perceive brightness linearly, the PWM value is squared (gamma correction), so the first minutes of the sunrise really start dim. The Uno's 8-bit PWM can show small steps at the lowest levels; in the ESP32 version we use 10 bits to make the fade even smoother.
Automatic feeding: a servo fish feeder
For a simple, reliable feeder, glue a pill box or a small film canister to the end of the servo arm and drill a hole in its lid sized to the portion you want. When the servo tips the cup 180 degrees, one portion of food falls through the hole, and when it returns the cup refills. The code feeds at 08:00 and 18:00 and keeps a key value so it doesn't run twice in the same minute. There's no feeding on Sundays; one fasting day a week is a habit many aquarists recommend for digestion and water quality. Overfeeding fouls the water faster than anything else; in the first days, test it over an empty container and weigh how much food drops. For servo details see the servo motor article, and for another take on a clock-based mechanism see the automatic pet feeder article.
Arduino code: the aquarium controller
For the code, install the OneWire, DallasTemperature, RTClib and LiquidCrystal I2C libraries from the Library Manager; the Servo library comes with the Arduino IDE. A 12-bit DS18B20 conversion takes 750 ms; the code starts the conversion and carries on with other work without waiting, then reads the result a second later. That way the display, lights and feeder never stall. One important detail: on the Uno the Servo library uses Timer1, so analogWrite doesn't work on D9 and D10; that's why we put the LED on D5, which runs on Timer0.
1#include <Wire.h>
2#include <RTClib.h>
3#include <OneWire.h>
4#include <DallasTemperature.h>
5#include <Servo.h>
6#include <LiquidCrystal_I2C.h>
7
8// Pinler / pins
9const int TEMP_PIN = 2; // DS18B20 veri, 4,7 kΩ ile 5V'a / data, 4.7 kΩ pull-up to 5V
10const int LED_PIN = 5; // MOSFET kapısı, PWM / MOSFET gate, PWM
11const int HEATER_PIN = 7; // ısıtıcı rölesi / heater relay
12const int BUZZER_PIN = 8; // aktif buzzer, alarm / active buzzer, alarm
13const int SERVO_PIN = 9; // yemleme servosu / feeder servo
14
15// Ayarlar / settings
16const float SETPOINT = 25.0; // hedef su sıcaklığı (°C) / target water temperature
17const float HYST = 0.3; // histerezis ±°C / hysteresis ±°C
18const float MAX_TEMP = 30.0; // üstünde ısıtıcı kesilir, alarm çalar / heater off + alarm above this
19const bool RELAY_ACTIVE_LOW = true; // çoğu röle modülü LOW ile çeker / most modules switch on LOW
20const long SUNRISE = 9L * 3600; // gün doğumu başlangıcı 09:00 (s) / sunrise starts 09:00
21const long SUNSET = 20L * 3600; // gün batımı başlangıcı 20:00 (s) / sunset starts 20:00
22const long RAMP = 3600; // geçiş 60 dakika (s) / 60-minute ramp
23const int FEED_TIMES[2] = {8 * 60, 18 * 60}; // yemleme 08:00 ve 18:00 (dk) / feeding at 08:00 and 18:00
24const bool FAST_ON_SUNDAY = true; // pazar günü yem yok / no food on Sundays
25
26RTC_DS3231 rtc; // DS1307 için: RTC_DS1307 rtc; / for DS1307
27OneWire oneWire(TEMP_PIN);
28DallasTemperature sensors(&oneWire);
29Servo feeder;
30LiquidCrystal_I2C lcd(0x27, 16, 2);
31
32float waterTemp = NAN;
33bool heaterOn = false;
34long lastFeedKey = -1;
35unsigned long lastRequest = 0;
36
37void setHeater(bool on) {
38 heaterOn = on;
39 digitalWrite(HEATER_PIN, (on != RELAY_ACTIVE_LOW) ? HIGH : LOW);
40}
41
42// Günün saniyesine göre ışık 0-255 / light 0-255 from the second of the day
43int lightLevel(long s) {
44 long level;
45 if (s < SUNRISE || s >= SUNSET + RAMP) level = 0; // gece / night
46 else if (s < SUNRISE + RAMP) level = (s - SUNRISE) * 255 / RAMP; // doğuş / sunrise
47 else if (s < SUNSET) level = 255; // gündüz / day
48 else level = (SUNSET + RAMP - s) * 255 / RAMP; // batış / sunset
49 return level * level / 255; // göz için gama / gamma for the eye
50}
51
52void feed() {
53 feeder.attach(SERVO_PIN);
54 feeder.write(180); // kabı devir, yem düşer / tip the cup, food drops
55 delay(700);
56 feeder.write(0); // geri dön / return
57 delay(700);
58 feeder.detach(); // beklerken titreşmesin / no jitter while idle
59}
60
61void setup() {
62 pinMode(HEATER_PIN, OUTPUT);
63 pinMode(LED_PIN, OUTPUT);
64 pinMode(BUZZER_PIN, OUTPUT);
65 setHeater(false);
66 sensors.begin();
67 sensors.setResolution(12);
68 sensors.setWaitForConversion(false); // beklemeden ölç / non-blocking conversion
69 sensors.requestTemperatures();
70 lastRequest = millis();
71 lcd.init();
72 lcd.backlight();
73 if (!rtc.begin()) {
74 lcd.print(F("RTC ?"));
75 while (true) {} // ısıtıcı kapalı kalır / heater stays off
76 }
77 if (rtc.lostPower()) rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // saati derleme anına kur / set to compile time
78}
79
80void loop() {
81 if (millis() - lastRequest < 1000) return; // saniyede bir çalış / run once per second
82 float t = sensors.getTempCByIndex(0);
83 sensors.requestTemperatures();
84 lastRequest = millis();
85
86 // Isıtıcı: histerezis + güvenlik / heater: hysteresis + safety
87 bool valid = (t != DEVICE_DISCONNECTED_C) && (t != 85.0) && (t > 0.0);
88 waterTemp = valid ? t : NAN;
89 if (!valid || t >= MAX_TEMP) setHeater(false); // sensör hatası ya da aşırı sıcak / fault or overheating
90 else if (t <= SETPOINT - HYST) setHeater(true);
91 else if (t >= SETPOINT + HYST) setHeater(false);
92 digitalWrite(BUZZER_PIN, (!valid || t >= MAX_TEMP) ? HIGH : LOW);
93
94 // Işık ve yemleme / light and feeding
95 DateTime now = rtc.now();
96 long sec = now.hour() * 3600L + now.minute() * 60L + now.second();
97 int level = lightLevel(sec);
98 analogWrite(LED_PIN, level);
99 int minuteOfDay = now.hour() * 60 + now.minute();
100 long feedKey = now.day() * 1440L + minuteOfDay; // aynı dakikada bir kez / once per minute slot
101 bool fastDay = FAST_ON_SUNDAY && now.dayOfTheWeek() == 0;
102 for (int i = 0; i < 2; i++) {
103 if (minuteOfDay == FEED_TIMES[i] && feedKey != lastFeedKey && !fastDay) {
104 lastFeedKey = feedKey;
105 feed();
106 }
107 }
108
109 // Ekran / display
110 lcd.setCursor(0, 0);
111 if (valid) {
112 lcd.print(t, 1);
113 lcd.print(heaterOn ? F("C HEAT ON ") : F("C HEAT OFF "));
114 } else {
115 lcd.print(F("SENSOR ERROR! "));
116 }
117 char line[17];
118 snprintf(line, sizeof(line), "%02d:%02d LED %3d%% ", now.hour(), now.minute(), level * 100 / 255);
119 lcd.setCursor(0, 1);
120 lcd.print(line);
121}| Line | What does it do? |
|---|---|
| sensors.setWaitForConversion(false) | Starts the temperature conversion in the background, so loop() doesn't wait 750 ms |
| t != DEVICE_DISCONNECTED_C && t != 85.0 | Treats a disconnected sensor (-127) and the power-on value (85) as errors and turns the heater off |
| t <= SETPOINT - HYST / t >= SETPOINT + HYST | Hysteresis: on at 24.7 °C, off at 25.3 °C |
| level * level / 255 | Gamma correction; the sunrise looks natural to the eye |
| feedKey != lastFeedKey | Makes sure the servo runs only once in the same feeding minute |
| now.dayOfTheWeek() == 0 | Skips feeding on Sunday (fasting day) |
| rtc.adjust(DateTime(F(__DATE__), F(__TIME__))) | If the RTC battery died, sets the clock to the moment the code was compiled |
Monitoring from your phone with the ESP32
The ESP32 version uses the same thermostat and lighting logic, but it gets the time from the internet (NTP) instead of an RTC and shows the aquarium's status on a web page on your home network. Type the IP address printed in the Serial Monitor into your phone's browser and you'll see the temperature, heater state and light percentage; the page refreshes every 10 seconds. The /json address returns the same data in a format home automation systems can read easily. The time zone line is written for Central Europe and switches to summer time on its own; for other regions, change the time zone string (the comment shows the one for Turkey). The code starts working without waiting for Wi-Fi: even if the router is off, heater control continues, and only the lighting schedule waits until the time is available. If you want to add the feeder servo to the ESP32, you can use the ESP32Servo library.
1#include <WiFi.h>
2#include <WebServer.h>
3#include <OneWire.h>
4#include <DallasTemperature.h>
5#include <time.h>
6
7const char *WIFI_SSID = "AgAdi"; // Wi-Fi adın / your Wi-Fi name
8const char *WIFI_PASS = "Sifre123"; // Wi-Fi şifren / your Wi-Fi password
9const char *TZ_INFO = "CET-1CEST,M3.5.0,M10.5.0/3"; // Orta Avrupa, yaz saatiyle / Central Europe with DST; Türkiye: "<+03>-3"
10
11const int TEMP_PIN = 4; // DS18B20, 4,7 kΩ ile 3V3'e / 4.7 kΩ pull-up to 3V3
12const int LED_PIN = 25; // MOSFET kapısı / MOSFET gate
13const int HEATER_PIN = 26; // ısıtıcı rölesi / heater relay
14const bool RELAY_ACTIVE_LOW = true;
15const float SETPOINT = 25.0, HYST = 0.3, MAX_TEMP = 30.0;
16const long SUNRISE = 9L * 3600, SUNSET = 20L * 3600, RAMP = 3600; // saniye / seconds
17const int PWM_FREQ = 1000, PWM_RES = 10; // 10 bit: 0-1023, daha yumuşak doğuş / smoother sunrise
18
19#if ESP_ARDUINO_VERSION_MAJOR < 3
20const int LED_CH = 0; // 2.x: LEDC kanalı / LEDC channel
21#endif
22
23OneWire oneWire(TEMP_PIN);
24DallasTemperature sensors(&oneWire);
25WebServer server(80);
26float waterTemp = NAN;
27bool heaterOn = false;
28int lightDuty = 0;
29unsigned long lastRequest = 0;
30
31void setHeater(bool on) {
32 heaterOn = on;
33 digitalWrite(HEATER_PIN, (on != RELAY_ACTIVE_LOW) ? HIGH : LOW);
34}
35
36void ledWrite(int duty) {
37#if ESP_ARDUINO_VERSION_MAJOR >= 3
38 ledcWrite(LED_PIN, duty); // 3.x: pin
39#else
40 ledcWrite(LED_CH, duty); // 2.x: kanal / channel
41#endif
42}
43
44int lightLevel(long s) { // 0-1023
45 long level;
46 if (s < SUNRISE || s >= SUNSET + RAMP) level = 0;
47 else if (s < SUNRISE + RAMP) level = (s - SUNRISE) * 1023 / RAMP;
48 else if (s < SUNSET) level = 1023;
49 else level = (SUNSET + RAMP - s) * 1023 / RAMP;
50 return level * level / 1023; // gama / gamma
51}
52
53void handleRoot() {
54 String html = "<!DOCTYPE html><html><head><meta charset='utf-8'>"
55 "<meta name='viewport' content='width=device-width,initial-scale=1'>"
56 "<meta http-equiv='refresh' content='10'><title>Aquarium</title></head>"
57 "<body style='font-family:sans-serif;text-align:center'><h2>BlueGrays Aquarium</h2>";
58 html += "<p style='font-size:48px'>" + (isnan(waterTemp) ? String("--") : String(waterTemp, 1)) + " °C</p>";
59 html += "<p>Heater: " + String(heaterOn ? "ON" : "OFF") + "</p>";
60 html += "<p>Light: " + String(lightDuty * 100 / 1023) + " %</p></body></html>";
61 server.send(200, "text/html", html);
62}
63
64void handleJson() { // ev otomasyonu için / for home automation
65 String json = "{\"temp\":" + (isnan(waterTemp) ? String("null") : String(waterTemp, 2)) +
66 ",\"heater\":" + String(heaterOn ? "true" : "false") +
67 ",\"light\":" + String(lightDuty) + "}";
68 server.send(200, "application/json", json);
69}
70
71void setup() {
72 Serial.begin(115200);
73 pinMode(HEATER_PIN, OUTPUT);
74 setHeater(false);
75#if ESP_ARDUINO_VERSION_MAJOR >= 3
76 ledcAttach(LED_PIN, PWM_FREQ, PWM_RES);
77#else
78 ledcSetup(LED_CH, PWM_FREQ, PWM_RES);
79 ledcAttachPin(LED_PIN, LED_CH);
80#endif
81 sensors.begin();
82 sensors.setWaitForConversion(false);
83 sensors.requestTemperatures();
84 lastRequest = millis();
85
86 WiFi.mode(WIFI_STA);
87 WiFi.begin(WIFI_SSID, WIFI_PASS); // beklemiyoruz: Wi-Fi yokken de ısıtıcı çalışır / no waiting: heater works offline too
88 configTzTime(TZ_INFO, "pool.ntp.org"); // saat internetten / time from the internet
89 server.on("/", handleRoot);
90 server.on("/json", handleJson);
91 server.begin();
92}
93
94void loop() {
95 server.handleClient();
96 static bool ipShown = false;
97 if (!ipShown && WiFi.status() == WL_CONNECTED) {
98 Serial.println(WiFi.localIP()); // tarayıcıya bu adresi yaz / open this address in a browser
99 ipShown = true;
100 }
101 if (millis() - lastRequest < 1000) return;
102 float t = sensors.getTempCByIndex(0);
103 sensors.requestTemperatures();
104 lastRequest = millis();
105
106 bool valid = (t != DEVICE_DISCONNECTED_C) && (t != 85.0) && (t > 0.0);
107 waterTemp = valid ? t : NAN;
108 if (!valid || t >= MAX_TEMP) setHeater(false);
109 else if (t <= SETPOINT - HYST) setHeater(true);
110 else if (t >= SETPOINT + HYST) setHeater(false);
111
112 struct tm now;
113 if (getLocalTime(&now, 0)) { // saat alınmadan ışığa dokunma / wait for a valid time
114 long s = now.tm_hour * 3600L + now.tm_min * 60L + now.tm_sec;
115 lightDuty = lightLevel(s);
116 ledWrite(lightDuty);
117 }
118}Safety measures: what happens if the controller fails?
- Sensor failure: If the DS18B20 disconnects or can't be read, the code turns the heater off and sounds the alarm; it never heats without a sensor.
- Overheat limit: If the water reaches 30 °C, the heater is cut no matter what the thermostat says.
- Backup thermostat: Set the heater's own dial 1–2 °C above the target; even if the relay contact welds, the water can't heat up without limit.
- Normally open contact: Connect the heater to the relay's NO (normally open) terminal; if the Arduino loses power, the heater turns off too.
- Against lock-ups: Using a watchdog is a good idea for a controller that runs for a long time; see how in the Arduino watchdog timer article.
- Independent check: Put a simple glass thermometer in the tank and glance at it once a day; however good the electronics are, a second pair of eyes is a must.
Common mistakes and fixes
| Symptom | Likely cause | Fix |
|---|---|---|
| Temperature always -127 °C | No pull-up resistor or broken data wire | Fit 4.7 kΩ between data and VCC, check the cable |
| Temperature shows 85 °C | Read before the conversion finishes, or weak power | Make sure there are at least 750 ms between request and read in the code |
| Relay keeps clicking | Hysteresis too small | Set HYST to 0.3–0.5 °C |
| Relay works backwards | The module triggers on HIGH | Set RELAY_ACTIVE_LOW to false |
| LED strip doesn't light or is very dim | The MOSFET doesn't fully turn on at 5 V | Use a logic-level MOSFET such as the IRLZ44N |
| LED doesn't work on D9 | The Servo library uses Timer1 | Connect the LED to D5 or D6 |
| The clock resets after every power cut | The RTC coin cell is flat or missing | Replace the CR2032 and set the time again |
Ideas for expanding the system
- Water quality: Track dissolved solids with a TDS sensor and get a reminder when it's time for a water change; the TDS sensor article is enough to get started.
- Automatic top-off: Replace evaporated water with a float switch and a small pump; the wiring is in the float level sensor article.
- Telegram alert: Have the ESP32 message your phone when the temperature limit is exceeded; see the ESP32 Telegram bot guide.
- Moonlight: Add a blue WS2812B strip at very low brightness for the night.
- Filter monitoring: Measure the current the filter draws with an ACS712 current sensor and raise an alarm if the filter stops.
An Arduino aquarium controller combines sensor reading, thermostat logic, PWM, a real-time clock and safe design in a single project, and once it's done it's useful every day. Test it on the bench first with a lamp instead of the heater, and move to the aquarium only after you're sure everything works correctly. In the BlueGrays app you'll find the projects that make up this system, such as temperature and humidity with the DHT11, the RTC clock module, the I2C LCD, servo control and a smart watering station, step by step with circuit diagrams and code.
Frequently asked questions
Can an Arduino control an aquarium heater?
Yes. A waterproof DS18B20 measures the temperature and the Arduino switches the heater on and off with a relay or SSR. Using hysteresis and setting the heater's own thermostat slightly above the target as a backup makes the system both stable and safe.
Which temperature sensor is best for an aquarium?
The most common and practical choice is the waterproof DS18B20 in a stainless steel probe. It can be fully submerged, measures with 0.0625 °C resolution and lets you connect several sensors on the same single data wire.
What wattage aquarium heater do I need?
The rule of thumb is about 1 W per litre; for a 60-litre tank, 50–75 W is fine, or 100 W in a cold room. Don't buy a heater much bigger than you need, because an oversized one can heat the water very quickly if something fails.
How many hours a day should aquarium lights be on?
For most planted aquariums, 8–10 hours a day is enough. Longer lighting encourages algae growth; count the sunrise and sunset fades as part of that time.
Why does my DS18B20 read -127 or 85 °C?
-127 means the sensor didn't respond at all; usually the 4.7 kΩ pull-up is missing or the wire is broken. 85 is the sensor's power-on value and shows it was read before the conversion finished. In both cases the controller should turn the heater off.
DS1307 or DS3231 for an aquarium controller?
The DS3231 drifts about one minute per year thanks to its temperature-compensated crystal, while the DS1307 can lose a few seconds a day. The DS3231 is the better choice so your lighting and feeding times don't drift over months, and you can use either one by changing a single line in the code.
Projects to build after reading this
See all projects
Temperature and Humidity with DHT11
How warm is your room, and is the air humid or dry? The DHT11 sensor measures temperature and humidity, and the Arduino writes the values on a two-line LCD screen, refreshing every couple of seconds.

Temperature Measurement with NTC and 2x16 Lcd Display
Measure the temperature around you with a sensor that looks like a tiny bead. This part, called an NTC, lets electricity through more easily as it warms up; the Arduino reads that change, turns it…

Using LCD Screen with I2C
Give your Arduino its own screen and make it write its first message. The two-line LCD screen hooks up with just a few wires; a greeting appears on the top line, then a second message on the bottom…

DS1302 RTC Clock Module Setup
You get a small clock module running that never forgets the time, even when the Arduino is switched off.

Using a Servo Motor
The arm of a small servo motor turns to three positions in turn: all the way to the start, right to the middle and all the way to the end, waiting two seconds at each stop.

Smart Irrigation Station
A gardener that waters your plants on its own, so they don't dry out while you're on vacation.

ESP32 Temperature Data Logger (DHT22 + DS1307 RTC + microSD + OLED)
Build a timed temperature and humidity logger with the ESP32! A DHT22 sensor reads temperature and humidity once a minute, and each reading is saved to a microSD card in CSV format with a real-time stamp from the DS1307 RTC module. The OLED display shows the latest temperature, humidity, timestamp and total number of records live, in large text.
More articles
BlueGrays app
Build this circuit step by step on your phone
Wiring diagram, code and parts list on one screen. 500+ Arduino, ESP32, ESP8266, Pico, mBot and micro:bit projects ready to build.
Scan with your phone
Point your camera at the code and your phone's app store opens.
or open the store

