I am trying to use an Arduino + PWM to control a 100w LED using a Sure Electronics 300-3000ma buck regular - Product Here
The chip being used is LM3409
The buck regulator is powwered by an external 36v suppply to VCC + GND, and a 100W led is connected to the LED +/-.
This configuration is working fine without PWM but I can not understand how to control it with PWM from an Arduino without flicker.
The arduino is connected to to a 4n35 Optocoupler.
The Arduino Digital Pin 2 is controlled (AnalogWrite) after reading the value of a Potentiometer (0-1024 mapped to 0-255) and is connected via a 200 Ohm Register to Pin 1 of the Optocoupler. Pin 2 of the optocouler is connected to the arduino ground.
int led = 2; // the PWM pin the LED is attached to
int last = 0;
// the setup routine runs once when you press reset:
void setup() {
// declare pin 9 to be an output:
Serial.begin(115200);
pinMode(led, OUTPUT);
}
// the loop routine runs over and over again forever:
void loop() {
int sensorValue = analogRead(A0);
sensorValue = map(sensorValue, 0, 1023, 0, 255);
if (sensorValue != last)
{
last = sensorValue;
analogWrite(led, sensorValue);
Serial.println(sensorValue);
}
}
The LED buck device says that the EN pin - PWM terminal when applied with ground or suspended, full amount of current will be output and when connected with +5v or VIN, output current will be 0.
I have tested this, if I connect the 36v from the LED power supply to the EN pin the LED goes out. If I connect to ground or leave floating it runs at 100%
I do not know how to connect the other side of the Optocouler to the EN PIN properly.
I have connected pin 4 of the optocoupler (EMITTER) to the EN PIN, and connected pin 5 (COLLECTor) of the optocoupler to 36V from the VCC on the buck regulator.
This seems to work as it does go up and down in relation to changing the potentiometer.
- 0 from analogWrite on the arduino and the LED is running at 100%\
- 128 from analogWrite on the arduino and the LED is running at 50%
- 255 from analogWrite on the arduino and the LED is running at 0%
But it is not a constant brightness, it is flashing terribly and not usable.
Any help appreciated as I do not know how to move on with this.