18-Channel PWM Aquarium Lights Provide Habitat-Like Life For Fish

Aquarium with variable LEDs

Whether you want to keep your fish happy or just need a good light show, this aquarium light fits the bill. It is the second iteration, but [William] calls it v1. That’s because v0 — which used a few loops of LED strips — never really met his requirements.

This build uses just six LEDs, each a 30 Watt RGB monster! To source about 350 mA for each, and to control brightness with 18-channels of pulse width modulation, he had to plan very carefully. This meant a proper aluminum project box and a beefy, fan-cooled power supply.

The driver board is his own design, and he etched a huge board to hold all of the components. Everything is driven by an Arduino Mega, which has 16 hardware PWM channels; two short of what he needed. Because of this he had to spend a bit of time figuring out how best to bit-bang the signals. But he’s putting them to good use, with fish-pleasing modes like “sunset” or the “passing rainbow” pattern which is shown in the image above.

If you need something a little less traditional why not house your fish in a computer case, complete with LED marquee for displaying data.

14 thoughts on “18-Channel PWM Aquarium Lights Provide Habitat-Like Life For Fish

    1. I looked at the drive circuit and scratched my head. I read that the drive source was PWM and then saw MOSFETS as the drivers, fair enough. Then I saw that the MOSFET is using a linear mode for current limiting and added to that is a second passive resistor also used for current limiting, perhaps to ease the thermal dissipation from the MOSFET.

      The resistors (18 of them) are 10W so that’s a huge whopping 180 Watts of potential thermal dissipation and from a PWM drive WTF? It looks like the plastic covers have melted, any wonder!

      Anyway. getting back to your suggestion of using a PCA9685, the problem is that the PWM maxes out at about 1KHz **I’f I am reading the datasheet correctly** and the 9635 runs to about 100KHz. They mention some (FM+) series but I don’t know what that’s about, seems like it maxes at 1MHz.

      Anyway, If you are starting from PWM then why, oh why then have a linear drive output.

      I suggest using one of the chips you mentioned that will run in 1xKHz or 1xxKHz range like a SMPSU. Then you can use small inductors in the output filtering stage. The higher the PWM frequency the small the inductors can be. At 1KHz you would need inductors that are too large.

      This would bring your thermal dissipation down, probably by a factor of 50 – 100.

      I don’t know why people seem afraid of inductors.

      Capacitive Reactance (Impedance) is –
      Xc = 1 / (2 * pi * f * C) where
      Xc = Capacitive Reactance on Ohms
      f = Frequency in Hz
      C = Capacitance in Farads

      Inductive Reactance is simply –
      Xl = 2 * pi * f * L
      Where Xl = Inductive Reactance on Ohms
      and L is inductance in Henry’s

      If you match the inductance to the center of your PWM switching frequency (50% duty cycle) then you have a magic resistor that drops voltage (AC) without dissipating heat, well very very little.

      Inductor ferrite’s are cheep, copper wire is cheep, you just need a meter that measures Inductance or just buy them pre made.

      So if he just up’s the PWM frequency then he can replace the 10 Watt resistor with an inductor and perhaps place a cap from the led side of the inductor to ground and there goes all that heat. The uC should be programmed so that the MAX PWM output is close to the MAX current for the leds otherwise the existing current limiter would still drive the MOSFET in linear mode. Even so, the Linear mode current limit should stay as a safeguard so that programming errors don’t melt the LED’s.

      1. He is not dropping 10 watt’s per channel, he is not maxing out the resistors. The red channels which have a voltage drop at around 12 volt is wasting close to 4 watt’s at full brightness and the other channels only around 1.5 watt. So if all led’s is on at full brightness we’re looking at something like 40 watt’s of waste.
        Yeah, he should definitely use some buck converters. A quick Google search lead me to a chip HV9910B witch seems to make it very easy to build some buck converters for led’s, and there are properly other chips who does the same thing.

    2. That’s a perfectly good reason for using it… I currently have an $8 (per single chip) c2000 MCU running an array of same colour (non independently controlled) LEDs and a few 7-segment displays because I had a few lying around. Nothing short of insane overkill but I had them and didn’t have any other immediate uses…

      I can’t imagine that this kind of thing is uncommon – $30 IGBT in a 555 based boost for nixie tubes just because I had some spares… List goes on/

      1. I actually used a MOSFET in 4 pin dip for my Nixie high voltage supply for a 20 digits Nixie display. The part doesn’t even get warm as it was driven correctly with a proper PWM controller and gate driver so it switches quickly.

        Using larger MOSFET actually lowers the efficiency as you are not driving the gate capacitance with proper drivers thus low rise/fall time and your MOSFET will spend time in linear mode instead being a switch.

        Everytime I see someone with a heatsink and a TO220 MOSFET, I LOL very hard.

    1. To me ‘bit banging’ is to use code to toggle GPIO pins to implement a hardware feature that the micro-controller does not have.

      In this case he is toggling GPIO (mode) pins to implement PWM so yeah, it’s bit banging by my definition.

  1. Nice project.

    Given the large number of channels, I can understand why [William] would sacrifice some efficiency to simplify the design and get ‘er done.

    But the lack of a video demoing travelling rainbow and other modes is sorely needed. ;)

    Also, a suggestion. For controlling the brightness of more LED channels than you have hardware PWMs, consider MIBAM (Mirror Imaged Bit Angle Modulation) instead. It lends itself to the task better than trying to emulate multiple PWMs in software. And though it’s looks complex at first glance, once you understand it, it’s dead simple. Description, and a interactive Flash demo (which really helps), here:


    Going from the description alone, I implemented this from scratch on a PIC24 in a couple of evenings. MIBAM (at 500hz and 9-bit PWM equivalent) uses only a single timer interrupt, plus about 5% of the CPU time. Any number of arbitrary pins can be controlled, even up to every available pin on the device, with *zero* increase in CPU time – so long as the brightness on those pins doesn’t change. While *changing* the brightness of a pin does require some additional overhead, that doesn’t have to be done more frequently than 30hz, so it doesn’t add up to much.

  2. Do fish like flickering lights ?

    Could the heat from the LEDs be used to warm up the water?

    Since the circuit is linear anyway, why not control the transistors linearly? This way you get continuous light instead of flickering. Less emissions and easier on the power supply.

    1. I’m no ichthyologist, but considering what the light looks like on the bottom of a pool, I’d assume fish have to be pretty tolerant of moderate flickering.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.