Automated Aquarium Lighting

Research / Project

I wanted to figure out what was involved in creating an aquarium lighting and monitoring system. I built a Wemos ESP8266 aquarium controller combining gradual NeoPixel lighting, water-temperature sensing, an OLED status display, and optional ThingSpeak reporting.
Testing
Arduino
Wemos ESP8266
Adafruit NeoPixels
FastLED
Wi-Fi
NTP
DS18B20
SSD1306 OLED
I²C
ThingSpeak

Question

Aquarium lighting systems seem relatively simple yet are very expensive.  Could I create one that would be easy for anyone technical to build, and simple to sell as a kit for those who want an easier solution.

How can I automate my aquarium lighting while making its daily transitions look more natural and keeping useful information about the tank easy to see?  What other really useful features would be easy to add on?

The project began with a dependable daily lighting routine and pleasing changes in brightness and color, especially around sunset. It now also measures water temperature, displays the current time and lighting state, and supports remote logging. The physical installation needs to hold the lights above the aquarium and protect their connections from the surrounding environment.

Idea

A Wemos ESP8266 controller uses Wi-Fi and NTP to keep a local clock, then runs an Adafruit NeoPixel strip through a programmed daily cycle. Sunrise and sunset are simulated lighting phases at fixed times, not astronomical events calculated from the date or location.

Reusable lighting effects blend through warm red, orange, gold and blue while changing brightness gradually. Transitions use elapsed clock time, so restarting during a fade selects the corresponding point rather than replaying the whole transition.

A DS18B20 probe adds water-temperature readings, and a small OLED brings the time, temperature and current lighting phase together at the tank. Optional ThingSpeak reporting records temperature and the scheduled phase remotely. Temperature is informational: the controller does not operate a heater or adjust lighting in response to it.

Build

Hardware and mounting

  • An arduino microcontroller with WiFi and enough pins to support a neopixel string, OLED, and digital thermometer.
  • An Adafruit NeoPixel strip long enough to make four passes across the length of the aquarium.
  • A DS18B20 temperature probe.
  • A 128 × 64 SSD1306 OLED
  • A 1 × 2 × 30-inch wooden board supporting the lights, with cling wrap holding the folded strip against it. The controller and display sit on a breadboard zip-tied above the lighting board.

The original staple-mounted lighting arrangement left connections exposed to the aquarium environment. After corrosion caused the lighting to fail, I changed to cling wrap holding the strip against the board and ensure the connections were covered by the weather-proof strip protector. The existing build photographs document that arrangement; it is not a certified waterproof enclosure by any organization above Mad Magazine.

The controller uses USB power. The LED strip requires a regulated 5V supply and wiring sized for its load, with a common ground. The power-block rating in the existing installation has not been verified but seems to work fine.

Configured connections

  • Neopixel data signal uses D4/GPIO2
  • Temperature probe uses D5/GPIO14
  • OLED SDA/SCL uses D2/D1

Daily lighting cycle

Wi-Fi and NTP provide the clock, configured for US Eastern time with daylight-saving changes. FastLED drives the strip through these programmed local times:

  • 7:15–8:00 a.m.: sunrise, blending warm red through orange and gold into blue while increasing brightness.
  • 8:00 a.m.–9:00 p.m.: blue-leaning daylight.
  • 9:00–9:45 p.m.: sunset, reversing the gradient and reducing brightness.
  • 9:45–10:45 p.m.: blue moonlight across the strip.
  • 10:45–11:30 p.m.: moonset, gradually dimming the blue.
  • 11:30 p.m.–7:15 a.m.: three dim blue patches, with the remaining LEDs black.

The sunrise, sunset and moonset transitions last 45 minutes and use smoothstep easing. Night lighting wraps across midnight. At startup, the firmware sends black to the strip and waits for a valid clock before selecting a lighting phase.

Temperature and local display

The DS18B20 is sampled approximately every two seconds using asynchronous conversions. The last valid reading remains visible during normal conversions; startup or a conversion taking more than five seconds shows Measuring... instead. Invalid readings are cleared and failed or missing probes are retried. Unsupported parasite-power operation is identified separately.

The OLED shows three lines: local time, water temperature in Fahrenheit by default, and the current lighting phase. It refreshes at most twice per second. Missing sensors or displays do not stop scheduled lighting, and the firmware retries a missing display.

Optional remote reporting

ThingSpeak reporting sends temperature in Fahrenheit and a numeric lighting-phase indicator together every five minutes when configured. The phase indicator is not a measurement of LED intensity or fade progress. Uploads require Wi-Fi, valid time and a valid temperature; failed requests retry after one minute, and samples are not buffered during outages.

Software organization

The sketch coordinates separate components for timekeeping, lighting, transitions, reusable effects, temperature sensing, display and reporting. Hardware assignments are centralized in AquariumHardware.h, and a single schedule table selects the lighting effects. This makes it possible to test much of the behavior without an attached aquarium.

Source: AquariumLights on GitHub. This page was updated from the local AquariumController source and its current README; README.txt is retained there as historical notes.

Analysis

What is working

The current installation is working really well in everyday use. Revising the lighting algorithm has made the transitions look more natural and produced more pleasing sunset hues. Those observations describe use of the installation, rather than a measured long-term reliability test.

The current implementation extends the original lighting project with temperature sensing, an OLED status display and optional remote reporting. The supplied build photographs already included on this page show the assembled lighting board and controller; the controller photograph shows time, temperature and Daylight on the display.

I added an integration with a ThingSpeak Channel to monitor and report on the water temperature and lighting state.

What failed and what changed

The original staple-mounted arrangement left some NeoPixel connections exposed to the air around the aquarium. Those connections corroded, and the lighting eventually failed. I replaced that arrangement with cling wrap holding the strip against its wooden support.

The main lesson was that the physical installation matters as much as the lighting code. Improving the color sequence addressed how the aquarium looked; changing the mounting addressed the failure encountered in use. The newer software also handles unavailable time, missing peripherals and invalid readings explicitly.

What were the surprises

What I didn't consider is that different fish look better under different light frequencies: adding more blue hues really lights up our Blue Neon Tetras, adding more reds adds color to the Serpae Tetras and Pink Tuxedo guppies.  There needs to be an easy way to add or adjust the colors of the lights to best illuminate the aquarium tenants.

Verification and remaining work

Everything seems to be working great.  I've added more fish so I can learn more about setting colors to best highlight their natural beauty.