I want to create something that is kinda simple in concept, but I am getting lost in determining how to do this with the fewest components and the best way...
Concept: I am going to trigger, with a digital input (or possibly analog input) from a sensor a bunch of RGB LEDs (maybe 10-20 of them). I really would like to have some cool effects with the lights that I could trigger, which means individually controlling the lights. I will have several light patterns, both triggered by sensor, but 1 coming up randomly (software controlled).
I was looking at the Arduino controller (Nano V3). But how to control the lights the best? And is this the best controller for it? If I use the PWM outputs, I think I can only control 2 of the LEDs.
Should I re-think? What is your advice?
Sure, fairly standard.
You need to multiplex the LEDs.
Say you can common cathode parts.
You drive the Anodes from a PWM pin each.
The cathodes are all pulled low using shift registers like TPIC6D595 (or 6B595 or 6C595, check avnet.com for availability).
You will analogWrite the PWM value LED1, and takes its cathode low for small time, then back high.
Repeat for as many RGB LEDs as you have.
The longer you have each on, the brighter the overall display will appear.
If each is on for 1/40 of a second, they will all appear to be on without flickering.
So, 3 outputs, 3 more to control the string of shift registers, and whatever buttons or analog inputs you want to control program flow on the remaining pins.
ok, mostly makes sense.
What confuses me is the PWM outputs. There are 6 on the board I am using which would power 2 RGB LEDs (Typically). However, the configuration you mention would allow me to power 6 from the Audrino board I was going to purchase. Does that sound correct?
How can I, then, individually control all the LEDs I had mentioned (10-20)? Would I need additional PWM outputs, I assume?
And, lastly, how do I modulate the color in this scenario?
Sorry if the questions are dumb, I am just starting and this will be my first project I know electronics from my EE days, but it’s been awhile since I have breadboarded anything.
Picture is worth a thousand words, as the saying goes…
Picture is worth a thousand words, as the saying goes...
But 1000 words is just less than 2kB, but your picture is over 60kB :stuck_out_tongue_closed_eyes:
Ok, I guess more cropping next time then!
Looking forward to giving this a try when all my parts come in ;)
Maybe I'm just not getting it :( I do have it setup as you suggested, but seem to always be getting the same colors across the 4 RGB LED's. Can you show me a bit of example code where I can differentiate each RGB? I'll keep trying here as i have the circuit setup like you suggest (except with a 74HC595)
With a 74HC595 you need different data, walking a 0 across the outputs for the different rows.
with the TPIC6B595, the output goes low when the input is high.
with the 74HC595, 1 in = 1 out.
I did get that working, thank you very much for the help and direction! :)
Curious now... I have 20 RGB LED's that will be mounted around a circle opening (in wood) with LENS Caps to protect them. Now I am wondering, how best to wire them? Is there any good way to have a wiring harness that would go from each LED back to a central board? I guess I'm thinking more like a PC board where all the wires are removable. I've been looking around and I'm sure I could make something myself, but just curious if there is a 'typical' way to do this.
Sure, wire all the Rs together, all the Gs together, all the Bs together, bring back to 3 PWM pins. Wire the Anodes, or Cathodes, to separate drivers, and create a multiplexing loop in software.
I've already done all that :) And the programming is completed, even.
I'm more wondering about circuit board design. Since the LEDs will be remote from the board, I was curious if there are pre-made wiring harnesses to go from 'pins' on a circuit board to RGB LEDs? Something that will make it easy to wire up (not hard-wired).
You can make up a wiring harness really easily.
These housings & terminated wires work great.
Buy a bag of housings and wires, make up what you need.
Male terminated wires in a housing will plug right into female headers.
Solder LED to resistor to the other end of the wire.
Here’s an example - wires in headers connecting a pro-mini to a custom board, with some loose ends ready to be attached to a DB9 connector.
The headers come in all sizes, pick some adjacent pins to plug into, or use 1x1 if you’re spreading the pins used around a lot more.
Very nice, thank you!
And, as always… I have a next question I was, initially, looking at ExpressPCB to create the circuit board. Since it is basically like the ShiftOut example on this site, there isn’t much to it. Do you create your own boards? I don’t mind learning - haven’t done it before, but have soldered plenty when I was in engineering school and in my first job (oh, so long ago). But - if I can get the boards made professionally and relatively cheaply - I would rather that be done.