Teaching your fish tank LEDs new tricks

for just a few bucks and you can even make some virtual clouds

In this project I'll upgrade a cheap fish tank LED light to be dimmable, controllable via Wifi and'll implement a "cloudy mode".

Hacking an aquarium light

On one of my beloved slow saturdays my girlfriend and I decided that we'd have to clean the fish tank since it's growing over and the fish look sad.

Before the cleaning

After the cleaning and pruning

Well you might not seet it but it's much cleaner now and it took us about 3 hours.


Our fish tank has one of them cheap 17€ LED lights from Amazon.

Cheap fish tank light

This light has basically three modes:

  1. All LEDs full power
  2. Only blue LEDs full power (they call it moonlight)
  3. Off

While cleaning I took it apart and thought this dumb light is ready to learn new tricks.

Cheap fish tank light

The lamp comes with a 20v power supply and I measured it uses only about 270mAh when all LEDs are active. This screams for some esp2866 controller if you ask me.

Let's upgrade this cheap lamp

Measuring the amps of the lamp

The whole board is very simple as it uses only SMD components and has two power lines. One for all LEDs and one for just the blue ones.

The simple layout of this board

So I figured I just put two N-channel mosfets on this board, slap a NodeMCU (ESP2688) on it and control it via wifi.

Checking the LEDs

Prototyping with the Mosfet

Prototype

Schematics

Control it via Wifi

I use a 4€ NodeMCU board from Aliexpress to control everything. This thing has enough PWM enabled GPIO pins to take care of everything we might need.

Set it up

To program the NodeMCU thing I use the Arduino IDE. Here is a simple tutorial on how to set it up: http://www.instructables.com/id/Quick-Start-to-Nodemcu-ESP8266-on-Arduino-IDE/

Now let's just push the code to your NodeMCU and you're almost done

Get the code here

Control it

The code runs a HTTP server on the NodeMCU and you can control it via a webserver by accessing the IP and then use either "blu" or "all", hyphen and the intensity from 0 (off) to 1023 (full power on)

Congratulations now you can control your fish tank lights from your PC

Next we'll program the "cloudy mode" that only the more expensive lights have. Here is my implementation in Bash:

#!/bin/bash

allleds() {
  curl -s "http://192.168.1.174/all $1" > /dev/null 2>&1
}

blueleds() {
  curl -s "http://192.168.1.174/blu $1" > /dev/null 2>&1
}

setfadingtime() {
  curl -s "http://192.168.1.174/fad $1" > /dev/null 2>&1
}

setfadingtime 10 #setting fading time to 10 ms between each step so it seems smoother

while true; do
  intensity=$((500 + RANDOM % 523))
  allleds $intensity
  sleep 0.2
done

Looks awesome (sped up so you can see it better)

Also you can now set cronjobs to turn the lights off or dim them at night.

What else can you think of?

Tags: diy hacking fishtank

Comment using SSH! Info
ssh fb08b@ssh.blog.haschek.at

Comments


Get new posts by email
(~ one email every couple of months & no spam)