USB-controlled Spectral LED Matrix

Got an idea for a project? Found a cool project you want to share? Post it here!
Post Reply
User avatar
SSriceboat
Posts: 2
Joined: Mon Oct 30, 2017 10:21 pm
Has thanked: 1 time

USB-controlled Spectral LED Matrix

Post by SSriceboat » Mon Oct 30, 2017 11:15 pm

Hey everyone,

First off, I hope it's cool I put this out here, I really like the activity in this forum and I think you guys can help me elegantly create a solution to a problem I'm having. I'm a novice when it comes to making electronics (especially making pcbs), but I've been getting really into it lately and I'm using raspberry pi's and arduinos for all sorts of random tasks. I have so many project ideas but I want to start with this one.

I want to make a 6 x 6 LED matrix array, (so 36 LEDs) where there are 18 pairs of unique-color LEDs. I've looked into multiplexing the array, so that instead of 36 io pins, I can have 6 anode (to 6 rows) and 6 cathode ports (from 6 columns to GND), which is great, but has 2 issues I can think of:

1. If I want to turn on multiple LEDs at the same time, I cannot have them on at the same time, I have to flash them rapidly, and I don't want to do that, I want the light output of 2 like-LEDs at the same time. RGB LEDs just use red, green, and blue diodes, so they don't actually do what I want.

2. The other dilemma with this idea is that I want to be able to plug this led matrix into my Pi or my PC over USB to control them, but I have no idea how to design a working pcb that uses USB input or anything like that... (if you haven't already, consider me the beginner of all beginners)

So I'm throwing this out to you guys for tips and help on this. How can I design a pcb to control so many different LEDs over a USB cable from a Raspberry Pi (or other similar computer). Thanks for any suggestions, I really appreciate it. I've also attached a crude drawing of what I'm talking about and I hope that helps you think about it.

-SSriceboat
benicetomycircuit.jpg
benicetomycircuit.jpg (841.6 KiB) Viewed 503 times
--
SSriceboat

User avatar
ThompsonTinkers
Posts: 37
Joined: Sat Jan 28, 2017 9:36 pm
Has thanked: 48 times
Been thanked: 15 times

Re: USB-controlled Spectral LED Matrix

Post by ThompsonTinkers » Tue Oct 31, 2017 9:02 am

A couple of thoughts on this:

I don’t think I’d try and build up a PCB that does USB from scratch. It sounds like building your project around an Arduino or Pi directly might be more practical at your skill level. And at mine, to be honest.

Each type of LED is going to have a different voltage and current requirements. If you run them out of a matrix, they’ll all have different apparent brightnesses. Sometimes you can see this in the same colour of LED from different manufacturers, or even in lot-to-lot variations.

Driving LEDs can be a little tricky too. If you use an Arduino, each IO pin can source a little power, but sink much more power. In Arduino applications, you tend to see individual LEDs connected on the low side. However, Raspberry Pi GPIO pins cannot source or sink much power. You can only drive very low power (read: status or indicator) LEDs directly from Raspberry Pi GPIO reliably.

I guess, I don’t think this should be a matrix electronically speaking, even if it is one physically. I can think of two ways I would build this. Okay, one strategy, two ways:

Use a shift register that can drive each LED directly. This way you can choose a current limiting resistor by hand for each LED to balance them out. You’ll be able to turn each LED on and off, but fading them would be difficult. You’d have to do pulse width modulation in software, which would be both slow and annoying to implement.

Alternatively, if you use a dedicated LED driver, you can fade the LEDs in software. Most LED drivers are pulse width modulated, afaict. But this is done in hardware, at a high frequency. The software would be much simpler. Because the pulse rate is that much higher, you won’t be able to see it by eye, but might be able to see it in video. I don’t know if that’s relevant for your application.

In either case, you can chain enough drivers together to power all of your LEDs. You’ll need a program on your Raspberry Pi or arduino to run the drivers. Adafruit has some really great tutorials and documentation for their stuff, mostly arduino based. If you do use drivers like this, there is no reason why you couldn’t do it directly off the Pi though. It’s more than capable, and here you’d be using GPIO for communication, not power.

The only thing that leaves is power for the overall project. USB power is pretty limited. To meet spec, devices can only draw 100mA, and then negotiate up to 500mA. That’s pretty tight for a LED array. I think you’ll need an external power supply.

Hope this helps!

User avatar
SSriceboat
Posts: 2
Joined: Mon Oct 30, 2017 10:21 pm
Has thanked: 1 time

Re: USB-controlled Spectral LED Matrix

Post by SSriceboat » Tue Oct 31, 2017 9:16 pm

Thanks a lot for the information ThompsonTinkers. There is a lot for me to unpack in your reply, so I'm going to look into testing your suggestion of using shift registers. One of the dilemmas I had was because each LED is different, they each have different specs and max voltages/currents, and if I can pick a resistor for each, I can optimize the array. Thanks also for the specific links to Adafruit items, that helps tremendously.

For my application, I don't know if PWM will work the way I want it to. My goal is to output as much light from the LEDs as possible in a set exposure time of a camera, and if I have to pulse them at like 10ms with a 1/10 duty cycle, I'm not sure if I'd get more light than if I just ran the 2 like-LEDs in the array with continuous current at the same time. In the diagram I drew in my initial post, you can see I have two of each number LED, and all I'd ever do is turn on both like-LEDs at the same time. I would never have to run more than 2 LEDs at a time. Does that change your thoughts about needing an external power supply?
--
SSriceboat

User avatar
ThompsonTinkers
Posts: 37
Joined: Sat Jan 28, 2017 9:36 pm
Has thanked: 48 times
Been thanked: 15 times

Re: USB-controlled Spectral LED Matrix

Post by ThompsonTinkers » Wed Nov 01, 2017 8:20 am

You’re right, you might get away with two at a time. Depends on the power consumption of your LEDs.

As for a PWM driver, it would (should) only cycle if the brightness of the driver is set to anything aside from full on. So you’d have your two target LEDs that you’d set to full power and everything else to off. The one on the Adafruit site has an internal clock of 4MHz, and a resolution of 12 bits, so that works out to roughly 1ms cycle time. If you do decide to dim them with PWM, you’d notice if you have a fast shutter speed (say, > 1/500, but ymmv).

Also to watch out for: the Adafruit driver has a constant current sink of 30mA. If you’re using higher power LEDs, the shift register can sink a whole 150mA. Anything higher than that, and you’ll want to think about using a shift register to drive discrete transistors.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests