USB controlled PWM for LEDs

xollox

n00b
Joined
Feb 20, 2007
Messages
32
Greetings all,

I'm working on a lighting project and need some input.

I'm looking on doing some mood lighting for my room, controlled by my computer via USB. I found this product that appears to be exactly what I want:
http://groovygamegear.com/webstore/index.php?main_page=product_info&cPath=82&products_id=239
It does 32 output PWM controlled over USB. Each output supports 5v @ 500mA. I'm planning on using either ~8000mcd RGB little LEDs (at 20-25mA each) or 3w RGB giant LEDs (at 350mA each.)

The LED wiz comes with a OCX that can be used to control the lights. I'm a software developer during the day, so this type of control would be perfect.

My questions:
1. Which LEDs would you recommend going with? Each channel would support ~20 little LEDs or 1 giant LED + 6 little ones. There will be 10 channels (10 channels * 3 colors = 30 used outputs.) The room is fairly large and I would like the light to be bright enough to color the room when it's dark out and my monitor is on.
2. Will that USB controller do what I'm asking? Is there a better alternative? I'm comfortable soldering and wiring up LEDs, I'm not comfortable programming PICs.
3. Do you think one of the outputs could be used to turn a power supply on and off using a relay? What kind of relay would I need? Would I put a switch on the green wire or the power switch of the PSU?
4. Is ebay an adequate source of these LEDs or would you recommend going elsewhere? I've had good luck with a couple LED purchases on ebay.

Any other thoughts?

Thanks in advanced.
 
1: You can use whatever LEDs you wish. The LEDs you can buy in bulk off eBay can be very bright, but also have a narrow beam. You might consider getting some Luxeon LEDs from lumileds. They're more expensive, but produce a ton more total light and would require a lot less wiring.
2: That being said, you need to be careful with your power draw. USB ports are only rated at a total of 500mA @5V. I can't tell from the page you linked whether it has an external power supply, but I suspect that it doesn't. Which means that it can only supply 500mA total across all 32 outputs at any given time. If it had an external power supply, it would have to be a 5V 16A brick to drive all 32 outputs at 500mA. I would suggest that you hook up a higher-power transistor to each output, use the transistors to switch the power to the LEDs, and use an external power supply to power those. This also will allow you to use a higher supply voltage such as 12V, which would allow you to power three LEDs with the same current that you'd use to power only one if you used 5V. It also means you'd be able to use some sort of spare ATX power supply (cheap!).
3) Yes. You would just need to set that output at 0% and 100% duty cycle. Again, be careful of the current the relay would draw. You could also use a buffer transistor if the current draw is too much. I'd suggest putting a diode in series with the output of the controller and a capacitor across the contacts of the relay to make sure that if the controller doesn't do "true" 100%, the relay will still be closed long enough. Make sure the relay is a 5V input type. The output contacts you would connect to the green wire and any ground.
4) See #1

Did I make any sense? I sometimes tend to ramble...

 
I counted 16 terminals on either side plus the 3 on the end. I'm guessing +, -, and g for those.

Edit: Nope, it's spec'd to draw 5v from the PC's power supply.
 
Thanks for the replies.

Based on this doc, you can hook up an external power supply:
http://groovygamegear.com/PDF/LEDWIZ_INSTALL.pdf

I was thinking a retired power supply would be perfect too. I have an old (but working) 450w power supply. Based on other 450w power supplies i just looked up, the amperage on the 5v line should be about 40A. Does that sound right?
Also, I'm thinking that just taking one 5v wire from the power supply and connecting it to external power source input on the LED-wiz is a bad idea since the wires on the PSU seem small. Would I need to hook up multiple 5v wires or maybe solder a thicker one onto the PSU PCB to make sure the wire doesn't burn up?

I checked out Lumileds and didn't see any RGB LEDs. Were you thinking 3 seperate ones?
I was looking at something like this on ebay:
http://cgi.ebay.com/High-brightness...ryZ66954QQssPageNameZWDVWQQrdZ1QQcmdZViewItem

After reading some reviews of the LED-wiz, there is a non-PWM always-on mode for an output, which sounds appropriate for the power relay. I guess that means I don't need the diode you were talking about. Is that true? Also, is this relay from radio shack appropriate?
http://www.radioshack.com/product/i...kw=relay+5vdc&kw=relay+5vdc&parentPage=search
 
As an eBay Associate, HardForum may earn from qualifying purchases.
I was thinking a retired power supply would be perfect too. I have an old (but working) 450w power supply. Based on other 450w power supplies i just looked up, the amperage on the 5v line should be about 40A. Does that sound right?
That would be more than enough. If you buffer the outputs, though, you'll be able to use the 12V line of the PSU, which would allow you to drive more LEDs. I'm not sure how many you have in mind, so this may or may not be an issue.
Also, I'm thinking that just taking one 5v wire from the power supply and connecting it to external power source input on the LED-wiz is a bad idea since the wires on the PSU seem small. Would I need to hook up multiple 5v wires or maybe solder a thicker one onto the PSU PCB to make sure the wire doesn't burn up?
I'd just use multiple wires--three would be plenty.
I checked out Lumileds and didn't see any RGB LEDs. Were you thinking 3 seperate ones?
I was looking at something like this on ebay:
http://cgi.ebay.com/High-brightness...ryZ66954QQssPageNameZWDVWQQrdZ1QQcmdZViewItem
Yeah, I was thinking separate ones.I can't tell you anything about the quality of that RGB LED, but it might work, and give you a more compact package.
After reading some reviews of the LED-wiz, there is a non-PWM always-on mode for an output, which sounds appropriate for the power relay. I guess that means I don't need the diode you were talking about. Is that true? Also, is this relay from radio shack appropriate?
Yes, the non-PWM output would be fine, and eliminate the need for the diode and capacitor. That RS relay would also be just fine.
 
As an eBay Associate, HardForum may earn from qualifying purchases.
Is there good way to pick 3 LEDs that will output the proper colors and brightnesses to get a combined output that doesn't look all wonky? That's what caught my eye with the RGB LEDs...I was kinda assuming they would be somewhat matched.

I'm not sure how many you have in mind, so this may or may not be an issue.

I'm trying to light a room, so I'm going to try to get as close the to 500mA per channel maximum as I can without blowing anything up. I'm not familiar with the differences between using the 5v line and the 12v line. I know you'd need a different resistor for each. I'm not sure the advantages and disadvantages. I'm also not sure what you mean by buffer.

Thanks again for all the help!
 
Is there good way to pick 3 LEDs that will output the proper colors and brightnesses to get a combined output that doesn't look all wonky? That's what caught my eye with the RGB LEDs...I was kinda assuming they would be somewhat matched.
Human eyes are more sensitive to greens than any other color, with red being the lowest. So you'd probably want 2 reds, 1 green, and 1 blue for a single "unit".
I'm trying to light a room, so I'm going to try to get as close the to 500mA per channel maximum as I can without blowing anything up. I'm not familiar with the differences between using the 5v line and the 12v line. I know you'd need a different resistor for each. I'm not sure the advantages and disadvantages. I'm also not sure what you mean by buffer.
What I mean is that you should connect each output to the gate of a MOSFET that can then switch the power to an arbitrary number of LEDs. You're going to need quite a few LEDs to light a room decently. If you just use the 5V from the controller, with one LED per channel, it'll look something like this:
Code:
[controller output]----->|-----^^^^----GND
If you use external transistors as a buffer, you can use the 12V from that ATX PSU, and do something like this:
Code:
                                 12V
                            +---+-+-+---+
                            |   |   |   |
                           LED LED LED LED
                            |   |   |   |
                           LED LED LED LED
                            |   |   |   |
                           LED LED LED LED
                            |   |   |   |
                           RES RES RES RES
                            |   |   |   |
                            +------------
                            |
                         |--
[controller output]-----||
                         |->
                            |
                            |
                            |
                           GND
Doing it this way would have a number of advantages:
1) You'd use fewer resistors and waste less power
2) You'd be able to control all the LEDs of one color with only one channel, so a total of 3 channels used. (cost savings opportunity here)
3) Expandable--you can start with a smaller number of LEDs and add more if it's not enough.
4) Safer--you're offloading all the heavy current from the controller, which will keep it cooler and happier.

 
Would a transistor switch fast enough to keep up with the PWM?

Also, I'd kinda like to use all of the channels. I could have 10 "zones" with 3 colors per zone. This would allow for some cool effects.
 
Would a transistor switch fast enough to keep up with the PWM?

Also, I'd kinda like to use all of the channels. I could have 10 "zones" with 3 colors per zone. This would allow for some cool effects.
Yes, it would be fast enough. PWM doesn't typically go above a few dozen kilohertz, and certainly not above 100khz, and almost any transistor you find will be way faster than that.
 
Since the specs mention that you hook the negative side of the LED to the controller, I don't think your schematic (with the 12v line) is correct for this application. What type of transistor would I need and what would the schematic look like for it?

As a side note...this stuff is over my head. That's exactly where I want it to be though, so I can learn while I'm doing this. Thanks for being patient.

edit:
This is what I'm trying to do to my room :)
http://www.groovygamegear.com/LED_Wiz_Music.mpg
 
So if I understand correctly, you hook up the positive leg of the LED to 5V and the negative leg to the terminal on the board? In that case, you'll have to modify the buffer like so:
Code:
                                 GND
                            +---+-+-+---+
                            |   |   |   |
                           LED LED LED LED
                            |   |   |   |
                           LED LED LED LED
                            |   |   |   |
                           LED LED LED LED
                    12V     |   |   |   |
                     |     RES RES RES RES
                     |      |   |   |   |
                    RES     +------------
                     |      |
                     |   |--
[controller output]--+--||
                         |<-
                            |
                            |
                            |
                           12V
Note that you now have a P-type MOSFET instead of the N-type, and that I switched the 12V and GND. Normally, I would have drawn it flipped top-to-bottom, but I was too lazy to redo it. Now, you have current going from 12V, through the p-type transistor, through the LEDs and resistors, and to ground.
 
Awesome, thank you. You're right. postive -> LED -> controller -> negative

I'm not great with schematics, so let me try to describe what I see:
1. I connect the 12v positive from the power supply to the S(ource) connector on the mosfet.
2. I connect the positive side of the LEDs & resistors to the D(rain) on the mosfet.
3. I connect the negative side of the LEDs & resistors to the 12v negative on the power supply.
4. I connect the controller terminal (5v negative) to the G(ate) on the mosfet.

A couple things confuse me:
1. I also connect the 12v positive from the power supply to the G on the mosfet?
2. Does this circuit assume that the 12v power supply that powers the LEDs also powers the usb device? I'm confused as to how everything flows.

When picking a mosfet, I think i need the following:
1. P-channel
2. Gate source breakdown voltage >= 5v
3. Continuous drain current > the current my LEDs will need
Sound right? Anything I'm missing?

I ordered one of the 3w RGB LEDs on ebay. We'll see how it turns out.
http://cgi.ebay.com/ws/eBayISAPI.dl...MEBI:IT&viewitem=&item=230092868734&rd=1&rd=1
 
As an eBay Associate, HardForum may earn from qualifying purchases.
You're on the right track, but you got a couple things mixed up. Here's the fixed version:
1) Correct
2) Correct
3) Connect the negative side of the LED/resistor strings to GND (the black wires). There's not enough current capacity on the -12V lines to handle the load.
4) Correct, except it's not -5V. That terminal isn't actually "5V" or "GND", it's more like "floating" vs. "shorted to ground".

1) The resistor that is connected to 12V and the controller terminal/pMOS gate is a pull-up resistor. When the terminal is "floating" (which normally would be "off"), it will get pulled up to 12V. When the terminal is shorted to ground ("on"), current will flow from the 12V line of the power supply through the resistor. That drives the voltage at the terminal lower, which turns on the pMOS.
2) Because the usb device is no longer sourcing any significant current, it should be fine being powered just off the USB without an external power supply (for itself). The ATX PSU is just to provide power for the pull-up resistors and the MOSFET/LED/resistor stuff.

You're exactly right on the MOSFET characteristics you need.
 
I guess I don't get the whole negative vs ground vs floating thing. Guess I'll have to do some reading on that.

Just to confirm, do these parts look like what i want?
http://www.mouser.com/search/produc...-05virtualkey65500000virtualkey655-T77S1D3-05
http://www.mouser.com/search/produc...virtualkey60310000virtualkey879-UPA1911ATE-T1

What resistor do I need between the 12v and the Gate/led controller?

I'll be ordering my LED-wiz this weekend and will report back when I get that and my giant LED from Hong Kong.
 
I would get a slightly heftier transistor, one with a TO-<something> package, with a Gate-to-Source voltage over 12V. I poked around mouser.com for a while and came up with this: [url="http://www.mouser.com/search/Refine.aspx?Ne=1447464+254016+1410034+1118565+1410038+1410043+1410032+2417238&N=1323038+4294820043+4294850066+4294849735+4294850182+4294843487+4294843963+4294768152+4294844544+4294850201+4294850008+4294841895+4294849632+4294850133+4294768142+4294849714+4294770111+4294770087+4294850118+4294844542+4294844540+4294849622+4294845463+4294850177+4294849191+4294849928+4294849671+4294850086+4294753691+4294849546+4294849708+4294753694+4294753704+4294849752+4294849702+4294849676+4294850123+4294849712+4294849693+4294850202+4294850207+4294849716+4294849683+4294844505+4294846524+4294850183+4294849662+4294770139+4294820015+4294820054+4294820051+4294819082+4294820023+4294817726+4294818224+4294818317+4294818323+4294807645+4294814361+4294820032+4294817548+4294774195+4294819045+4294817598+4294818337+4294818846+4294774212+4294817882+4294817583+4294817905+4294818927+4294818597+4294818924+4294774278+4294817879+4294817449+4294774256+4294817909+4294819938+4294818311+4294819533+4294818854+4294818309+4294818445+4294814412+4294818335+4294812739+4294817562+4294819551+4294817901+4294818467+4294819101+4294818876+4294818360+4294818226+4294813629+4294818329+4294818391+4294817617+4294819546+4294818427+4294819003+4294819100+4294818358+4294817850+4294818125+4294818555+4294818326+4294819941+4294817536+4294819083+4294818357+4294818871+4294814360+4294817621+4294819543+4294818395+4294818869+4294817594+4294813951+4294819314+4294774316+4294818891+4294817881+4294817988+4294813796+4294814368+4294819092+4294817846+4294817518+4294818997+4294818363+4294817904+4294819865+4294818849+4294818931+4294820030+4294819021+4294820025+4294819675+4294818743+4294819986+4294820088+4294820040+4294820046+4294817898+4294820191+4294817448+4294817878+4294820001+4294820196+4294819931+4294819990+4294818672+4294819127+4294820103+4294820013+4294817908+4294818728+4294819373+4294818348+4294819358+4294819885+4294819363+4294818390+4294818858+4294820203+4294819893+4294818594+4294818730+4294818692+4294820323+4294818859+4294818576+4294820044+4294818349+4294818717+4294820207+4294820188+4294818919+4294818565+4294820192+4294818679+4294819309+4294818921+4294819741+4294818301+4294820180+4294820317+4294819430+4294819869+4294820173+4294814358+4294819984+2417238+0&Ns=P_SField&Msb=0&RefType=Header]Link[/url] (and I thought newegg links were long!)

That relay will be just fine. (I hate to throw this in here at this late date, but an optoisolator might also work fine)

As for the resistor, any decent size that won't draw too much current will do. A 1kOhm would be appropriate.

As far as the "floating" vs. "shorted to ground", think of it this way: The terminal is basically hooked to a (electronic) switch. When the switch turns off, the terminal isn't hooked up to anything, so it "floats" unless something else (like a resistor tied to +12V) pulls it to another voltage. As soon as the switch turns on, the terminal is tied to ground. It's when it's tied to ground that current can flow. Normally with this board, you hook up an LED to +5V and the terminal, so when the terminal is conducting, the current flows from 5V through the LED and the current-limiting resistor into the terminal and to GND.
 
Yes, that one you linked will be just fine. An optoisolator works pretty much exactly the same in a circuit, but you can get higher current ratings with a relay. Optoisolators produce basically zero electrical noise on either side, so they're better that way. I'd personally opt for an optoisolator in this case, as it draws less current, won't produce noise, and doesn't have any moving parts.
 
After doing some reading, here's what I came up with:
http://www.mouser.com/search/ProductDetail.aspx?R=6N136Vvirtualkey51210000virtualkey512-6N136V
Data sheet (pdf): http://www.fairchildsemi.com/ds/6N/6N136.pdf

Based on that, I would to hook +5v to pin 2, the controller terminal to pin 3, the green power supply cable to pin 7 and the power supply ground to pin 8. Right?
Exactly! You're gonna have to find that part in smaller quantities, though--the link you provided only allows quantities of 1000+. I'm pretty sure you'll be able to buy just one of that part at mouser, though, if you look around some more.
 
Mouser is a good resource for more eclectic stuff, but you can find much cheaper sources for led's... Have you checked Surplus LED? I've done several bulk orders from them, no problems.

Bonus list of surplus sources.
 
It looks like Surplus LED only carries 1 type of RGB LED and it's common cathode. That's not going to work for this project, as the controller requires a common anode. That's unfortunate because it looks like they have some good prices.

Thanks for the links.
 
I'm looking at picking up wire for the project while I'm buying stuff on mouser. To connect the main box (which includes the LED controller and the PSU) to the light box (which will include 3 mosfets and the LEDs), here's what I'm thinking:
1. I will need 3 conductors for each color, plus a +12v line. These can probably be pretty much any gauge since there won't be a significant load on them.
2. For the +12v and ground lines to the LEDs, I will need something thicker. Each mosfet supports switching 2.5A which means the maximum amperage I can push to the LEDs (without blowing up the mosfets) is 7.5A (2.5x3.) According to this page:
http://xtronics.com/reference/wire_gauge-ampacity.htm
That means I need 20 gauge for the power.

Does that sound right?

edit:
Checking prices on mouser...not going to be buying wire there. eBay FTW.
 
Meh, you can also get wire at your local hardware store or RatShack, too.
 
Just ordered 3 mosfets and the optoisolator. Also ordered 1000' of 2 conductor 24AWG wire on ebay for $18 shipped :)

I'll keep you posted on developments. Going to order the LED-wiz this weekend.

edit: I setup a blog to track progress of the project:
http://coloredroom.blogspot.com
 
Just a quick update on the project. I have 2000' of 24AWG wire in hand from ebay ($28 shipped...the guy wanted to get rid of the other spool he had.) I just received 3 mosfets and the optoisolator from mouser today. My LED-wiz shipped out on Monday with 2-3 USPS, so I should be getting it in the next couple days.

I'll keep the board posted. Thanks again for all the help.
 
Got my LED-wiz yesterday and hooked up 3 blue LEDs to test. Seems pretty sweet so far. Ordered some PC boards from ebay.

I'm looking for a way to connect the box the controller will be in to the boxes with the LEDs in them. It needs to be 6 pin. I've been looking at the PCI express adapters, but haven't found a real good place to get them cheaply. Anyone have any suggestions?
 
Actually, you would be fine with a 4-pin connector, like your regular molex. You'd run the 5V (or 12V or whatever you're using) through one wire to all three of the LED's colors, and the other three conductors would each return from one color to the proper terminal on the controller.
 
Yeah...I was thinking that too. It depends on where I put the mosfets. If I put them in the controller box, I'd only need 4 connectors. If I put them in the light box (my original plan) it'd take 6 wires (5v+, Red gnd, blue gnd, green gnd, 12v+, gnd)

I guess it'd be simpler and cheaper to go the 4 wire route. That just means that the 2000' of wire I bought won't be used for much (it's too small of a gauge.) Oh well.

Should I worry about heat sinks for the mosfets?
 
You should be fine without heatsinks. That's the beauty of PWM. The power dissipated by the MOSFETs is equal to the current time the voltage (P=IV). And with PWM, either the MOSFET is conducting (so V is very close to 0), or it's not (so I=0).
 
Here is what I came up with on the PC board I bought on eBay:
http://img73.imageshack.us/img73/5557/circuit2qc8.jpg

How does that look?

The pink resistors are the 1kOhm pull-up resistors you mentioned. The blue resistors are the appropriate resistors for my LEDs when run at 12v. The yellow things are the LEDs. The green wires connect to the green dots on the board, 1 wire for each dot.
 
^^^That actually looks right. Took me a second to wrap my head around it, but it looks right.

 
Sweet.

Is it cool to chain all those positive leads together or is there a better way to do it?
 
It's fine to connect the positive leads together. They all just need to be connected to 12V.

 
I took a stab at soldering the parts on the PC boards (which are 1" square.) Man, that was a challenge. I think I need to pickup one of those smaller soldering irons and a set of the robot hand thingys. And being far-sighted doesn't help things at all.

I still haven't received my RGB LED from eBay. It's coming from Hong Kong, so I guess it makes sense that it'll take a while.
 
Back
Top