Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

General advice... lots of LEDs...

Status
Not open for further replies.

Hippogriff

Member
Afternoon all,

If anyone has read my posts before, they'll know I'm just starting out with pretty basic electronics, JAL is my language of choice and the PIC 16F628a has now been superseded by the PIC 12F683 as my PIC of choice. I can effectively solder veroboard and most of my stuff has been playing around with those powerful 3 watt RGB LEDs to create mood lamps using software PWM... I honestly think LEDs are really cool. I also have some RGB LED strip that I'm intending to build a wall washer out of... when I can find the right wall!

My question is all about LEDs... but more of them. Using a PIC 16F628a I had quite a few output pins, with the 12F683 I obviously have less. Considering that these RGB LEDs require three output pins, I am wondering what would be my best strategy if I wanted to drive more than 1 RGB LED for same project - and by "more than 1" I mean the LEDs could be different colours at different times, so I'm talking about addressing them / controlling them discretely / separately.

With a PIC 16F683, and its 8 pins, I guess I could drive 2... with a PIC 16F628a I guess I could control a few more.

But is that the best strategy - filling up my PIC's output pins with direct connections to LED R, G and B - or should I be looking at something else? Obviously I'm learning so it's often a case of "I don't know what I don't know" but I'm thinking of LED driver ICs.

If I wanted to drive a fair number of discrete LEDs from a PIC, would I be best choosing the appropriate PIC (with more outputs than a 16F683 can offer) or should I start to look at getting an extra LED driver IC (apologies, but I'm not even sure what IC I'm thinking of here yet)?

If the latter, then what is a suitable IC for this kind of thing? How do you then go about communicating between the PIC and the LED driver IC? Is there a single connection made between the two and some form (well formed?) of digital communication sent from the PIC to the LED driver? Would I just set a PIC pin to be digital output then blast command codes down it, or what? You can tell I'm struggling to tread water here.

I've been doing some Googling today... found lots of interesting stuff... but know that folk on here often have good thoughts and direction, so any guidance / thoughts / questions appreciated.
 
Latching (or non latching) shift registers are easy I/O pin expanders for this kind of thing, the only limit to the number of I/O lines you can add is how fast you can clock the data out to them and how fast you need to update all of them. Depending on your LED power a shift register may have enough output drive to power an LED directly, or you can use a simple pass transistor for higher power LEDs.

Non latching shift registers are used when you don't care if there's a little flicker during update, and latching registers would be used if you wanted to flick a single I/O line to instantly update the entire array.
You can also multiplex LED arrays, and for very large displays it seems pretty common to use shift registers for the extra I/O and multiplexing to decrease the number of shift registers required.
 
Hmmm, thanks... I'll admit that some of that introduced new terminology to me, so it went a bit over my head. What I gather you're saying is something about IO pin expanders, so a single IO pin could control multiple things. However, there might be issues if I needed to update them all at the same time?

What extra info. I can provide is the following... all LEDs will be on (to a certain extent, software PWM) at the same time, probably showing different colours, and flickers are never good or desired. Also, from the PIC, I am already using BC337 transistors between the IO pins and LED R, G, B components as these are 3w / ~5v / and can use up to around 800mA LEDs (when full white). Would a shift register maybe not then require transistors?

So, I guess I should be looking into "shift registers" by the look of it?
 
Last edited:
No, for that kind of current a shift register would still require transistors. Look up shift registers, they're pretty simple. You supply a data bit on one I/O line, and you supply a clock on the other line, every time you send a pulse to the clock line it shifts the data bit into the next bit of the shift register. Common shift registers are 8 bits but have a carry bit for effectively a 9th bit, if you feed that 9th bit into the data input of another shift register and supply the same clock to each you end up with 16 bits, or as many as you daisy chain. A latching shift register is the same thing, except there is an enable line as well, when you clock in the data it goes into a register inside the chip and when you strobe the latch enable line the data in the latch register is instantly applied to the output lines nearly simultaneously. So using three I/O lines, one for clock, one for data, and one for latch enable the only limit to the number of I/O lines you can control is how fast you cant shift the data into the registers. There are tri-state shift registers, but they're a bit more complicated. For LED switching tri-state is not required nor is input, so standard 8 bit latching shift registers work just fine. There are sometimes other control lines, the big one I can think of would be a reset line which could be tied in common to all chips, when you strobe that line every shift register resets. The details will be up to the specific shift register you chose.
 
Last edited:
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top