Help controlling 12VDC LEDS

johnmobley

New Member
I am wanting/trying to control some 12VDC LEDs via PWM using a PICAXE 14M2. What is the best method to do this. Working with PWM and LEDs is not new to me but trying to control them at higher voltages is new for me.
 

westaust55

Moderator
Can you please provide some additional details or a link to the datasheet for the LEDs involved.

Are the LEDs actually 12 V rated or is there a resistor in series or are there a string of LEDs with a combined forward volt drop of 12 V?

What is the current rating?
What current do you intend to drive the LEDs as?
Note that unless you want super/max brightness, often a lower current will suffice.

How many groups or channels of LEDs are you trying to drive with PWM?
That can determine whether a single PICAXE IO or an interface chip is required.

Knowing the current for one group/channel and how many channels are involved can determine whether a simple transistor will suffice or something more elaborate is needed. In general you need an open colelctor type interface ararngement where the LEDs conenct form 12 Vdc to the transistor (or whatever) and the transistor acts as a switch to ground.
 

Bill.b

Senior Member
This will control 12v strip RGB LEDS.
The program fades the three colours at different levels.

Code:
'loop RGB LED Control
'May 2012
'Picaxe 14M2
#picaxe 14m2
#No_Data

symbol counter 	= W2
symbol Green	= W3
symbol Blue 	= W4
symbol loopcount	= b0

symbol Redout	= b.2
symbol Blueout	= c.0
symbol Greenout	= b.4

dirsb=%00011111
dirsc=%00000111
pwmout Redout,100,0
	pwmout Blueout,100,255
	pwmout Greenout,100,0
main:

gosub fade
'
goto main


fade:	

	for counter = 0 to 255
		  pwmduty Redout,counter
		  w5 = 255-counter
		  pwmduty Blueout,w5
		  pause 10
	 next counter
	 pause 400
	 for counter = 0 to 255  
		  pwmduty Greenout,counter
		  
		  w5 = 255-counter
		  pwmduty Redout,w5
		  pause 10
	 next counter
	 Pause 400
	 pwmduty Redout,0
	 pause 200
	 for counter = 0 to 255
		  pwmduty Blueout,counter
		   w5 = 255-counter
		  pwmduty Greenout,w5
		  pause 10
	 next counter
	 pause 400
	 
	for counter = 0 to 255
	 w5 = 255-counter
		  pwmduty Blueout,w5
		  pwmduty Redout,counter
		  pwmduty greenout,counter
		   
		  pause 10
	 next counter
	 pause 400
	for counter = 0 to 255
		 
		  w5 = 255-counter
		  pwmduty Blueout,counter
		  
		   
		  pause 10
	 next counter
	 pause 400
'	pause 50
'		
'
'pwmout Redout,off
	'pwmout Blueout,off
	'pwmout Greenout,off
	return
RGBLEDControl.jpg
Bill
 

johnmobley

New Member
Ok here is some more information (some of it will currently be guessing on because part of the circuit has not been designed yet, but the idea will be there):

For the known part of the circuit I will be using some illuminated push buttons from Bulgin. The LED's in these are rated at 20mA each and I want to run them off of one output (in parallel). The switches come rated at 12VDC (most likely a resistor installed in the switch base). Could this be controlled by an optoisolator?

For the part of the circuit that is still in early design stages, the plan is to control between 8 to 10 columns of 4 high power LEDs in a sort of cylon (?) arrangement.
- I am not sure as to exactly which brand I will be using but some general specifications that keep coming up in my searches would be:

Between 4 and 5 Volts per LED
700 mA per LED (I am thinking of grouping two LEDs in series for approximately a 12 volt supply with resistors of course, then two of these in parallel for each column. Each column would then be controlled by one output. Or if running at 4V then just three in series.)

That is the rough design of the second part. I am also open to other suggestions on this one. Oh and on the second part of the project it will be controlled by a much bigger PICAXE with many more output pins so that will not be an issue.
 

geoff07

Senior Member
- 20mA is a lot for an led indicator, you might be happy with 10 or even 5. These could also be in series. The leds might be connected across the switch contacts but might be separately powered, worth considering the options.
- leds generally don't need 4 - 5 volts. Try a sample and see what they drop at the desired current. Constant current is a much better way of thinking about them. But a series string would work. Consider more than 12v if you need long strings, connected via a pwm-driven constant-current supply.
- Mosfets for pwm switching are necessary, even better 'coolfets' with lower on resistance. Most mosfets/coolfets need a driver chip to ensure a high enough gate switchon voltage (logic level ones may not). Picaxe fed from 5v, driver and mosfet from 12v (or higher).
- depending on layout, cable capacity may be an issue due to voltage drop at high current, and little voltage to spare.

My kitchen lights are all 12v led units driven in this way from a 12v (car battery) supply with push-button control and pwm for reduced level settings.
 

jims

Senior Member
I'm not familiar with "coolfets". What are they? The only reference that I can find for "coolfets" is a Charge Sensitive preamplifier, A250Cf. Really pricey. What am I missing?
Thank you, Jims
- 20mA is a lot for an led indicator, you might be happy with 10 or even 5. These could also be in series. The leds might be connected across the switch contacts but might be separately powered, worth considering the options.
- leds generally don't need 4 - 5 volts. Try a sample and see what they drop at the desired current. Constant current is a much better way of thinking about them. But a series string would work. Consider more than 12v if you need long strings, connected via a pwm-driven constant-current supply.
- Mosfets for pwm switching are necessary, even better 'coolfets' with lower on resistance. Most mosfets/coolfets need a driver chip to ensure a high enough gate switchon voltage (logic level ones may not). Picaxe fed from 5v, driver and mosfet from 12v (or higher).
- depending on layout, cable capacity may be an issue due to voltage drop at high current, and little voltage to spare.

My kitchen lights are all 12v led units driven in this way from a 12v (car battery) supply with push-button control and pwm for reduced level settings.
 

johnmobley

New Member
Ok that was all great information and help. Thank you so much. I believe I will be going with the MOSFET's for the high power LEDs. I have one last question that was quietly thrown in during my second post though. I was looking around for different ways to control a different voltage and I came across some optoisolators. I was just wondering if I could use something like this (the specific one I was looking at was a LITEON LTV-816) to control a 12V LED that just needs to be turned on (no special effects) or even possibly some relays?
 

geoff07

Senior Member
There things are essentially leds packaged close to but isolated from a phototransistor. So the driver lights the led and the load passes through the transistor. As long as the load is compatible with the power dissipation and the drive current is available they work in principle. But then you could just drive a transistor directly and save the money, unless you need isolation.
 
Top