Newbe fish tabk Led

Hi all. I know this has probably been done to death but most guides seem to go straight over my head as I have never used Arduino before, nor know it's fullest capabilities.

I am after making a cost effecting sunset to sunrise fish tabk LED dimmer to run several channels of different colour LEDs. Each string of LEDs with have its own mean well dimmable driver and a power source. Each LED is 3.3v and draws 700mA

I want there to be 1. a clock in the unit which will gradually fade the leds on and off dependant on a time schedule. And 2. Be able to adjust each channel for brightness.

The drivers are dimmable but don't really know what I need to achieve this feet. Can someone help point me in the right direction please?

I am literally brand new to this but it looks an amazing bit of kit.

Looking forward to your replies. Steve.

While this is not a complicated program, I would suggest you learn some basics of electronics and programming.

Otherwise this is going to be someone else's project that you simply use. You will have no knowledge if you want to modify the programme.

There are many resources on this forum and elsewhere on the web.

Start with simple LED on off then PWM of they LED.

Then read analogue from a potentiometer. This will allow you to set the brightness.

Then combine these to adjust the brightness.

Do one step at a time, get it working then add another step.

Weedpharma

Weed put it well.

get some LED's
read up on PWM

read up on millis() to learn about timing.

you may want to get a real time clock (RTC)

you can simulate your project with a few LED's and an Arduino.

also, in the future, if you have a device you want any help with, it is best to :
#1) study the device
#2) google arduino 'device' like arduino RXC-101 LED driver
by putting in the device model and arduino, you might find someone has what you need.
#3) when asking here (if the above does not work or you still have questions, it is good form to post the make, model and a link to the device and to the data sheet for the device. if you are having problems with wiring, then a schematic will be very helpful.

If you are having problems with your code, PLEASE read "how to use this form" and post your code inside of code tags.

Here is a sketch I posted on the forum a while back. It has a function that fades a PWM pin up in the morning and down in the evening, each fade taking two hours. It can be expanded to as many PWM channels as you have (6 on the UNO). Perhaps you can adjust it to fit your needs:

#include "Wire.h"
#define DS1307_ADDRESS 0x68  // This is the I2C address of the Real-Time Clock (RTC)

const int Blue1Pin = 3;
const int Blue2Pin = 5;
const int White3Pin = 6;
const int White4Pin = 9;

const unsigned long HOUR = 60 * 60;
const unsigned long MINUTE = 60;

const int TARGET_BRIGHTNESS = (255 * 3) / 4;  // Target brightness is 3/4 of full

void setup()
{
  Wire.begin();
}

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

void loop()
{
  /////  Get time from RTC into RTCHour, RTCMinute, RTCSecond

  // Set the register pointer to 0 (Second)
  Wire.beginTransmission(DS1307_ADDRESS);
  Wire.write((byte)0);
  Wire.endTransmission();

  //  Read Second, Minute, and Hour
  Wire.requestFrom(DS1307_ADDRESS, 3);

  int RTCSecond = bcdToDec(Wire.read());
  int RTCMinute = bcdToDec(Wire.read());
  int RTCHour = bcdToDec(Wire.read() & 0b111111); //24 hour time

  unsigned long time = RTCHour * HOUR + RTCMinute * MINUTE + RTCSecond;  // Time in seconds

  analogWrite(Blue1Pin,   brightness(time, 7*HOUR,                 17*HOUR));
  analogWrite(Blue2Pin,   brightness(time, 7*HOUR+30*MINUTE, 16*HOUR+30*MINUTE));
  analogWrite(White3Pin, brightness(time, 8*HOUR,                 15*HOUR));
  analogWrite(White4Pin, brightness(time, 9*HOUR,                 14*HOUR));

  delay(1000);  // No need to update more than once a second.
}

byte brightness(unsigned long time, unsigned long fadeUpStart, unsigned long fadeDownStart)
{
  //  Mid day, light is at maximum brightness
  if (time >= fadeUpStart + 2*HOUR  && time <= fadeDownStart)
    return TARGET_BRIGHTNESS;

  // Dawn:  fade up the light
  if (time >= fadeUpStart && time <= fadeUpStart + 2*HOUR)  // Fading up
  {
    unsigned long seconds = time - fadeUpStart;  // Number of seconds into the fade time 
    return TARGET_BRIGHTNESS * seconds / (HOUR*2);  // Fade up based on portion of interval completed.
  }

  // Evening: Fade down the light
  if (time >= fadeDownStart && time <= fadeDownStart + 2*HOUR)  // Fading down
  {
    unsigned long seconds = (fadeDownStart + (HOUR*2)) - time;  // Number of seconds remaining in the fade time 
    return TARGET_BRIGHTNESS * seconds / (HOUR*2);  // Fade down based on portion of interval left.
  }

  // The remaining times are night and the lights is off
  return 0;
}

I'm not entirely a novice with coding as I've been building website using html and css for years so should be able to adapt to this. I take on board what you say about buying a little kit with leds and doing basic programmes and I will, however would appreciate some guidance on what one to buy, which I think was in my OP. There seems to be a few different ones and dont want to buy one to 'practice' on and then can't be used for the big one.

There is a couple of guides online however the one in particular that I liked looked very involved. It basically outputted a 0-10v analogue signal which controller the led drivers. My drivers however can be controlled buy PWM which I have seen is already on the Arduino boards. So would I need any more than an Arduino board, RTC and a display?

Thanks for your help John. I've had a read through and understand quite a bit of it already. Will research the bits I don't get. Thank you.

That's exactly what I need john. What hardware would I need to get this fancy PWM modulator to work?

Cheers.
Steve.

You would need a DS1307 RTC. You can get a pre-built module from eBay. It's about $1 shipped from China or Hong Kong. About $4 shipped from inside the USA. Most don't come with the 2032 lithium coin cell because they can't be shipped by air.

You can test it out with LEDs that require 20 mA or less just by wiring the LEDs and resistors to the PWM pins. For higher current and/or higher voltage you need a transistor or MOSFET driver. The popular ULN2003A (http://en.wikipedia.org/wiki/ULN2003A) is a set of seven transistor switches that can each handle up to 50V and 500mA.

how many leds are you putting over your tank? where did you buy leds from? essentially you have the drivers and leds but you are looking to make a controller?

banthonyb71:
how many leds are you putting over your tank? where did you buy leds from? essentially you have the drivers and leds but you are looking to make a controller?

Just bought an Arduino Uno kit today to have a play around with. Looks like a cool piece of kit.

Hi. I have a mixture of LEDs. They're not the best quality but somewhere in the middle I believe. They are epileds, 3w, 3.3v, 650-70mA. Currently I have 6x white 7500k, 4x white 12000k, 6x royal blue, 6x blue and 2x UV. I am running them off little power plugs which aren't how its supposed to be done but was just a test to see if it looks good over my marine tank and now I know it does, I want to progress.

I will be getting the drivers which are Meanwell dimmable drivers... (http://www.meanwell.com/search/LDD-H/LDD-H-spec.pdf) dimmable via PWM.

I would have thought that I would be able to wire the PWM outputs of the Arduino straight to the drivers PWM input and that would be it? No? So yes, essentially I just want to make a controller (but with the scope to add more to it later such as fan control, temperature, feeding, pumps, etc.

Stevelondon:
I would have thought that I would be able to wire the PWM outputs of the Arduino straight to the drivers PWM input and that would be it? No?

Yes, you can use the fancy drivers. I think that Vin- would connect to Arduino Ground and PWM would connect to the Arduino PWM pin. The PWM frequency of the UNO is ~500 to ~900 Hz so within the 100 to 1000 Hz range of those drivers.
Have you chosen a power supply yet? A string of 6 LEDs (3.3V each) will need at least 20V so a 24V or 36V power supply would do the trick. At 700 mA each your five strings of LEDS will need about 3.5A so figure a 5A or higher power supply. You can get them from Amazon for a little under $20.

johnwasser:
Yes, you can use the fancy drivers. I think that Vin- would connect to Arduino Ground and PWM would connect to the Arduino PWM pin. The PWM frequency of the UNO is ~500 to ~900 Hz so within the 100 to 1000 Hz range of those drivers.
Have you chosen a power supply yet? A string of 6 LEDs (3.3V each) will need at least 20V so a 24V or 36V power supply would do the trick. At 700 mA each your five strings of LEDS will need about 3.5A so figure a 5A or higher power supply. You can get them from Amazon for a little under $20.

Thanks for your advice John. It feels good to know I was kinda on the right track. A few quick ones if I may...

  1. The 6 LEDs@3.3v = 19.8v.... would it be ok to connect them to the 24v supply? From my understanding (which may be completely wrong) is that because it is wired through a 'constant current' driver, the LED's will stop drawing voltage once they reach the maximum about of current draw, i.e. 700mA @3.3v and will therefore only draw the 19.8v and leave the remaining 4.2v alone? My fear was (as I have recently been told) that the LEDs will blow as the PSU is 4.2v higher than what they require.

  2. The same question with the current rating of the PSU, will the drivers only draw what they are rated at (700mA) and just leave the rest or does it have to match?

  3. You mentioned the ULN2003A earlier... would this be a cheaper alternative to the 'fancy drivers' :slight_smile: that I was planning on using? If so, what else would be needed to make them work? Do they just go into a breadboard and wired somehow, or is there other components and a big build needed? AND... My LEDs require 600-700mA, can yo get similar with a higher current rating?

Thanks, by far the most helpful forum I've been on.

What about these? http://www.ebay.co.uk/itm/5pcs-S8550-30V-700mA-1W-TO-92-Package-PNP-Silicon-Transistor-/121363291528?pt=LH_DefaultDomain_3&hash=item1c41d0dd88 ??

Stevelondon:

  1. The 6 LEDs@3.3v = 19.8v.... would it be ok to connect them to the 24v supply?

Yes. The current regulation on the dimmers will take care of any excess voltage.

Stevelondon:
2. The same question with the current rating of the PSU, will the drivers only draw what they are rated at (700mA) and just leave the rest?

Yes. The current regulators will only pass what they are designed for. You could use a 1000 Amp supply and it will do no harm. This is true of components even is they have no current regulators. You can connect a 1000A 5V supply to the Arduino and it will only draw about 40 milliamps.

Stevelondon:
3. You mentioned the ULN2003A earlier... would this be a cheaper alternative to the 'fancy drivers' :slight_smile: that I was planning on using?

They are certainly cheaper but A: only good to 500 mA and B: don't regulate the current. You would need a switch that can handle the 700mA current (like a logic-level power MOSFET) and a way to regulate current.

Easy if you add a power LED shield, like this one.
And there are many more.
If you use a 24volt supply, you can drive 6x6 = 36 3watt LEDs.

Leo..

Again John, thank you so much. I'm into a winner I think.

Wawa, I see someone using these on YouTube last night. I know it's 'switchable' current from 0.35-0.7-1a, but will that regulate the input to your selection or does it just 'let the driver know' so to speak what current you intend to drive through it?

Also, what Arduino does that require? Looks to big for my current Uno

The UNO has six PWM output pins plus two I2C pins to talk to the RTC leaving about 11 other pins for other things. There are also ways to expand the outputs and inputs. On an UNO the sketch uses only 10% of the FLASH space and only 10% of the SRAM space leaving PLENTY of room for expansion.

Stevelondon:
Again John, thank you so much. I'm into a winner I think.

Wawa, I see someone using these on YouTube last night. I know it's 'switchable' current from 0.35-0.7-1a, but will that regulate the input to your selection or does it just 'let the driver know' so to speak what current you intend to drive through it?

I would call it a pre-selectable current for the used LEDs.
e.g 300-350mA for 1watt LEDs, and twice that for 3watt LEDs.
But that could be less if you want to. I run some of my 3watt LEDs on 500mA.
That set current is the current that ALWAYS goes through that LED chain.
With PWM you vary the TIME the LEDs are on.
If the LEDs are on 10% of the time, and off 90% of the time, they look dim.
If the PWM frequency is high enough (>200hz), we don't see flickering.
Arduino uses standard ~500hz PWM. More than enough.
Our eyes, like our ears are not lineair. 10% PWM is NOT 10% light, but a bit more.
Better software uses a lookup table with values for linear dimming.
Leo..

johnwasser:
The UNO has six PWM output pins plus two I2C pins to talk to the RTC leaving about 11 other pins for other things. There are also ways to expand the outputs and inputs. On an UNO the sketch uses only 10% of the FLASH space and only 10% of the SRAM space leaving PLENTY of room for expansion.

Thats good to hear. The 6 channel driver (as linked in earlier post) I think is for the mega but there is a 4 channel one that fits onto the UNO perfectly so will weigh up how many channels I actually need. Then I need to find one in the UK as to not have to wait a month for delivery :frowning:

Wawa:
I would call it a pre-selectable current for the used LEDs.
e.g 300-350mA for 1watt LEDs, and twice that for 3watt LEDs.
But that could be less if you want to. I run some of my 3watt LEDs on 500mA.
That set current is the current that ALWAYS goes through that LED chain.
With PWM you vary the TIME the LEDs are on.
If the LEDs are on 10% of the time, and off 90% of the time, they look dim.
If the PWM frequency is high enough (>200hz), we don't see flickering.
Arduino uses standard ~500hz PWM. More than enough.
Our eyes, like our ears are not lineair. 10% PWM is NOT 10% light, but a bit more.
Leo..

Thanks Leo. Definitely sounds like the best way of doing it then. Just trying to find one for sale in the UK. Not easy so far. :frowning: