Archive for July, 2011

LED Aquarium Lighting System

July 31, 2011

I am finished developing the LED Aquarium lighting system.  I ended up using an Arduino and a power controller from Pololu.  As you can see in the picture, the electronics consists of four parts:

A) a mini uninterrupted power supply, consisting of a wall-wart (not in picture) to charge a small NiMh battery.  The power to charge the battery comes in on the black USB cable, and power is supplied to the Arduino via the white cable.  This allows the Arduino to run without interruption during brief power outages (up to a few hours)

B) the Arduino computer/controller, mounted on a clear plastic sheet.  This controls the timing and intensity of the LED lights

C) the motor/power controller.  This converts the control signals from the Arduino so that the LEDs can be controlled properly.

D) the power supply.  I’m using 11 V at the moment, although the LEDs are designed for 12 V.

Here is one of the tanks, illuminated by the LED lights.  Notice, along the top, how there are many bright spots, rather than uniform illumination.

Here is a shot of the lighting system before it was installed, looking at it from “underneath”.  There are 5 1o-watt LEDs, each of which is mounted on a heat sink.  A second system, for a different tank, has 10 LEDs.

Here is a close-up of the lights installed above one of my tanks

The Arduino code counts out 24 hours, during which there is a 1 hour “dawn”, an 11 hour “day”, and a 1 hour “dusk”.  For those of you who are interested, here is the code:

————————
// these are times in seconds
unsigned long dawnLength = 3600; // 60 * 60; // 1 hour dawn
unsigned long daylightLength = 36000; // 10 * 60 * 60; // 10 hour day (was 4294937760
unsigned long duskLength = 3600; // 60 * 60; // 1 hour dusk
unsigned long dayLength = 86400; // 24 * 60 * 60;
unsigned long dawnStart = 0;
unsigned long dayStart = dawnStart + dawnLength;
unsigned long duskStart = dayStart + daylightLength;
unsigned long nightStart = duskStart + duskLength;
// brightness levels
unsigned long moonLight = 1;
unsigned long sunLight = 200; // LEDs are running too hot: try to keep them cool
// time rate
unsigned long oneSec = 1000; // milli seconds: set nightStart) {
      v = moonLight;
      x = 4;
      }
   else if (secs > duskStart) {
      v = map(secs – duskStart, 0, duskLength, sunLight, moonLight);
      x = 3;
      }
   else if (secs > dayStart) {
      v = sunLight;
      x = 2;
      }
   else if (secs > dawnStart) {
      v = map(secs – dawnStart, 0, dawnLength, moonLight, sunLight);
      x = 1;
      }
   else {
      v = moonLight;
      x = 0;
      }
   if (testMode) {
      int xxx = secs % 4; // mod
      xxx = (xxx * 2) + 2;
      analogWrite(pwm, xxx);
      }
   else {
      analogWrite(pwm, v);
      }
   if (useSerial) {
      Serial.print(x, DEC);
      Serial.print(” Secs: “);
      Serial.print(secs, DEC);
      Serial.print(‘ ‘);
      Serial.println(v, DEC);
      }
   }

void loop () {
   currMS = millis();
   if (currMS = oneSec) {
      // one second just expired
      secs = secs + 1;
      prevMS = currMS;
      SetLights();
      }
   // day wrap-around
   if (secs >= dayLength) {
      secs = 0;
      SetLights();
      }
   }

Advertisements