Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] One PIC, a lot of LEDs to Pulse Width Modulate...

Status
Not open for further replies.

henninggs

Member level 2
Joined
Nov 10, 2011
Messages
45
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Location
Denmark
Activity points
1,688
Hi.

I would like to use one PIC to control the PWM for let's say around 200 LEDs.
The PIC should be able to adjust the brightness/PWM of each LED alltough time is not critical. All I want to do is to "dim led no. 63 5% somewhere around 5:00pm. If it gets 5:10pm thats fine too" No hurry.

I dont think that I can find a PIC with that many PWM outputs so I need something else. I am looking for some kind of external IC that will provide the PWM to the connected LED. I would like the PIC to send a command (or set a voltage) on this external IC and have this IC deliver the correct PWM to the LED until it is told to otherwise.

Any ideas ?
 

Iuri

Member level 2
Joined
May 14, 2011
Messages
50
Helped
3
Reputation
6
Reaction score
2
Trophy points
1,288
Activity points
1,630
Well, my idea is to use DEMUX's and you "refresh" the brightness of each LED one by one fast enough to pass unnoted by human eye. Got it?

Iuri~
 

henninggs

Member level 2
Joined
Nov 10, 2011
Messages
45
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Location
Denmark
Activity points
1,688
Well, my idea is to use DEMUX's and you "refresh" the brightness of each LED one by one fast enough to pass unnoted by human eye. Got it
I don't think that would work with 200 LEDs. It would have to be a very very fast microcontroller...

---------- Post added at 11:14 ---------- Previous post was at 10:50 ----------

@Keith

I'm looking at maxim's site, but I am not sure what I am looking for...
The driver should be able to maintain the correct PWM on its own and it should be controllable from the microcontroller so it needs some kind of interface/control pins.
Does such a driver have a special name ? Are there any keywords I can google to learn more about such a driver ?
 

keith1200rs

Super Moderator
Staff member
Joined
Oct 9, 2009
Messages
10,877
Helped
2,064
Reputation
4,128
Reaction score
1,597
Trophy points
1,403
Location
Yorkshire, UK
Activity points
57,269
There a quite a lot to choose from. Have a look at the MAX6946 and similar devices. You need to be searching for LED PWM Driver, I think.

Keith
 

chevymn1964

Full Member level 2
Joined
Apr 1, 2006
Messages
120
Helped
2
Reputation
4
Reaction score
0
Trophy points
1,296
Location
Santa Rosa, Ca.
Activity points
2,551
How about dasy-chaining some shift-registers, such as 74HC595 and use PWM on OE ( Output Enable ) PIN?
 

henninggs

Member level 2
Joined
Nov 10, 2011
Messages
45
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Location
Denmark
Activity points
1,688
How about dasy-chaining some shift-registers, such as 74HC595 and use PWM on OE ( Output Enable ) PIN?
Well I am no expert, but that would give the same PWM on all outputs ?

UPDATE:
Hi, see klug's post bellow. This was properly what you was aiming at ?
 
Last edited:

klug

Advanced Member level 1
Joined
Jul 4, 2002
Messages
476
Helped
12
Reputation
24
Reaction score
7
Trophy points
1,298
Activity points
4,382

henninggs

Member level 2
Joined
Nov 10, 2011
Messages
45
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Location
Denmark
Activity points
1,688
Thanks klug, this was very interesting.
I'll need to google Binary Code Modulation a bit more and find some schematics, I don't quite get the theory/concept yet.
 

klug

Advanced Member level 1
Joined
Jul 4, 2002
Messages
476
Helped
12
Reputation
24
Reaction score
7
Trophy points
1,298
Activity points
4,382
You can compare BAM & PWM on this picture:
image.png


Principle of BAM is very simple:

Bit - Weight
0 - 1
1 - 2
2 - 4
3 - 8
4 - 16
5 - 32
6 - 64
7 - 128

Weight is a time to light the LED.

For example, if you need to get brightness 0x2F (0b00101111), then you will switch off the LED on period of 128 and 64 of tacts, switch on for period of 32 tacts, switch off for period of 16 tacts, on for periods of 8, 4, 2, 1.

image_3.png


If you will try to make 8 bits shiftPWM, then you will need 256 interrupts for 1 period of PWM. But BAM will need only 8 interrupts of controller.

Next advantage, that the frequency of blinking will be higher on BAM (except brightness 0x80 - where they will be equal)
 

henninggs

Member level 2
Joined
Nov 10, 2011
Messages
45
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Location
Denmark
Activity points
1,688
Yes, that make sense, that's clever. Very clever. I got it.
In the links you provided there was also a discussion on controlling A LOT of leds using shift registers and BAM.
I'm a bit confused about the shift registers....

The shift registers has nothing to do with the BAM-concept, right ?
Controlling that many channels with BAM and a 8mhz microcontroller (Think it was 700+ channels) is doable because the BAM method is that much faster Right ? (Not spending so much time in interrupts I guess...)
 

klug

Advanced Member level 1
Joined
Jul 4, 2002
Messages
476
Helped
12
Reputation
24
Reaction score
7
Trophy points
1,298
Activity points
4,382
Shift registers are the output stage of BAM there. You are loading the state of every LED in interrupt by these shift registers. So, you can independently controll brightness of every LED.

For example, you have 8 LEDs, you need to load brigtness 0x80 for first 4 LEDs and brightness 0x0 for last 4 LEDs. So, in the first interrupt you are loading 0x0F to shift registers. On the next interrupts (2-8) you will load 0x0 to shift registers.
 

henninggs

Member level 2
Joined
Nov 10, 2011
Messages
45
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Location
Denmark
Activity points
1,688
For example, you have 8 LEDs, you need to load brigtness 0x80 for first 4 LEDs and brightness 0x0 for last 4 LEDs. So, in the first interrupt you are loading 0x0F to shift registers. On the next interrupts (2-8) you will load 0x0 to shift registers.

Arigh... That I don't get.
I'll read up on "shift register" so I fully understand what a shift register does. I'll get back.

---------- Post added at 23:32 ---------- Previous post was at 22:55 ----------

Well I do get it (I think)
The clue was (taken from the 74HC595 datasheet):
Data in the storage register
appears at the output whenever the output enable input (!OE) is LOW
- And the data pins will remain in their high/low state as long as the !OE is low.

- So:
1. The microcontroller shifts in 11110000 and just holds !OE low for one half cycle (4 leds is on, 4 leds is off)
2. Now it shifts in 00000000 and holds the !OE low for one half of a half cycle (all leds is off)
3. and so on... Result: Led 1-4 have been lit for half a cycle = 50% = 0x80 (If a 8bit resolution is used)

If I want to dim led 8 to 25%, led 7 to 12.5%, I'll shift in:
00000000
10000000
01000000
and 5 times 00000000
 
Last edited:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top