Go Down

Topic: Software PWM using daisy chained 74HC595s / SPI (Read 26132 times) previous topic - next topic

Tomppu

#15
Oct 05, 2010, 12:41 am Last Edit: Oct 05, 2010, 01:26 am by tmartins Reason: 1
Sorry for multiple posts. Here are some usefull links:

How to make a current limiting circuit I mentionded earlier. Tested and works!

http://www.instructables.com/id/Circuits-for-using-High-Power-LED-s/

Cheapest 3w RGB leds you can find:
http://www.dealextreme.com/details.dx/sku.4530

Nice stuff about BAM:
http://www.picbasic.co.uk/forum/showthread.php?t=7393

Other problems:
How an earth to get a tight beam from a rgb led with good color mixing. Lenses show the colors separate. Maybe a reflector with a bit wider base? Dunno....

marklar

@Tomppu - nice updates - thanks for contributing improvements.

PostOfficeBuddy

Honestly, I think it's easier and nearly as cheap to drive power LEDs with dedicated ICs. There are many out there on the market, like the STP04CM05 I mentioned earlier. I got those for $2.20 a pop from Mouser. There are also single-channel drivers with PWM input that you can run from the TI PWM chips like the TLC5940, which you can combine for hardware PWM control (3000+ levels). I like the STP04CM05 with software PWM because it minimizes the PCB size and BOM.

If you are using the TLC5940, you don't want to drive LEDs directly with it, but instead control a constant-current IC or a transistor (you may find a hex inverter IC useful in that case since 'on' is LOW on the TLC).

I'm actually using the DealExtreme LEDs in our projects. They have good consistency and you can't beat the price. The are very sensitive to overcurrent situations though.

As far as beam concentration, I recommend a reflector over a lens for most uses. As you have found, the collimating lenses essentially project a huge image of the LED pads onto your target surface. Personally, I like the SO27XA reflector but I'm not sure about it's availability outside of the States. A diffusing material can help as well; frosted window film is cheap and works quite nicely.

PostOfficeBuddy

#18
Oct 05, 2010, 06:21 pm Last Edit: Oct 05, 2010, 07:13 pm by PostOfficeBuddy Reason: 1
Tomppu, the thread you linked to actually contains the explanation and the solution to the flickering problem you encountered. Start at this post to see what I mean. The solution is to output the BAM waveform followed by a mirror image of it.

I don't have time to modify the code right now, but I might later this week. If you can get a working version using MIBAM (mirror image bit-angle modulation) I would be glad to test it!

Edit: There is a dedicated MIBAM thread here. After reading through, on the Atmega328 at 16MHz, I think it is possible to drive 64 channels at 120Hz with 11-bit resolution (2048 levels). At 10-bits you could drive 128 channels, etc. Then again that is based on assembly performance so I'm not sure what the difference would be using the Arduino IDE. But it's encouraging!

Tomppu

I saw the mirror thing and I tried it but it did not seem to solve the problem. And is a bit the same thing done differently. The problem are the "long" bits 6, 7 and anything that splits them to pieces (mirror = each of the bits in two time slices.

Assembly would help but at least for me it makes the code slow to write and difficult to understand so I try to avoid it.

I am building a mood/disco light with 16 RGB=48 channels and the BAM seems to solve that.


Lets keep the thread open and post when ever new links or info comes or somebody gets new code working!

Tomppu

@PostOfficeBuddy - thanks for your input.

STP04CM05 seems like a smart choice if you combine with sofware  PWM/BAM. The current range of <400ma seems to fit many high power rgb leds. Digikey was $2.5 apiece and you need one per led.

The TLC5940 is not really that useful - $4,5 for hardware PWM and 16 channels, but it does not help driving the leds due to power constraints. 120ma per channel but not at all once.

I kind of liked the software + shift registers due to the cheap price and part availability for hobbyists. But this does not yet drive the leds and still needs a transistor / FET circuit.

Can somebody figure out how to make a working current limiting circuit with cheap PNPs that can handle <400ma. That would make a simple cheap driving system.

A lot of different choices as we can see and not one single best way to do things.

Part count and pcb area is also one constraint / design driver.

What we would like is probably the cheapest, easiest to build, easiest to control led driver solution for 10-100 leds.


PostOfficeBuddy

#21
Oct 05, 2010, 09:48 pm Last Edit: Oct 05, 2010, 09:50 pm by PostOfficeBuddy Reason: 1
Right, with the TCL5940 you still need power handling. It's only good for hardware PWM. The simplest true constant-current circuits (without an IC) that I've found are these:

- http://www.instructables.com/id/Power-LED-s---simplest-light-with-constant-current/
- http://www.instructables.com/id/Circuits-for-using-High-Power-LED-s/

But like I said there are many suitable ICs for the task that are not that expensive. Linear drivers are less efficient but reduce the board space and necessary components. You just have to pay more attention to heat and voltage requirements. Switching drivers have a larger BOM but are much more efficient and flexible.

The STP04CM05 is a linear regulator and you actually don't need one per LED. You need 3 per 4 LEDs. :) Since they have 4 channels a piece. The only hardware I've had to use in addition was a simple PI (L/C) filter and a heavy-duty 25A protection diode which also lowers my 5V supply down to 3.55V. That has a large heatsink.

Also try Mouser for the driver ICs like STP04CM05, I've found they are significantly cheaper there.

Tomppu

Mr PostOfficeBuddy. Thank you for your input. After sleeping over it would like to make a summary of what I have learned about driving leds with Arduino:


I think your idea of using the 400+mA 4 ch http:// http://fi.mouser.com/Search/Refine.aspx?Keyword=STP04CM05  is the the best compromise in all respects if you want to make led room lighting with many channels.  Want more light? put the leds in series (no common anode/cathode RGB leds then). Needs soft PWM/BAM, interrupts etc.

For something really huge (10-50A!) the 595 shift register mosfet solution might be the way to go. The mosfet FQP50N06L is $1 per channel so the price is really there. Not too bad, but that results in quite a big board if you go through hole. With surface mount components/board it would work ok. Needs soft PWM/BAM, interrupts etc. The current is defined by a 0.5-X Ohm resistor and you need one per channel so you cannot easily alter the current.

Dont like software PWM/BAM? Use TLC5940/TLC5947/MAX stuff, really easy to use with Arduino. Use the FET circuit we talked about for driving or if you do not have that many channels constant current sources might work for you and still keep your budget.

You like led cubes and matrices (low power stuff)? The Lightuino 3.0 Arduino Led driver with 70 sinks and 16 sources will drive your 1000+ leds and if you need more you can stack them. http://makersmarket.com/products/lightuino-led-driver-30-superstackable. Out of stock but they just sent me one for $60 or so. Just connect the leds and you are ready to go.


How to power everything? For low power and/or high voltage (=some leds in series) normal 9-24V power sources are cheap enough and give you enough current.

For low voltage (=5V) and high power you can use FlexATX computer power supplies like HEC-120SA-7FX that are small and cheap and will give you a lot of regulated current with 5V and 12V.



Please correct me if I am wrong or you get new ideas!

Best Regards,

Tomas

ps PostOfficeBuddy - it would be nice to learn more about your (and other's) projects as I can see you have spent a lot of time working with these things.

ps2 One more thought about power losses.  People seem to pay a lot of attention to power losses when driving these led things. I think this is illogical as long as we are not doing office lighting or 1000 street lights. I have maybe 500W of light bulbs lighting the house so 10+W of heat from my led mood lights is not really a problem or is it  :) And I do not even want to think about the new graphic cards for gamers.







Tomppu

#23
Oct 08, 2010, 02:20 am Last Edit: Oct 08, 2010, 02:23 am by tmartins Reason: 1
One more nice link. 38 a page document from ST micro.

"Generating multicolor light using RGB LEDs" (using a microcontroller, soft PWM and STP04CM05 4 channel driver)

http://www.st.com/stonline/books/pdf/docs/13431.pdf

6OPMEHTAJIb

Hello. Marklar, Tomppu thanks for a good sources.
I try to adapt your code for LED cube 3x3x3. In the code there are comments about the multiplex, I need this, but I do not understand how to do it correctly. Layers of the cube (cathodes) must be LOW for small intervals of time, but so that the PWM continued to work.As I understand it, it is necessary for the time TIMER_DELAY run through all layers and turn they to LOW then HIGH.
Please, tell me how to include it in your code right. Maybe the second timer?

And yet, once I started to ask))) I want to do frame animation with array with the LEDs status for each layer or column, like this:
array
  • {
      {B01110000, b00001111},
      {}
    }:
    Can you advise how best to use your code for this?

Go Up