Okay i'm reasonably new to building my own circuits so I'll try to be as detailed as possible with what I am attempting to do..
I have a micro controller that has a PWM function. It is programmed to output a variable PWM signal from 0 to 100% duty cycle. The basic layout is shown here on figure "A"
All LED's share a common cathode (-) and the cathodes are attached to R5 which is a varying PWM signal.
The LEDs annodes are connected to R2 and R3. These outputs are switched high (+) by the micro controller in sequence, ie the first LED on R2 goes high and the LED fades in from zero to 100% then back out. R2 goes low and r3 goes high then the second LED fades in then back out.
This works as expected however; fade is only one part of my overall need.
Figure "B" shows another mode of operation:
The LEDs that I am turning on/off need more than the 5v+ that my micro controller can supply. (they are wired for 12v operation already and that can not change). Likewise there is an un-determined number of LEDs that may be connected to any one output. Thus I solved the problem of giving them a full 12 volts by incorporating a NPN type transistor on the outputs of the micro controller. When R2 goes high the transistor connects the LED(s) to ground.
This by itself also works as expected, no issues here.
When I attempt to combine the two methods is where I get into trouble. I can manually set the PWM (- output) to 100% duty cycle (or whatever brightness I want) and in theory simply switch on the LED channel as desired. Giving the LED its (+) feed, this again right off the PIC will only give me 5 volts or so to work with.
Thus I am looking at this solution:
All LED's would share a common cathode (-) which is the PWM set at 100% duty cycle R3.
Using a PNP type transistor connected to the output ports (r1, r2, r3 etc).
I should be able to supply the LEDs with their positive power triggered by the output at R2 going low (-).
I will need to re-work the programming on the chip to account for the outputs going low instead of high but that isn't a big deal at all.
My question is this:
1) Am I going about this the right way with a PNP transistor?
2) Do I need any diodes in the mix here to protect the micro controller mostly.
3) Does anyone know of a way to accomplish this for several output channels (R1,R2,R3,R4 etc.) without using a separate transistor per output? It's not a big deal if it has to be that way but I need the channels diverse.
Thanks in advance!
*EDIT* looks like I drew my PNP transistor wrong, as the arrow should be the other direction... does this mean i'll need to swap the C and B as well on the transistor?
I have a micro controller that has a PWM function. It is programmed to output a variable PWM signal from 0 to 100% duty cycle. The basic layout is shown here on figure "A"
All LED's share a common cathode (-) and the cathodes are attached to R5 which is a varying PWM signal.
The LEDs annodes are connected to R2 and R3. These outputs are switched high (+) by the micro controller in sequence, ie the first LED on R2 goes high and the LED fades in from zero to 100% then back out. R2 goes low and r3 goes high then the second LED fades in then back out.
This works as expected however; fade is only one part of my overall need.
Figure "B" shows another mode of operation:
The LEDs that I am turning on/off need more than the 5v+ that my micro controller can supply. (they are wired for 12v operation already and that can not change). Likewise there is an un-determined number of LEDs that may be connected to any one output. Thus I solved the problem of giving them a full 12 volts by incorporating a NPN type transistor on the outputs of the micro controller. When R2 goes high the transistor connects the LED(s) to ground.
This by itself also works as expected, no issues here.
When I attempt to combine the two methods is where I get into trouble. I can manually set the PWM (- output) to 100% duty cycle (or whatever brightness I want) and in theory simply switch on the LED channel as desired. Giving the LED its (+) feed, this again right off the PIC will only give me 5 volts or so to work with.
Thus I am looking at this solution:
All LED's would share a common cathode (-) which is the PWM set at 100% duty cycle R3.
Using a PNP type transistor connected to the output ports (r1, r2, r3 etc).
I should be able to supply the LEDs with their positive power triggered by the output at R2 going low (-).
I will need to re-work the programming on the chip to account for the outputs going low instead of high but that isn't a big deal at all.
My question is this:
1) Am I going about this the right way with a PNP transistor?
2) Do I need any diodes in the mix here to protect the micro controller mostly.
3) Does anyone know of a way to accomplish this for several output channels (R1,R2,R3,R4 etc.) without using a separate transistor per output? It's not a big deal if it has to be that way but I need the channels diverse.
Thanks in advance!
*EDIT* looks like I drew my PNP transistor wrong, as the arrow should be the other direction... does this mean i'll need to swap the C and B as well on the transistor?
Attachments
-
13 KB Views: 90
-
12.6 KB Views: 87
-
14.4 KB Views: 87
Last edited: