Edit: Schematic had a bug, the INT pin on the DS3234 should be connected to pin 2 on the arduino, not the 32kHz pin! I updated the schematic.

I bought a small aquarium (54l) as an impulse buy and I needed some lights for it, so naturally I wanted to use LEDs. I also needed a timer for the lights. I also wanted the lights to fade in and out when they were going on or off as a cool effect.

I ordered four Cree XP-G R5 LEDs (cool white, apparently too warm of a light will cause algae growth) and a one amp (switching) constant current supply (with PWM support) from LED-tech.de. I had some Maxim DS3234 real-time clocks with a serial bus (SPI) which looked easy to implement so I decided to use one. I also had one spare Arduino board so that was going to be my microcontroller of choice. I used a laptop power supply as the power source.

Aquarium light timer (Arduino)

Aquarium light timer (Arduino)

The PCB was a pretty simple “shield” for the Arduino, just the RTC, a CR2032 coin cell battery for RTCs memory retention and thats about it. I did manage to get a couple of bugs there though as you can see from the jump wires.

Communicating with the RTC was fairly straightforward. The most complex part of this project was the actual software and to make it easily configurable and work like I wanted it to. The software is configurable via USB (serial port) and you can change the time, the lighting period (how long the lights are on), the PWM speed (how long it takes for the lights to fade in/out), maximum brightness and set the time when the lights are supposed to go on. It also includes user input sanity checking and if the input makes no sense it will print a help page (with all the commands listed).

Aquarium lights with timer and LEDs

Aquarium lights with timer and LEDs

Aquarium with LED lighting

Aquarium with LED lighting

A happy tenant (Neocaridina heteropoda var. yellow)

A happy tenant (Neocaridina heteropoda var. yellow)

All in all I’ve been extremely satisfied with it and it has been working flawlessly for a few months now.

If you found this project interesting, please check my other projects at electronics-projects!

Also check out my KiCad tutorial at KiCad tutorial part 1

Update: Here is the schematic:

Aquarium light timer schematic

Aquarium light timer schematic

You can get the code for the timer from here: aquarium_light_rtc_timer.ino

Here is the schematic and the PCB files (made with KiCad, bugs fixed): aquarium_light_timer.zip

The PCB is drawn as a two-layer board but the bottom layer is just a groundfill so you do not actually have to etch the other side. Just etch the front-layer and leave the bottom layer unetched (just drill the through-holes a bit with a large drill bit to make sure they do not contact the ground layer if they are not supposed to).

13 Responses so far.

  1. gökhan says:

    usb bağlantı ara yüz programı hakkında bilgi verebilirmisiniz

    • If Google translate is working correctly for turkish… I’m just using a serial terminal. You can use whatever serial terminal for configuring it 🙂

  2. Pedro Doria Meunier says:

    Noob question… 🙂

    Don’t you need a BUCK Constant Current Power Supply for *each* led?

    Let’s say I’d like to build a led fixture for a 60cm reef tank… thinking of 24 leds with a 50/50 white/blue ratio..

    Would I need 24 CCPS??


    • Hey Pedro! No you do not need a CC power supply for each LED because you can put the LEDs in series. When the LEDs are in series they will get the same amount of current. What limits the amount of LEDs you can put in series is the voltage specification of the buck converter. So lets say you have a buck converter that can output 12V maximum, that would mean you could power three white LEDs with that because the forward voltage of white LEDs is usually about 3.7V (the amount of voltage drop over the LED). Bear in mind that buck converters can only DROP the voltage so if you have say four white LEDs in series (=3*3.7V=14.8V) you would need a power supply that outputs at least 14.8V (most likely a bit more).

  3. […] it. The LED lighting mechanism is all set to work. Modifications can be done to make the circuit perform an array of various other […]

  4. wlb says:

    Do you have gerber files for the PCB that you would share?

  5. Superbrain says:

    I love how you got the switching power supply to turn on and off I have been kinda looking into it but never got around to getting anything worked out.so if you could please tell me how you hooked up your power supply it would be much obliged 🙂

    • Hey, basically the constant current power supply I use (LED-tech.de BUCK 1A) has a PWM input pin (that is driven by the Arduino). The lights change brightness in relation to the PWM duty cycle. So when the PWM duty cycle is 0% the lights are off, and when it’s 100% the lights are on full power 🙂 The constant current power supply (and the arduino) are powered by a laptop power supply.

      • Superbrain says:

        so you keep the power supply on all the time or manually turn it off (unplug it)? it would be awesome if you could turn it off with your micro-controller maybe change the input of the optocoupler? I guess I got kinda excited when I thought you turned off the power supply with the micro-controller. anyway I like your build and it looks great!

        • The power supply stays on all the time. It naturally consumes little to no power when nothing is drawing current from it (when it is on but the lights are off). Not much use to turn it off 🙂

  6. […] Hyvönen] just finished building his own aquarium lights. He used four powerful soft-white LEDs, mounting them on a pair of heat sinks to keep things cool. […]

Leave a Reply