DIY LEDs - The write-up

Status
Not open for further replies.
This is why I was thinking about something other than the CREE. Just from the pictures on this forum they look insanely bright. I'm not that familiar with LED options so I was looking for an LED that was much weaker. Or would it be better just to run one of the CREEs with a REALLY weak driver?

Depends on your criteria. IMHO, you are better off running an efficient LED at low current, since that'll give you the best performance in the long term. Imagine two scenarios with equal outputs: One XR-E at low current, and 3 less-efficient models at some current that equates to the same light output. The XR-E will likely run cooler and more efficient, so it'll last longer and cost less.
 
Here is my code, that accepts a single digit number from the serial console and gradually adjusts the level of the blue and white leds. I'm using digital pins 5 and 3 for my leds:

Thanks for sharing. My sketch isn't quite in postable form yet, but I've got it working with a DS1307 real time clock to fade on separate banks of LEDs to simulate sunrise and sunset. The programming and circuit are really simple, I would definitely encourage anyone interested in automating their LED dimming to give it a try.
 
Thanks for sharing. My sketch isn't quite in postable form yet, but I've got it working with a DS1307 real time clock to fade on separate banks of LEDs to simulate sunrise and sunset.

Yep, I use DS1302 clocked with a 32.768KHz crystal for real time clock on the arduino. Haven't done the code yet to simulate day/night with sunrise and sunset but that will happen soon. It shouldn't be too hard to do. My liverock is arriving today so I'm just about to start my tank setup :)
 
You motivated me to clean up my code a bit and remove stuff that's not working yet!

This sketch will turn a master pin on and off (the idea is that the master pin will operate a 120V AC relay to turn on power to the LED drivers).

Then, it fades each of three banks up and down according to a photoperiod set by a few variables. You should be able to fiddle with the variables to get different behaviors. As is, it assumes the banks are situated to simulate east, center, and west - so, besides fading on and off, it can simulate the sun traversing the sky.

Assumptions are that your LED drivers are oriented in the three banks described above, and can take a 5v PWM signal for dimming. I power the Arduino from it's own power source, because I want it on 24/7 and able to control other equipment. If you only wanted it for LED dimming, and didn't want to bother with the real time clock, you could power it off the buckpuck's dimming circuit (like terahz) and hardcode it to dim up and down on a set photoperiod, then turn the whole thing on and off with a regular appliance timer.

I moved recently and don't have my test rig up and running yet, but there are a few other features described in the comments that I hope to have working soon.

Code:
/*
 reefLED v1.0
 der_will_zur_macht
 05 Nov 2009
 
 Arduino LED lighting controller for reef aquariums

//** Current Functionality

// **paramterized LED lighting control for reef aquariums
// Goal: control 3 banks of LED lighting - east, center, and west
//       fade the banks to simulate the sun rising, traversing the sky, and setting
// Implementation: use a DS1307 RTC to kick off lighting schedules
//                 trigger a master pin "on" when the preset start time is reached
//                 then, fade each PWM pin up and down accordingly

//** Future Functionality

// trigger "random" storms:
//   lights fade down from side to side to imitate cloud cover
//   during cloud cover, randomly strobe a bank of LEDs to imitate lightening
//   run wavemaker powerheads at higher-than-normal levels to simulate increased
//      wave action
//
// control heater based on one-wire sensor
//   On hold due to apparent conflicts between one-wire and I2C
//
// control LED moonlight
//   fade an LED moonlight according to lunar schedule
//
// control Tunze or other variable-speed powerhead to simulate wave action.
//   tie into storm simulation as noted above
//   tie into other functionality as appropriate

//**  Circuit
// 
// PWM LED pins described below connected to dimming circuits on drivers
// ledMaster pin below connected to a 120V AC relay to turn the LED drivers on and off
// grounds from drivers connected to arduino ground
// DS1307 RTC connected via I2C
//
//
//
*/

// Pins to control LEDs
int eastLed = 9;     // LED PWM channel for east end
int centerLed = 10;  // LED PWM channel for center
int westLed = 11;    // LED PWM channel for west end
int ledMaster = 8;   // Master channel to control LED powersupply

// Set up RTC
#include "Wire.h"
#define DS1307_I2C_ADDRESS 0x68

// RTC variables
byte second, rtcMins, oldMins, rtcHrs, oldHrs, dayOfWeek, dayOfMonth, month, year;

// Other variables. These control the behavior of lighting.
int minCounter = 0;         // counter that resets at midnight
int ledStartMins = 480;    // minute to start lights
int photoPeriod = 510;     // photoperiod in minutes
int photoStagger = 60;      // minutes to stagger photoperiods for each bank

void setup()  { 
  pinMode(ledMaster, OUTPUT);  // Set the LED master pin as output

// init I2C 
  Wire.begin();

// if you will be using the print commands below for debugging, uncomment next line
  // Serial.begin(9600);

  // Change these values and uncomment to set RTC.
  // format is: second, minute, hour, dayOfWeek, dayOfMonth, month, year
  // setDateDs1307(10, 30, 18, 3, 22, 9, 9);
} 

/****** LED Functions ******/
/***************************/
//function to set LED brightness according to time of day
//function has three equal phases - ramp up, hold, and ramp down
void setLed(int mins, int ledPin, int start, int period)  {
  if (mins > start && mins <= start + (period / 3) )  {
    analogWrite(ledPin, map(mins - start, 0, period/3, 0, 255));
  }
    if (mins > start + (period / 3) && mins <= start + 2*(period / 3))  {
    analogWrite(ledPin, 255);
  }
    if (mins > start + 2*(period / 3) && mins <= start + period)  {
    analogWrite(ledPin, map(mins - (start + 2*(period/3)), 0, (period/3), 255, 0));
  }
}

/***** RTC Functions *******/
/***************************/
// Convert normal decimal numbers to binary coded decimal
byte decToBcd(byte val)
{
  return ( (val/10*16) + (val%10) );
}

// Convert binary coded decimal to normal decimal numbers
byte bcdToDec(byte val)
{
  return ( (val/16*10) + (val%16) );
}

// 1) Sets the date and time on the ds1307
// 2) Start the clock
// 3) Set hour mode to 24 hour clock
void setDateDs1307(byte second,        // 0-59
                   byte minute,        // 0-59
                   byte hour,          // 1-23
                   byte dayOfWeek,     // 1-7
                   byte dayOfMonth,    // 1-28/29/30/31
                   byte month,         // 1-12
                   byte year)          // 0-99
{
   Wire.beginTransmission(DS1307_I2C_ADDRESS);
   Wire.send(0);
   Wire.send(decToBcd(second));
   Wire.send(decToBcd(minute));
   Wire.send(decToBcd(hour));
   Wire.send(decToBcd(dayOfWeek));
   Wire.send(decToBcd(dayOfMonth));
   Wire.send(decToBcd(month));
   Wire.send(decToBcd(year));
   Wire.endTransmission();
}

// Get the date and time from the ds1307
void getDateDs1307(byte *second,
          byte *minute,
          byte *hour,
          byte *dayOfWeek,
          byte *dayOfMonth,
          byte *month,
          byte *year)
{
  Wire.beginTransmission(DS1307_I2C_ADDRESS);
  Wire.send(0);
  Wire.endTransmission();

  Wire.requestFrom(DS1307_I2C_ADDRESS, 7);

  *second     = bcdToDec(Wire.receive() & 0x7f);
  *minute     = bcdToDec(Wire.receive());
  *hour       = bcdToDec(Wire.receive() & 0x3f);
  *dayOfWeek  = bcdToDec(Wire.receive());
  *dayOfMonth = bcdToDec(Wire.receive());
  *month      = bcdToDec(Wire.receive());
  *year       = bcdToDec(Wire.receive());
}

/***** Main Loop ***********/
/***************************/
void loop()  { 
  // get time from RTC and put in hrs and mins variables
  getDateDs1307(&second, &rtcMins, &rtcHrs, &dayOfWeek, &dayOfMonth, &month, &year);
  minCounter = rtcHrs * 60 + rtcMins;
  //uncomment these print commands for debugging. Useful to verify that the clock is set correctly
/*  Serial.print(rtcHrs, DEC);
  Serial.print(":");
  Serial.print(rtcMins, DEC);
  Serial.print(":");
  Serial.print(second, DEC);
  Serial.print(" ");
  Serial.print(dayOfMonth, DEC);
  Serial.print("/");
  Serial.print(month, DEC);
  Serial.print("/");
  Serial.print(year, DEC);
  Serial.print(" ");
  Serial.print("Start At: ");
  Serial.print(ledStartMins);
  Serial.print(" Counter: ");
  Serial.print(minCounter);
  Serial.print(" End: ");
  Serial.println(ledStartMins + photoPeriod + 2*photoStagger);
*/

  // determine if it is day or night, and act accordingly
  if (minCounter > ledStartMins && minCounter < ledStartMins + photoPeriod + 2*photoStagger)  {   //day
    // set LED states
    digitalWrite(ledMaster, HIGH);
    setLed(minCounter, eastLed, ledStartMins, photoPeriod);
    setLed(minCounter, centerLed, ledStartMins + photoStagger, photoPeriod);
    setLed(minCounter, westLed, ledStartMins + 2*photoStagger, photoPeriod);
  }
  else  {   //night
    digitalWrite(ledMaster, LOW);
    analogWrite(eastLed, 0);
    analogWrite(centerLed, 0);
    analogWrite(westLed, 0);
  }
  delay(1000);
}

You guys think we should do a separate thread for the Arduino stuff, or leave it in here?
 
You guys think we should do a separate thread for the Arduino stuff, or leave it in here?

i like seperate threads....just for the convience of finding one portion of the overall build in different locations. that way you don't have to dig thru pages on pages to find something LOL

.....then maybe a "master thread" that links all the various threads. similar to the ULTIMATE LED GUIDE thread over on nano-reef :D

.....is this where i officially nominate you to do this??? LOL
 
Hmm sounds good terahz... I'm still reading some more about Arduinos but will keep this for the right moment. Thanks a lot
 
$30 - $50 if you're starting from scratch will get you a working prototype. It's pretty straightforward. Depending on how rugged you want the final version to be, and what features, you'll spend more. Shoot me a note if you want details.

Which reminds me, someone else on here wanted to see my code and I haven't sent it to them yet. :D

I am the one! :-) I will PM when I finish soldering LEDs to boards.
 
LED spacing

LED spacing

This is how I want to place LED on 48" x 12" aluminum board. LED front to back is 2 ½, left to right 3 ½. Is this too far from each other? I do not want to create dreaded spotlight effect and noticeable color separation. (75 gallon tank 48L x 18W x 21H)

DSC03298.jpg
 
Without optics that'll be totally fine assuming a normal mounting height. In the end, even with optics, if it's a problem, you can raise the fixture a few inches and the effect becomes less noticable.
 
LEDs almost done

LEDs almost done

Almost done with my LED lights. I still have to do some cosmetic work with cables, power supplies and fans. Sorry for dirty aquarium glass and bad pictures (iPhone), I will take pictures with better camera tomorrow. All LEDs run about 60-70%. I am very happy with results. Thanks

DSC_0317.jpg


GetAttachment1.jpg


GetAttachment.jpg


GetAttachment4.jpg


GetAttachment2.jpg


GetAttachment3.jpg
 
Last edited:
Quick reminder: Where again are people buying the 40 and 60 degree optics for the Cree LEDs? I'm not seeing them on the LEDSupply.com website...
 
Has anyone setup a LED bar to add shimmer to a t-5 setup? I have a friend running 2 36 inch 8 bulb ATI fixtures who would like to add some shimmer. How many LEDs do you think he would be looking at to pull something like that off?
 
Is the tank 72 inches wide? If it is and without knowing the depth front to back, I would say about 6 LEDs per fixture should give a good spread for shimmer with three towards the front of the tank and three towards the back if they are single LED stars like found in this thread. If an actual bar like you mentioned....two 24 - 36 inch bars should suffice.
 
Sorry if theres been heeps of posts on this already

A few weeks ago I upgraded my xr-e whites to xp-g R5's

So far I've noticed that they are running way hotter than the old xre's which I guess should be the case when there putting out up to 40-50% more light.

The upside was that I added a few extra leds in as they use around 3.2w versus the xre's 3.7w

I can easily see the increase in brightness over the old leds and so far nothing in the tank has been damaged by the increase in light.

Heres a pic with 6 xp-gs at the front of the unit (closest to the camera) and 6 xre's at the back.



Tinny little suckers

xpg24.jpg
 
Status
Not open for further replies.
Back
Top