Shop OBEX P1 Docs P2 Docs Learn Events
RGB light project questions — Parallax Forums

RGB light project questions

Jason HicknerJason Hickner Posts: 21
edited 2007-12-06 05:36 in Propeller 1
Hello!

I'm putting together an RGB light that needs a bit more brightness than standard low-voltage LEDs can provide. I've been looking at using a group of red, green and blue luxeon 1watt or 3watt LEDs together to create an RGB light.

The problem is controlling the relative brightness of the 3 LED groups. The propeller doesn't have the voltage or current to drive the LEDs, so I need to use some sort of intermediary driver with its own voltage source. I'm not sure what sort of device I should be looking for, though. I'd like to be able to control each of the 3 channels (R, G, B) independently.

I've run across some LED dimmers that use a potentiometer to adjust brightness via PWM, and I've thought about trying to use three of those with the pots replaced with digital resistors, but I'm not sure how quickly the resistors can be adjusted (fast enough for smooth lighting transitions?) and besides it seems like there must be an easier way.

Any ideas or suggestions would be very much appreciated. Thank you!
- Jason

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-12-05 21:55
    The Propeller can very easily do its own PWM. The BS2 compatibility library has PWM routines in it and I believe the application note on the counters (AN001) covers PWM. As you mentioned, you will need some kind of switch to handle the high current. Any power transistor with sufficient gain will work. If you use an MOSFET, be sure the gate threshold voltage is low enough and the voltage gain will get you a low enough on resistance when switched on by the Prop I/O Pin (maximum output = 3.0V, possibly a little higher).
  • Paul BakerPaul Baker Posts: 6,351
    edited 2007-12-05 22:47
    Luxeons have driver pucks which can be used to to drive the LEDs, some of them have a microprocessor control pin to control the brightness. They are not cheap, but are specifically design to provide a constant current (which is the correct way to drive them).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.
  • Fred HawkinsFred Hawkins Posts: 997
    edited 2007-12-05 23:12
    How about this chip? High Voltage DC/DC Boost Converter w/0.5A/1.3A Integrated Switch (Rev. B)·(tps61081.pdf, 1013 KB)
    http://focus.ti.com/docs/prod/folders/print/tps61081.html

    and I think this pdf shows how to connect it to a pwm signal (in their wled example).

    http://focus.ti.com/lit/an/slyt279/slyt279.pdf
  • Jason HicknerJason Hickner Posts: 21
    edited 2007-12-06 00:14
    Thanks so much for the info! I think the driver pucks sound like the easiest piece to work with. They're not cheap ($25 each and I need 3) but they're basically self contained and controllable from just a couple of pins.

    - Jason

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Jason
    www.pr0jects.com
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-12-06 01:06
    The so-called "PWM" output from the Propeller's counters is much too fast to switch a MOSFET directly without operating in its linear region. And Beau is right, you need to regulate the LEDs' currents.

    If you've got more time on your hands to experiment than money for expensive driver pucks, here's a circuit that takes a PWM input (from a Propeller counter or a software PWM routine), filters it to a voltage, and uses that to control the LED current. With the possible exception of the inductor, you can probably build it from stuff you have on hand:

    attachment.php?attachmentid=50797

    R1, R2, and C1 form a filter and voltage divider which is used to feed the positive input of a comparator. The negative input is fed by feedback from a half-ohm current sense resistor on the MOSFET driver's source. The comparator will act in such a way as to keep the voltage on its two input pins equal. Resistors R3 and R4 establish a hysteresis band for the comparator. Without hysteresis, and if the comparator were replaced with an op-amp, the MOSFET would be operating in its linear region and overheating. But we don't want that. In the configuration shown, the comparator will oscillate, and the MOSFET will always be either fully on or fully off. The peak-to-peak current ripple will depend on the ratio of R3 to R4. The frequency will be determined by R3, R4, and L1. These values should be adjusted for a frequency around 20kHz. Any lower than that, and you'll be able to hear it squeal. (I'm guessing at a value for L1 around 270µH to start with. That's a wild guess, though.)

    You will need to breadboard this with a dummy load so you can fiddle with the values without hosing your expensive LEDs. I haven't actually tried this particular circuit, but I've used circuits that are similar to it.

    Good luck!

    -Phil
    374 x 346 - 8K
  • darcodarco Posts: 86
    edited 2007-12-06 01:43
    It should be really easy to create a duty cycle from a prop pin that is at a low enough frequency for just about anything. The trick is to not use the hardware counters, and to use assembly.

    This is what I'm doing for the ybox2 project. I've attached the code for this module, but it should be pretty easy to figure out. If you need it to go slower, you just need to add a delay at the start of the assembly loop.

    Sorry if this code is kinda ugly. It's a work in progress for cog that will handle the tri-color led, the speaker, and also act as a watchdog if the button is pressed for longer than 5 seconds. Obviously, you only care about the former. But I'm too lazy/busy to edit it right now.

    Values go from 0-255.

    This concept could easily be scaled to handle as many duty-cycled pins as you need.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

    darco
    www.deepdarc.com/
  • Paul BakerPaul Baker Posts: 6,351
    edited 2007-12-06 02:08
    The counter NCO mode of operation is capable of producing any frequency from 18 mHz to 10 MHz, note thats a lower case m (ie millihertz). The PLL mode can go as low as 500 kHz.·

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.

    Post Edited (Paul Baker (Parallax)) : 12/6/2007 2:17:23 AM GMT
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-12-06 02:24
    Paul,

    It should be noted that the NCO and PLL outputs all have a 50% duty cycle. To get an adjustable duty cycle at a reasonable, constant switching frequency, you have to do it in software.

    -Phil
  • Paul BakerPaul Baker Posts: 6,351
    edited 2007-12-06 04:40
    NCO can be other than 50% but it does require program oversight.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.
  • darcodarco Posts: 86
    edited 2007-12-06 05:36
    Regardless, for independently controlling the duty cycle of more than two pins, the hardware counters aren't going to be of much help. Might as well do it all in software and make the process uniform.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

    darco
    www.deepdarc.com/
Sign In or Register to comment.