basic LED help

Thanks. Also, would it be good practice to set up a central ground from the power supply and run lines to ground the Arduino, relays and -V out on the LDD-700 modules?

Mostly. The V- of both the psu powering the arduino and relays and the V- of the psu powering the LDDs needs to be tied together somewhere in the circuit (generally easiest to do at the Psu terminals but doesn't really matter where.

the LDD Vout- should only be connected to the LED string it is powering, they do not get tied together, otherwise bad things will happen.
 
As above: tied -ve from all the supplies, but not from the drivers.

If using a voltage limiting resistors for the pots, make sure you do a few tests displaying the min & max voltage you get from them, and then alter the code to use those as 0 & 255 PWM settings (effectively calibrating your code to your circuit).

Tim
 
I got a little ahead of myself and soldered leg 1 of both pots together and sent them to 5V without a resistor. Would it work the same to put a single 1K resistor between the pots and 5V?
 
I got things soldered up and added a single 1K resistor between both pots and 5V. Since only one pot will be used at a time, it seems like it would be the same as if the pots went to 5V individually with two 1K resistors. Not a big deal to change though.

I decided to run the sketch with a couple tiny LEDs on my breadboard before trying to fire up the algae filter. Something is going on that makes the LEDs alternate in milli seconds instead of minutes. It's odd too, because I lifted that part of the code to convert milli seconds to minutes and added it to the 'blink' from the basics list and it works like a champ.

Another strange thing is pin 8 on the Arduino will not work with this sketch, but it works with the altered 'blink' sketch.

Is there any chance that maybe you guys could kick this around?
 
If you are using the code zachts changed, there is an omission that makes the time 300ms instead of 300 minutes. I wrote it as this:
PHP:
if (currentMillis - previousMillis > minutesInMS(300)) {
    previousMillis = currentMillis;
    redOn = !redOn; //switches from red to blue and back
  }

But he changed the embedded 300 to a variable, which is better indeed for later changes, but forgot the function:
PHP:
if (currentMillis - previousMillis > m) {
    previousMillis = currentMillis;
    redOn = !redOn; //switches from red to blue and back
  }

Change the code to this:
PHP:
if (currentMillis - previousMillis > minutesInMS(m)) {
    previousMillis = currentMillis;
    redOn = !redOn; //switches from red to blue and back
  }

I don't know about the pin 8 thing though, maybe its the libraries? I omitted them when i wrote that as i don't actually know what it might need.
 
Gorgok, with your original sketch I get the error, ‘minutes InMS' was not declared in this scope and the line if (currentMillis - previousMillis > minutesInMS(300)) { highlighted.
When the code is changed I get the error, ‘m’ was not declared in this scope and the line if (currentMillis - previousMillis > minutesInMS(m)) { highlighted.

Zachts, the altered sketch uploads but the timing is in Ms. When the code is changed I get the error, ‘minutes InMS' was not declared in this scope and the line if (currentMillis - previousMillis > minutesInMS(m)) {highlighted.
Thanks very much you guys.
 
Sounds like a typo (added a space) in both and not using Zachts' changes as the base for the error with m.

PHP:
int redLED = 8;        
int redFAN = 9; 
int redPOT = 6; //set potentiometer pins
int blueLED = 10;
int blueFAN = 11;
int bluePOT = 7; //see above
int m = 300; //enter delay time in minutes for switching between red and blue LEDs

long minutesInMs(int m) {
  return m*60000;  //converts milliseconds to minutes
}

unsigned long previousMillis = 0;
unsigned long currentMillis = 0;
boolean redOn = false;

void setup()                      // run once, when the sketch starts
{
  pinMode(redLED, OUTPUT);        // sets the digital pins as outputs
  pinMode(redFAN, OUTPUT);      
  pinMode(blueLED, OUTPUT);
  pinMode(blueFAN, OUTPUT);
}

void loop() {
  currentMillis = millis();
  if (currentMillis - previousMillis < 0){
    previousMillis = 0; //for when millis() rolls back to 0
  }
  if (redOn) {
    analogWrite(redLED, (analogRead(redPOT)/ 4)); 
    digitalWrite(redFAN, HIGH);    
    digitalWrite(blueLED, LOW);
    digitalWrite(blueFAN, LOW);
  }
  else {
    analogWrite(blueLED, (analogRead(bluePOT)/ 4)); 
    digitalWrite(blueFAN, HIGH);    
    digitalWrite(redLED, LOW);
    digitalWrite(redFAN, LOW);
  }
  if (currentMillis - previousMillis > minutesInMs(m)) {
    previousMillis = currentMillis;
    redOn = !redOn; //switches from red to blue and back
  }
  delay(50); //just a delay to slow it down some
}
 
Thanks a ton Gorgok! That sketch works. :D

Only six pins on my Arduino Uno work as outputs with this sketch. They are pins 3, 5, 6, 10 and 11. They have a ~ next to them. Beside the row of pins is DIGITAL (PWM~). I assume these pins are digital PWM.

If so, what are the rest of the pins?

What is the best choice for the two input pins, the two remaining digital PWM pins or the unmarked pins, 1, 2, 4, 7, 8, 12, or 13?
 
For the inputs you need analog pins, so pins A0 and A1 would work great. Only two pins need to be PWM, so you could use pins 7 and 8 for the fans signals (not directly powering fans), and 9 and 10 for PWM. This leaves PWM capable pins free for future use.

(This is the first time i actually looked at pins on the uno...)

I actually thought the analogWrite thing was faking pwm with a bit-banging function (because of the misleading name), which would have let it use any digital pin. All the better if it doesn't though.
 
I hooked everything up and the blue and red LED banks alternate and dim, WOW you guys really helped me out big time! Here's to you!:beer:

I do have a couple kinks to work out though-each LED bank has a row that is out and the fans aren't coming on. I'll work on sorting that out tomorrow then get it hooked up to a computer to put a number on intensity for fine tuning.

I'll get a couple pics up later for the heck of it.

Before too much longer we'll see if this thing can grow lots of algae using bare minimum wattage.

You guys have been very generous with your knowledge and I truly appreciate the help. Thanks.
 
Glad you got it working - and I agree there are some very helpful people on here who are very generous with their time :)

Tim
 
I ended up having to do the board over because I broke a couple legs off the surface mount LDD 700 modules-I had no idea how brittle they are-now I have through hole which is what I thought I was getting in the first place, oh well....

I accidently connected the 1K resistors that lead to the pots to 35V instead of 5V. Would that have likely ruined every input pin on the Arduino?
The pot is a 5K, 25 turn type and on the bench my extra pot smoothly ramps up and down resistance. The voltage to the LEDs is 36V (without the LEDs hooked up). As I turn the pot, nothing happens until a point where the voltage drops suddenly and is unstable. (This is what made me find the error, but after correcting it the exact same thing is still happening) I get the same thing with all Arduino inputs.

The pot http://www.ebay.com/itm/250878854331?_trksid=p2059210.m2749.l2649&ssPageName=STRK:MEBIDX:IT

If any of you guys could take a minute to help me sort this out I would be grateful.
 
A couple surprises-the Arduino seems to be fine and there are a couple versions of the LDD modules, l and h. I had the l version and was overdriving them, although it seems like a safe bet the 36V going to dim is what did them in. Anyway, there are eight LDD700h modules on the way. I'll see if I can wick the solder from the dead LDDs and replace them rather than start over.

I think the 'dead' LDD700l modules will work as non dimming drivers so the plan is to rig up grow lights for my son's vegetable seedlings.
 
A couple surprises-the Arduino seems to be fine and there are a couple versions of the LDD modules, l and h. I had the l version and was overdriving them, although it seems like a safe bet the 36V going to dim is what did them in. Anyway, there are eight LDD700h modules on the way. I'll see if I can wick the solder from the dead LDDs and replace them rather than start over.

I think the 'dead' LDD700l modules will work as non dimming drivers so the plan is to rig up grow lights for my son's vegetable seedlings.

9-32V for 300-700 LDD-Ls . 36V will probably kill them.
6-36V for the larger L's..
So you have different versions of the L's and of course the H's
http://www.meanwell.com/search/LDD-L/LDD-L-spec.pdf
 
FYI you need the leds connected to the LDD before powering them up otherwise damage will likely occur to the drivers........and if they don't fry no dimming will occur as it will still be trying to output maximum voltage to no load which is what may kill them.

If they still power LEDs with no dim signal they might actually be fine as I would suspect if you fried the pwm pin the whole driver would be shot.........

even with 36v going to the arduino thru pots it still shouln't have been outputing more than that to the LDD pwm pin unless the arduino also fried. though supplying too much input voltage to the LDD V+ could have.
 
FYI you need the leds connected to the LDD before powering them up otherwise damage will likely occur to the drivers........and if they don't fry no dimming will occur as it will still be trying to output maximum voltage to no load which is what may kill them.

.

I had no idea.

If a LED dies, the whole string goes out. Then the driver is toast?
 
I had no idea.

If a LED dies, the whole string goes out. Then the driver is toast?

Generally No, as there will still be resistance on the load side not an open circuit. The driver will shut down in most cases, but when fired up with nothing connected as I understand it the short circuit detection may not apply and the driver can be damaged in many cases. Not always but in a great many reports from DIY builds I've read.

As with most all IC's never power them without the full circuit connected unless they are intended to be operated as such.

For testing purposes you need only connect a single LED.
 
Last edited:
Simple tip I use - solder headers to the board and then plug the LDDs in to the headers. They do fail (not often, but it does happen) so being able to simply unplug & replace is great :)

Tim
 
Generally No, as there will still be resistance on the load side not an open circuit. The driver will shut down in most cases, but when fired up with nothing connected as I understand it the short circuit detection may not apply and the driver can be damaged in many cases. Not always but in a great many reports from DIY builds I've read.

As with most all IC's never power them without the full circuit connected unless they are intended to be operated as such.

For testing purposes you need only connect a single LED.

Using like the Coralux boards and the pull down resistor (or any pull down on the dimmer circuit), would that not eliminate this possible issue?
Even hooking the ps to the board, the resistor pulls output to zero..


I didn't think this was much of an issue w/ LDD's.. some of the other AC/DC drivers had the problem that if you "hot wired" the LED string into an actively powered driver you'd toast the LED's..

Never had a LDD driver failure but coming from my initial start (don't hot wire LED's to driver) I suspect I've never fired up a driver w/ out a string attached..
 
Back
Top