PWM with PT4115 LED driver

Hi! I'm a noob and I'm hoping maybe I can get some advice...

Basically I've bought some PT4115-based drivers from ebay and can't get the PWM dimming to work.

I've connected three 700mA LEDs in series and power it with with the +12v from a computer power supply and they run fine. I'm connecting the PWM pin to D3 on a Nano and nothing much seems to happen.

Here's my code:

void setup() {                 
  pinMode(3, OUTPUT); 
}

void loop() {
  analogWrite(3, 255);
  delay(1000);        
  analogWrite(3, 128);
  delay(1000);        
  analogWrite(3, 0);  
  delay(1000);        
}

If test the voltage on pin 3, I get a 5v, 3v, 0v sequence as expected. I've also tested for continuity between D3 and the PWM pin across the cable, so I know I've got a good connection.

The first pic show the top of the driver board, the second pic shows the way I hooked things up.

Thanks in advance!!

driver2.PNG

Oops, it didn't like the first pic... I guess it didn't really matter, though.

Do the Nano and pt4115 share a common ground ?
How are you powering the Nano ?

The Arduino is powered by a separate USB adapter. By "common" ground, you're saying I can't run the Arduino on a different power supply? How should I would I wire this?

Thanks!!

Yup!! That was the problem. I split off the same +12 connector that was powering the LEDs to power the Arduino and success!

I have much to learn, but why did that work...? Both the ATX power supply and the USB adapter were plugged into same power strip... so in my eyes they share a common ground anyway. I guess that's not true! LOL

but why did that work...?

See this:-
http://www.thebox.myzen.co.uk/Tutorial/Power_Supplies.html

Wow, great article! ...so had the USB adapter had a third-prong ground, it would have worked? It would have had a path back to meet the ground from the PSU, right?

so had the USB adapter had a third-prong ground, it would have worked? It would have had a path back to meet the ground from the PSU, right?

No, don't confuse the ground from the mains supply with the ground or common for signals.
It would have worked if you connect the -Ve from the USB to the -Ve of your external power supply. All these supplies are said to be "floating" with respect to the mains ground. Meaning that you could connect the +Ve from the USB to the -Ve of the supply if you want to do that, but you will only want to do that under very specific circumstances that you will only confuse yourself if you try and understand at the moment.

Bottom line, if both USB and external power supply were "not floating" then it would have worked but most supplies are much more flexible when they float.

Thanks for all of your help... the project is definitely on track now!

I have another question on this topic.

Before the Arduino boots and creates the PWM signal, the LED driver defaults to 100% intensity... this is bad. How can I prevent this?

Thanks

It does this because after a reset all the pins default to being inputs. This means they float and can be pulled by any external load. The normal solution is to put a 10K pull down resistor on that pin.

Thanks again! The resistor goes between the PWM pin on the driver and the +12v? Or between the Arduino pin and the driver?

No from the pin to ground that is why it is called pull down.

Ah! Okay, I'll scrounge up a 10k resistor and give it shot. Hey, thanks again for all your help... I don't find you grumpy at all. :slight_smile:

I don't find you grumpy at all.

Sorry I'll try harder next time. :wink:

I pulled this project back out again!

I tried the 10K pull down and it didn't work... it didn't seem to affect anything.

To make sure I'm doing it right, I just add a 10K resistor between the PWM pin on the Arduino and ground, correct?

Thanks!

Is this a custom circuit?

Just to ensure you don't have anything goofy have you tried using a potentiometer with it for dimming? Connect to 5V, GND, and the wiper to the PWM pin.

Thanks for the help! I'm (obviously) a complete noob so I don't have much in the way of spare components... a potentiometer included.

I do have an interesting discovery, though... if I ground the PWM pin on the drivers, they don't cut off. They just dim a little. Is this expected behavior? Could this play into the problem?

Thanks

I've isolated several drivers (I have 5) from the Arduino circuit and each one responds the same... grounding the driver PWM pin partly dims the LEDs.

Did some more searching and found an article that states "A logic level below 0.3V at DIM forces PT4115 to turn off the LED". Should grounding the PWM effectively accomplish this? Or is it literally looking for a positive voltage less than .3v? If so, how can I accomplish this default behavior if the Arduino fails to start? Pulling down the Arduino PWM pin with a 10K resistor doesn't seem to do it...

Thanks again

The DIM pin has an internal, 200K pullup. Building your circuit with anything under 200K pulling it down should turn the LED off. Something must be messed up with your circuit.

My guess would be that there's a mistake in the soldering of your board. I'd suggest giving it a close inspection, or if it's not too much trouble you could post a picture on the forum.