I am trying to test some cree LED's to build a light for my terrarium. I have 4 LED's on individual heat sinks and 4 separate drivers, 3 1000HW and 1 700HW. They are hooked up to a Mean Well SE-350-48 following this diagram (https://donnie.co/aquarium/arduino-ldd.png). When I plug in the power supply the LED's all turn on even if the dim wire is not connected to the arduino. Using the example analog write code does nothing.
int ledPin = 2;
void setup() {
// nothing happens in setup
}
void loop() {
analogWrite(ledPin, 0);
// wait for 30 milliseconds to see the dimming effect
delay(5000);
analogWrite(ledPin, 255);
delay(5000);
}
I thought that the drivers should be off if there is no signal from the arduino so I assume I must have this thing wired wrong. Is there anything wrong with the diagram in the link above? Thanks
The default operation of the driver is to provide power to the LED ("turn on") when the DIM pin is left disconnected. Connect the DIM pin to GND so it's held low to keep the driver output off when you want it off. I see that in your diagram you have a 10K resistor pulling it low but the driver datasheet states there's 1ma of current on that pin; the 10K might be too high a value. Try a 1K instead.
Don't forget that the default status for any AVR pin is INPUT until you pinMode() it to set it as OUTPUT. When set as INPUT the pin allows very little current through it and it won't be able to affect the charge on the DIM pin. When the pin is set as OUTPUT and set low it will sink current (act like GND), and calling analogWrite() will also set it as OUTPUT, but it's still better to explicitly set it as OUTPUT in the setup() of your sketch.