No Idea what I'm doing can anybody help

First, I'm new to this so please be patient with me.
What I'm trying to do is control my LED set up with my Arduino.
The problem I'm having is that the lights flash and don't dim like they are suppose to I've tried a Mega and a uno with the same results, now I'm aware that the problem is with me and not the product.
the setup is as follows.
24v Dc going into a led driver from the driver on to the led's this circuit is correct I've done it hundreds of times using a potentiometer to dim when needed less light.

this is where the problems begin the driver has got a PWM wire so they can be dimmed using a controller
when I connect this to a PWM pin I get the lights flashing and not dimming at all.
this is the code that I've used it works well with a low power led but not the high power stuff that I'm trying to do.

I'm heading in the wrong direction with this and was wondering if anybody can set me straight?
I feel that I may need to alter the drivers wiring.

In case you are wondering I'm using 6 Cree XML Led's and a Recom RCD/24-1.20/w/x3 driver

Thanks :disappointed_relieved:

[/cod  */


int ledPin = 8;    // LED connected to digital pin 9

void setup()  { 
   // nothing happens in setup 
} 

void loop()  { 
   // fade in from min to max in increments of 5 points:
   for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5) { 
     // sets the value (range from 0 to 255):
     analogWrite(ledPin, fadeValue);         
     // wait for 30 milliseconds to see the dimming effect    
     delay(30);  
  
   } 

   // fade out from max to min in increments of 5 points:
   for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=5) { 
     // sets the value (range from 0 to 255):
     analogWrite(ledPin, fadeValue);         
     // wait for 30 milliseconds to see the dimming effect    
     delay(30);                            
   } 
}e]

Pin 8 isn't a PWM pin so it's just going high and low. The PWM pins are marked ~ on the board.

edit... well it's not on a Uno anyway.

Hi jimboZA,
thanks for your reply,
pin 8 is on the mega I've also tried other pins with the same results

I wonder if it's to do with the PWM frequency? I can't see a reference to what it needs to be for your controller, but the Arduino pins are 490 and 980Hz. See here for which is which. Could it be too slow for the controller and so it thinks it's actually offing and onning not pwming?

Are you leaving the analog dimming control not connected?

Hang on the datasheet says PWM max frequency 200Hz for "linear control" and there seems to be an absolute limit of 1000.

So the 490 is indeed over the 200 and the 980's almost on the limit.

Might that be significant?

KenF:
Are you leaving the analog dimming control not connected?

Yeah, that too.....

You can roll your own pwm at any frequency you like, by the way, as described here for a 38kHz IR carrier signal, but it's a matter of adjusting the times to give you 5ms per cycle instead of their 26us,

JimboZA:
I wonder if it's to do with the PWM frequency? I can't see a reference to what it needs to be for your controller, but the Arduino pins are 490 and 980Hz. See here for which is which. Could it be too slow for the controller and so it thinks it's actually offing and onning not pwming?

Actually I think it may be the other way around. Looking at page 4 of the datasheet it shows this diagram for "High Frequency PWM" (Note it uses a capacitor and the ANALOG input for this implementation)

Here's the datasheet I'm looking at

look.JPG

JohnLincoln:
I think that circuit for using a high frequency PWM signal is just a work around if your frequency is too high for the normal PWM input.

Exactly! but if they find it necessary to publish such a workaround, they're obviously expecting some PWM to be too fast.

Hi Guys,
Thanks for the info, I'm really over my head.
The analogue wire is left unconnected
I have only connected the PWM wire.
I have also seen the diagram with the capacitor and resistor, however I have no idea what size capacitor or resistor to use!!!!!!!
I also thought about the frequency but no idea how to change this or to go around.

Cheers,
Ross. :roll_eyes: :sob:

Hi,

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png or pdf?

Have you got the gnd of the LED setup and arduino connected together, they must be so that the PWM signal has a return current path back to the arduino.

Tom........ :slight_smile:

Hi tom,
I hope the following will help

TomGeorge:
Have you got the gnd of the LED setup and arduino connected together, they must be so that the PWM signal has a return current path back to the arduino.

RosS, your diagram doesn't answer this question.

Hi KenF,
The answer to your question must be no I do not, nor do I know how to do that, that is probably why it's not working can you show me how to do that?

Thanks,
RossS :blush:

Connect this green wire. (but you can use any colour :slight_smile: )

KenF,
You are a Gem,
It works, it was looking at me in the eyes and I could not see it,
now all I have to do is to change the code so that the ramping up and down will be smooth

Thank you so much

RossS