First project with 08M2 - LED Dimming

striep

New Member
Hi,

I'm new to picaxe and would like some comments on my first "real" project.

What I would like to do is controll the brightness of some led-clusters with an infrared remote controller.
The led-clusters all have 24 leds in 8 (was 6) groups each with a 220 ohm resistor
in series and driven at 12V. I will have 8 of these clusters.

My idea is now:
connect each of these clusters to an output of an ULN2803 and connect all inputs
of that to a pwm output of a picaxe 08M2.

With the attached program each cluster will source 80mA at highest connected
directly to 12V it sources 100mA.

Code:
#no_data
#picaxe 08m2

Symbol IRSense = c.1
Symbol InfraRED = b9
Symbol incdec = 50
Symbol per = b8
per = 249
w0 = 500
pwmout 2,per,w0
pause 1000

main:	
	if w0 > 1000 then
		let w0 = 1000
	endif
	Irin [100, main],IrSense, InfraRED
	select case InfraRED
		case 0 to 9
			w0 = InfraRED + 1 * 100
			pwmout 2, per, w0
		case 16
			gosub brighter
		case 17
			gosub darker
		case 21
			pwmout 2,off
		case 76
			let w0 = 500
			pwmout 2,off
		case 77
			let w0 = 500
			pwmout 2,per,w0
	endselect
goto main

brighter:
	let w0 = w0 + incdec
	if w0 > 1000 then
		w0 = 1000
	endif
	pwmout 2,per,w0
return
	
darker:
	let w0 = w0 - incdec
	if w0 > 1000 then
		'w0 = 1000
		pwmout 2, off
	else
		pwmout 2,per,w0
	endif
return
My question is now: will it be ok to use the ULN2803 or will it be better to
use a MOSFET and if so which would you suggest?

Thanks for comments and suggestions.

Regards
Stefan
 

Attachments

Last edited:

erco

Senior Member
Per http://pdf1.alldatasheet.com/datasheet-pdf/view/12687/ONSEMI/ULN2803.html, each transistor in the 2803 darlington array is good for 500 mA, so you're good to go reliability-wise at 80-100 mA. If your question is about the voltage drop going through the 2803, that is to be expected. You can reduce your 220 ohm series resistor a bit (still going through the 2803) if your goal is to get back up to 100 mA per string (that's a lot for LEDs, BTW). If you plan to connect all inputs together to use one PICAXE pin for pwm, you'll need another transistor between the PICAXE and 2803 to drive 'em all.
 

striep

New Member
Hi erco,

thanks for the reply.

The 80-100mA are for the hole cluster. So it has to be divided by 6 which makes about 13-16 mA.
I'll add the additional transistor and test again.
 

erco

Senior Member
Whoa! If you're using a 12V supply, you should run your 6 LEDs in series with just one series resistor for all 6 LEDs. Requires a bit of experimentation to find the right resistor value, but it saves parts, wiring, and power.
 

striep

New Member
I'm sorry if it isn't clear, what I mean by "cluster"
A "cluster" is made of 8 strings each of them with 3 leds and a 220 ohm resistor all in series.
12V - led1 - led2 - led3 - 220ohm - 0V
I got the number in the first posting wrong it's not 6 but 8. (edited)
So the current is 10-12.5 mA per string, 8x10mA=80mA per "cluster"
 

Haku

Senior Member
The ULN2803A is a pretty sturdy IC, I use one to drive the 360 LEDs of my front light on my ebike, with a source voltage of 11v the LEDs are in clusters of 60 (20x LED,LED,LED,33ohm) hanging off 6 individual pins of the ULN2803A being controlled by 6 outputs of an 18X.
At full brightness approximately 10 watts is going through it and can pretty warm but haven't had one die on me through just driving LEDs.
 
Top