DIY aquarium lights

Buy a new aquarium, and you often get hood lights that are ... meh. They're good enough, but not great.

There are plenty of high-quality replacement lights out there, but none of them had the nice, low profile of the plastic covers that came with this tank. So I decided to spruce up the existing illumination with some DYI lights — and even make them programmable with an Arduino.

That was more than a year ago. Now in coronavirus isolation, I finally made it happen.

Here's how.

The parts

Mainly I wanted to supplement the existing lights, resist the moisture of the tank, allow me to tinker with the LED colors, keep the hoods easy to remove, and keep the electronics at a distance, in the cabinet under the aquarium.

Usually I buy RGB Neopixel strips, and if I need white I "make" white by lighting the red, green, and blue LEDs. In this case, though, I bought an RGBW strip, with the additional white LED. 

So here's everything I used, in addition to the aquarium covers I already had:

I also used a regular breadboard and jumper wires for experimenting before I soldered everything together.

The circuit

Much tinkering happened, mostly me trying to get away with one power supply to feed both the Trinket Pro and the Neopixels. In the end, it worked best to have separate power for each, which is what Adafruit recommends anyway. 

Here's how I wired things up:

The aquarium top has two halves, and in each half I wanted two strips of Neopixels — so I have two pair of strips.

Power for both strips in a pair originates at the same point, which ensures no LED is too far away from power. The data wire, however, must follow the data flow (note the arrows on the strips), so it had to connect at the other ends (via the single green wires).

If you're doing this yourself, be sure to check the labels on the strips! They are sometimes different for different batches. Also note that "Din" is the data-in and "Dout" is data-out.

One deviation I made from Adafruit's Neopixel guidelines is that I ditched the 470-ohm resistors on the data lines. Given the length of cable between my Trinket Pro and the lights themselves (about 6 feet), I found the Neopixels didn't respond when the resistor was in place, possibly because the resistor and the distance degraded the data signal too much.

Also Adafruit says using a 3-volt Trinket Pro with 5-volt Neopixels can be problematic, but it wasn't for me.

The code

I started with the Neopixel RGBW "strand test" example code and modified it to light up the strips on power-up. (The power strip these will be plugged into is on a mechanical timer.)

Since I'm running two separate pairs of strips, I decided to use two separate data pins ... which means initializing two separate "strip" objects in the code, "strip" and "strip2." These get activated once, in the startup function. Nothing happens in the loop function.

I added code to sprinkle the strips with a few blue and red LEDs, which fish people say are good for the plants. I'm dubious about whether the spectra of these LEDs are exactly what the plants need, but I'm giving it a whirl.

The assembly

Testing the code.

Preparing the wires to solder onto the Neopixel strip. This is for the main connection to each pair, and includes both the wire ends of the 3-pin cable connector (for power, data, and ground) along with two wires headed toward the pair's other strip (power and ground). I make a 2-wire cable by stripping two of the wires off the 4-wire spool.

Soldered the main connection to the Neopixels. (Ignore the photobombing solder.)

The loose lead will go to the second strip in this pair. I also sealed the ends of the strip with a bunch of the E6000 glue.

The brains, wired up, with a little Trinket Pro running the lights. The loop on the right is strain-relief so I don't yank the wires out of the board. 

The finished main components ... sans hoods and power supplies. On the long leads you can see where I used the Sugru to seal and protect the joints between the raw wire and the cable connectors. In hindsight, I should have used heat-shrink tubes to make it prettier and maybe stronger.

I glued the strips into the hoods using E6000 glue, and also gooped on a bunch more at the ends of the strips.

You can see the original lights in the middle, which I'm supplementing.