RGB LED driver, Any comments?


Closed Thread
Results 1 to 32 of 32
  1. #1
    Join Date
    Nov 2005
    Posts
    13

    Question RGB LED driver, Any comments?

    Hi there,

    I'm thinking of building a RGB LED driver for 8 LEDs. I want to use a PIC16F777 for this task as it has a very convenient 3 hardware PWM channels.

    I've made a little schematic, but have some questions.

    larger image:
    http://users.telenet.be/maxpowa/schema_RGBleds.jpg

    I wonder, are the transistors I've choosen OK for the task at hand? Should I use MOSFETs instead, if so, which mosfets are my best choice?

    I would power the circuit with an MC33269T-3.3 LOW drop 3.3Volt regulator. Is this OK or are there better options to power the circuit?

    Anything missing or other comments?

    Thanks in advance,
    Steve.

  2. #2
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default

    Shouldnt the placement of the transistors be transposed.

    PORT D
    PNP collector to +5V feeding emitter to common Anode
    Take the base to 0V via resistor to turn on an LED

    PWM Outputs
    NPN emitter to ground, Collector to R,G,B common cathodes
    Take the base to +5V via resistor to turn on a colour.

    You might also like to take a look at the RGB LED Controller Project http://www.rgbled.org

    I am just waiting for the bits for my kit to arrive

    Just my thoughts.

    Regards
    Keith

    www.diyha.co.uk
    www.kat5.tv

  3. #3
    Join Date
    Nov 2005
    Posts
    13


    Did you find this post helpful? Yes | No

    Default

    Dude! You're so right.

    Lack of sleep makes pax go crazy.

    Thanks a bunch, i'll rework it after some sleep... or coffee...

    Steve

  4. #4
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by paxmowa
    Dude! You're so right.
    Steve
    Apart from when I am wrong!!!

    PORT D
    PNP collector to +5V feeding emitter to common Anode
    Take the base to 0V via resistor to turn on an LED
    Should read

    PORT D
    PNP *EMITTER* to +5V feeding *COLLECTOR* to common Anode
    Take the base to 0V via resistor to turn on an LED


    That'll teach me to reply in a hurry before dashing out to collect the kids from school
    DOH !!!!
    Keith

    www.diyha.co.uk
    www.kat5.tv

  5. #5
    Join Date
    Nov 2005
    Posts
    13


    Did you find this post helpful? Yes | No

    Default

    Thanks for the efford Keith.

    After a bit of sleep and with a cleared head I made up this:

    Updated:


    Swapped PNP and NPN transistors around, replaced BC547 by BD139.

    It aint finished yet i guess.

    I checked the specs for the RGB leds and green and blue chips are rated 3.5 to 3.8 volts, red chip is GaAlAs rated at 1.85 to 2.2 volts. The 3.3 volts from the voltage regulator is to high for the red chip and to low for the blue and green. Will prolly go to 5V supply and put resistors in series with each chip.

    Anyways, thanks again for the help so far,
    Steve

    UPDATE:
    This is the third version, added resistors in series with each led chip, this should be almost complete i think. Now only add the PIC16F777 and power supply.
    Last edited by paxmowa; - 18th November 2005 at 16:46.

  6. #6
    Join Date
    Nov 2005
    Posts
    13


    Did you find this post helpful? Yes | No

    Default

    hmmm, I figure there's also the voltage drop over the transistors. about 0.6 volt each.

    So the resistors for blue and green should be 10 ohm and for the red should be something like 82 ohm.

    Getting there... slowly, but getting there none the less.

    Steven

  7. #7
    Join Date
    Sep 2003
    Location
    INDIA
    Posts
    161


    Did you find this post helpful? Yes | No

    Default RGB LED Drv via RS232

    Hello PAX / Other,

    I am trying a very similar project in which I send a byte (actually 3 bytes for R-G-B) information for each of the color LED via the RS232 Port to form a Colour Combination.

    I am plannig to go about using 3 12F629 for each of the LED's. I am having some problem of communicating the PIC's with the RS232.

    Can anyone share some code samples for the RGB LED out here ?

    regards

  8. #8
    Join Date
    Feb 2005
    Posts
    130


    Did you find this post helpful? Yes | No

    Default

    Im using a single 12F683 (or 12F675) for controlling the RGB channels and I still have space for an extra potentiometer (for sweep speed) and 2 buttons.



    For PWMing I use PWM instead HPWM, of course if you have 3 HPWM is a little easier, but not much...

    you share a common ground and use a 7805 regulator for the pic, then you can power the regulator and the leds with any value from 5-24V (+ after the resistors)

    I drive luxeon leds without problem

    Have fun

  9. #9
    Join Date
    Jan 2006
    Posts
    19


    Did you find this post helpful? Yes | No

    Default

    Hey Peu, I'm working on pretty much the same thing with a 12F675 PWMing to 3 Mosfets. Everything is working well except I'm finding when I PWM from GP2 and GP4 the MOSFETs don't really pulse they pretty much just stay on, or switch off when the cycle gets low enough. I'm not sure why, I've poked the ANSEL and CMCON, but it seems maybe the output voltage on those pins is a little different or something. Anyone have any ideas what might be going on? I see you are driving your green channel with GP2, does that work fine for you?

  10. #10
    Join Date
    Feb 2005
    Posts
    130


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by ERIK
    Hey Peu, I'm working on pretty much the same thing with a 12F675 PWMing to 3 Mosfets. Everything is working well except I'm finding when I PWM from GP2 and GP4 the MOSFETs don't really pulse they pretty much just stay on, or switch off when the cycle gets low enough. I'm not sure why, I've poked the ANSEL and CMCON, but it seems maybe the output voltage on those pins is a little different or something. Anyone have any ideas what might be going on? I see you are driving your green channel with GP2, does that work fine for you?
    I used this header in a previous version that used gpio.0 as an adc input and 1,2 and 4 as the pwm channels

    @ device pic12F683, intrc_osc_noclkout, wdt_on, mclr_off, protect_off
    @ device INTRC_OSC_NOCLKOUT
    DEFINE OSC 4

    trisio =%00000001
    ansel =%00000001 'analog off except gpio.0
    cmcon0 =%00000111 'Comparators Off
    pasos con 16
    ciclos con 10
    conta var byte
    puerto var byte


    and this is the routine I use for the led brightness increase:

    for conta=0 to 255 step pasos 'Rise routine
    pwm puerto, conta, ciclos ; puerto is the port to be used
    next conta
    high puerto ; after it reached the top brightness, set port high
    return


    you can use the same routine for decreasing, just change the for next and put a LOW after the loop instead of the high.

    hope it helps


    Pablo

  11. #11
    Join Date
    Dec 2005
    Posts
    8


    Did you find this post helpful? Yes | No

    Default Erik

    Try using a 1K pull down from the gate to ground on your MOSFET's. I have found that sometimes they get a little flaky with PWM and the 1K seems to make a huge difference.

  12. #12
    Join Date
    Jan 2006
    Posts
    19


    Did you find this post helpful? Yes | No

    Default

    Ya did put some 1K's on and found the same thing, that it all worked perfectly. I should've come back to this post with that. Strange that I haven't seen any mention of doing that anywhere else.

  13. #13
    Join Date
    Nov 2005
    Posts
    13


    Did you find this post helpful? Yes | No

    Default

    I don't know for sure,

    since i changed my computer I should digg out the old schematics somewhere. But I'm pretty sure that there where pulldown resistors in my design. It's never a good thing to leave the pics pin floating in mid air, which will always cause weird results.

    This being said, does anyone think it's feasable to design a RGB christmas light with 50 channels from one PIC controller, prefferably 16C class? I don't think it can be done. Last year with the 8 channel set-up, it was already clear that the switching between the colours was getting a bit iffy to say the least, colours bleeded a bit from one transistion to another when working with 2 or more colours at the same time. I would use decimal counters to go down the row of leds, but I don't think it could be switched fast enough to at least have a flicker-free view.

    It was programmed like this:

    set pwm for red - green - blue
    turn on all used channels
    wait a few msec
    turn off all channels
    set pwm for red - green - blue
    turn on all used channels
    wait a few msec
    turn off all channels
    etc...

    When I wanted one out of two leds to be red and the other ones blue, I ended up with a light shade of blue and a shade of pink, which made me think the PWM channels didn't ramp down fast enough or something.

    Steve

  14. #14
    Join Date
    Mar 2007
    Posts
    3


    Did you find this post helpful? Yes | No

    Wink I am a new user.Where is the asm or hex code for this cicuit

    I am a new user.Where is the asm or hex code for this cicuit.
    Thank you very much.

  15. #15
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by eduman View Post
    I am a new user.Where is the asm or hex code for this cicuit.
    Thank you very much.
    You haven't written it yet!

  16. #16
    Join Date
    Mar 2007
    Posts
    3


    Did you find this post helpful? Yes | No

    Smile

    Sorry,
    I don't understand.

  17. #17
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by eduman View Post
    Sorry,
    I don't understand.
    People spend a lot of time learning, building, writing, testing, researching, and repeating that same process until they get the result they are looking for.

    I (as well as many others) would be more than happy to write the code to fit your application, design a circuit, build a board, and I'll even hand deliver it to your house/business/whatever...for the right price!!!
    Or maybe you could just learn it yourself...

    Post your idea for a circuit, and some code to go along with it. We can help you iron out problems.
    There's a lot of people around here that would be more than willing to help you out.
    But, as for me (and most others), I'm not going to do it for nothing.
    One hand washes the other...
    You wash my back, I'll wash yours...
    Do unto others...
    blah blah blah
    Get the picture now?

  18. #18
    Join Date
    Mar 2007
    Posts
    3


    Did you find this post helpful? Yes | No

    Default

    Thank you for your information.

  19. #19
    T.Jackson's Avatar
    T.Jackson Guest


    Did you find this post helpful? Yes | No

    Thumbs down Here to make money?

    Quote Originally Posted by skimask View Post
    People spend a lot of time learning, building, writing, testing, researching, and repeating that same process until they get the result they are looking for.

    I (as well as many others) would be more than happy to write the code to fit your application, design a circuit, build a board, and I'll even hand deliver it to your house/business/whatever...for the right price!!!
    Or maybe you could just learn it yourself...

    Post your idea for a circuit, and some code to go along with it. We can help you iron out problems.
    There's a lot of people around here that would be more than willing to help you out.
    But, as for me (and most others), I'm not going to do it for nothing.
    One hand washes the other...
    You wash my back, I'll wash yours...
    Do unto others...
    blah blah blah
    Get the picture now?
    You're here to make money? With that in mind a long with your rather rude attitude, I think you're in the wrong place. Not saying that it's not possible to pick up a job or two around here, but with that sort of attitude I wouldn't hold my breath.

  20. #20
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Thumbs down

    Quote Originally Posted by T.Jackson View Post
    You're here to make money? With that in mind a long with your rather rude attitude, I think you're in the wrong place. Not saying that it's not possible to pick up a job or two around here, but with that sort of attitude I wouldn't hold my breath.
    Man, you miss the point completely and entirely...way over your head...

    I'm glad you got a good, expensive education. I'm glad that somebody will pay you for your hard learned skills. I hope somebody will recognize you for your many years of effort. I hope those same people recognize you for your years of experience so far. I wish you luck in future electronic adventures. May the demons of evil get confused on their way to your doorstep. I bow to your overwhelming skill and intuition.

    If I may quote a little something I found here on the site:
    Date of Birth: February 8, 1977
    Age: 30
    Biography: Fulltime student - Bachelor of Applied Science in IT
    Location: Australia
    Interests: Cars, Computers, Electronics
    Occupation: Currently not employed

    I like that last line the best!
    Last edited by skimask; - 29th March 2007 at 15:01.

  21. #21
    T.Jackson's Avatar
    T.Jackson Guest


    Did you find this post helpful? Yes | No

    Default Err

    Quote Originally Posted by skimask View Post
    Man, you miss the point completely and entirely...way over your head...

    I'm glad you got a good, expensive education. I'm glad that somebody will pay you for your hard learned skills. I hope somebody will recognize you for your many years of effort. I hope those same people recognize you for your years of experience so far. I wish you luck in future electronic adventures. May the demons of evil get confused on their way to your doorstep. I bow to your overwhelming skill and intuition.

    If I may quote a little something I found here on the site:
    Date of Birth: February 8, 1977
    Age: 30
    Biography: Fulltime student - Bachelor of Applied Science in IT
    Location: Australia
    Interests: Cars, Computers, Electronics
    Occupation: Currently not employed

    I like that last line the best!
    You're throwing stones at someone who's struggling to do a degree? Few years ago I drove around in a Twin Turbo charged black Nissan 300ZX and I always had a wallet with "something in it" Now the tables have turned, I now live in a remote location with next to nothing. I'm a struggling full time student.

    In my better years I have contributed a wealth of knowledge to the Silicon Chip magazine and hardly got paid anything. I currently have a software archive of 17 submissions on Planet Source Code. One of which is in the hall of fame section. I did not get paid a penny for them. Knowledge received / knowledge given is what it's all about. Sadly you seem to have no concept of it. "My overwhelming skill and intuition hasn't come easy I can assure you"

  22. #22
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Twin Turbo charged black Nissan 300ZX ----> Wish I could find one of those, I'd even settle for a 280ZX

    In my better years -----> All 30-some of them right? I'm 37, and I've said it before, I'll say it again, I know I don't know squat about nothing and probably never will

    I currently have a software archive of 17 submissions on Planet Source Code. One of which is in the hall of fame section -----> Does somebody hear a personal horn tooting around here somewhere?

    I did not get paid a penny for them -----> Ya think anybody around here does? Well, maybe a select few of the elite...

    Knowledge received / knowledge given -----> My point exactly, ya shmo! 'cept that a good portion of these fools/newb's don't want to do ANY of the leg work themselves...they want stuff handed to them on a platinum plate, a one-way transaction all the way, no thought of meeting halfway. Screw that. I've got better things to do.

    you seem to have no concept of it -----> you still don't get it...'cause whether you realize it or not, I'm laughing...

  23. #23
    T.Jackson's Avatar
    T.Jackson Guest


    Did you find this post helpful? Yes | No

    Exclamation Lay off the drugs

    Lay off the drugs.

  24. #24
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by T.Jackson View Post
    Lay off the drugs.
    Oh...good comeback there Corky. You come up with that yourself?

  25. #25
    Join Date
    Apr 2003
    Location
    Cambridge - UK
    Posts
    1,030


    Did you find this post helpful? Yes | No

    Default

    Hey SkiMask, if you can change a busted cam belt and swap a few valves, i have a Twin Turbo charged Metallic Black Nissan 300ZX sitting here with your name on it.

    If you can't or you can't afford to ship it to your location, I'd be happy for you to adopt it - like an adopted pet in an abandoned animal sanctury.

  26. #26
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lester View Post
    Hey SkiMask, if you can change a busted cam belt and swap a few valves, i have a Twin Turbo charged Metallic Black Nissan 300ZX sitting here with your name on it.
    Ouch! Ya have to hate it when that happens!
    Much as I'd LOOOOOOOVE to fly over and get my hands dirty, I'd have a helluva time trying to drive it back

    Wait a minute...I thought Nissan has always used timing chains instead of belts. I've got a '98 200SX/SE, took it to the shop to buy an oil seal for the crank, asked about getting a new timing belt. They said they'd do it for $5 in labor and do it in 10 minutes. That's when I figured out my engine used chains instead of belts The mechanic said Nissan's have always used chains (then again, he was a bit doofy looking), probably didn't know what he was talking about...

  27. #27
    T.Jackson's Avatar
    T.Jackson Guest


    Did you find this post helpful? Yes | No

    Post

    What a ride! That thing fitted me like hand-to-glove. Doubt too many people would really say much otherwise though. Shame about my current car, he's not all there, just have to ignore it I guess.

  28. #28
    cjurczak's Avatar
    cjurczak Guest


    Did you find this post helpful? Yes | No

    Default

    Seems everyone is using MOSFETs to switch their RGB leds, any reason not to use a darlington pair?

  29. #29
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by cjurczak View Post
    Seems everyone is using MOSFETs to switch their RGB leds, any reason not to use a darlington pair?
    MOSFETs don't have a secondary breakdown when they overheat, so less chance of burning up. Mainly, no base resistor needed, lower drain-source resistance, practically zero gate current required (gate cap's make it draw a bit of current at high freq's, not much though.

    The list goes on...

  30. #30
    T.Jackson's Avatar
    T.Jackson Guest


    Did you find this post helpful? Yes | No

    Post Metal-Oxide-Semiconductor-Field-Effect-Transistors

    MOSFETS are a voltage controlled current source as apposed to BJT's which are a current controlled voltage source. FETs in general have a relatively higher impedance than their BJT counterparts.

    I think there's a lot of personal preference between the two. I will make a bold statement and say that "BJTs make better audio amplifiers" In many cases, either of the two can be made to work.

  31. #31
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default ZXLD1350 constant current high power LED driver

    This is a pretty old thread. But thought I would add a link to a constant current driver circuit for 1 watt LED's. There are a couple other products around, but this is pretty low part count, and allows from 1 to multiple LED's, so its pretty versatile. It also accepts 7 to 30 volts. They also happen to use a PIC.

    Project site: http://picprojects.org.uk/projects/hbld/index.htm

    Calculator tool for ZXLD1350 chip: http://www.diodes.com/_files/calculators/zxld1350calcv2.xls

    ZXLD1350.pdf

    Name:  hbldpcb_c5.jpg
Views: 13693
Size:  73.3 KB
    Attached Images Attached Images

  32. #32
    Join Date
    Mar 2012
    Posts
    4


    Did you find this post helpful? Yes | No

    Default Re: RGB LED driver, Any comments?

    No, however they will require more heat sinking than a Mosfet of equivalent current capacity. Since it is a switch (PWM) the LOW RDSon of most all power mosfets < .1 Ohm Vs a VCEsat of > 1Volt makes it a kinda No Brainer unless all you have are some tip121's? I don't remember which... But @5V gate voltage an IRF 540 is hard to beat for a GP Power Mosfet.
    Doc

Similar Threads

  1. Conway's Game Of Life
    By wellyboot in forum mel PIC BASIC Pro
    Replies: 45
    Last Post: - 28th May 2020, 07:14
  2. Free Project - 245 LED Display
    By T.Jackson in forum Code Examples
    Replies: 221
    Last Post: - 16th August 2009, 05:59
  3. new and need help
    By smeghead in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 3rd November 2008, 21:19
  4. Scale 8bit ADC RGB LED voltmeter
    By Ryan7777 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 22nd February 2008, 04:37
  5. LCD will not start
    By btaylor in forum mel PIC BASIC Pro
    Replies: 49
    Last Post: - 24th May 2007, 03:30

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts