Multiplexing problem - White LED ghosting - Page 1
Forum section: electronics / general

author: hun_yeti
author_rank: Contributor
timestamp: August 08, 2012, 09:42:33 am
content: Hello.I'm working on a little MCU controlled LED flashlight.I have a great problem with it: LED ghosting.It is starting to appear when the switching frequency goes above only a 100hzI have search Google in this topic, and I have found information that it is maybe because of the stray capacitance of the common anode line, and resistors from the collector of the transistor to ground can help with this.I tried it, even very low value resistors didn't make any difference and I don't have and oscilloscope to check out what is going on exactly.I even tried to insert a blank frame between each multiplexing but it didn't reduce ghosting, just the overall brightness (as expected).Maybe the problem is with the code, but i can't find out what it is...I'm using a TI MSP430g2252 20pin dip.Here is the code:Code:pic1=0x55;pic2=0xaa;if (mpx==10){//check flag for interrupt (2khz)mpx=0;//clear flagif (mpxs==1){//multiplex segmentP2OUT=BIT0+BIT1;//turn off both segments (pnp bc327)P1OUT=pic1;//Push character to segment(npn bc337)P2OUT = BIT1;//Turn on Active segmentmpxs=0;}//Next time start withelse if(!mpxs){//the other segmentP2OUT=BIT0+BIT1;P1OUT=pic2;P2OUT = BIT0;mpxs=1;}On this picture the multiplexing is running at 1Khz(visible ghosting)on this picture it is multiplexing at a 100Hz ( no visible ghosting , but flickering to human eye)Thanks for the help in advance!

author: shebu18
author_rank: Frequent Contributor
timestamp: August 08, 2012, 11:07:54 am
content: A clip would be better then pics.

author: hun_yeti
author_rank: Contributor
timestamp: August 08, 2012, 11:34:51 am
content: You are right!here is a little clip:

author: ColinB
author_rank: Contributor
timestamp: August 08, 2012, 01:15:48 pm
content: Can you post a schematic please?Am I correct in observing that the LED in the row above (and below?) the illuminated LED is ghosting, but not the ones in the adjacent columns (left/right)? Based on your orientation in the video, where the transistors are below the LED matrix.

author: ColinB
author_rank: Contributor
timestamp: August 08, 2012, 01:27:57 pm
content: You might be able to tell something by doing a test where you switch only the 2 "commons" and another test where you switch only the 8 "segments" to see if the ghosting is related to only one of these.Something like the following (two separate test code snippets):Code:pic1=0x55;pic2=0xaa;// Test 1:// Test switching "commons" only - same data// driven to segments for each case.if (mpx==10) //check flag for interrupt (2khz){mpx=0; //clear flagif (mpxs==1) //multiplex segment{P2OUT=BIT0+BIT1;//turn off both segments (pnp bc327)P1OUT=pic1; //Push character to segment (npn bc337)P2OUT = BIT1; //Turn on Active segmentmpxs=0;} //Next time start withelse if(!mpxs) //the other segment{P2OUT=BIT0+BIT1;P1OUT=pic1; // Note USING pic1 ON BOTH COMMONSP2OUT = BIT0;mpxs=1;}}// Test 2:// Test switching "segments" only - same data// driven to commons for each case.if (mpx==10) //check flag for interrupt (2khz){mpx=0; //clear flagif (mpxs==1) //multiplex segment{P1OUT=pic1; //Push character to segment (npn bc337)P2OUT = 0; //Turn on both commons (BIT1 and BIT0)mpxs=0;} //Next time start withelse if(!mpxs) //the other segment{P1OUT=pic2; //Drive the alternate pattern to segmentsP2OUT = 0; //Turn on both commons (BIT1 and BIT0)mpxs=1;}}

author: hun_yeti
author_rank: Contributor
timestamp: August 08, 2012, 01:36:38 pm
content: Yes, your observation is correct.Sorry i should have started out with the wiring.I only multiplexed it into two parts (and not four) because i wanted the highest possible brightness and i had enough pins (and as far as i understand the more lines are multiplexed the shorter pulse each line gets)The first and third row share a common anode and the second and fourth lines share an anode.the first led in the first row and the first led in the second row share a cathode ( with a resistor into the transistor)I don't have a schematics , i didn't draw it yet, but here is a diagram:The letters are the anodes and the numbers are the cathodes.A & B is connected to two PNP transistors And every number is connected to an NPN transistors.Code:7A 6A 5A 4A7B 6B 5B 4B3A 2A 1A 0A3B 2B 1B 0BI hope it makes it clearerI don't have to write those test line, because with the buttons on it i can enter pretty much any pattern.And it always lights up the LED that is on the same cathode witch is multiplexed.

author: MikeK
author_rank: Super Contributor
timestamp: August 09, 2012, 12:13:59 am
content: Make sure everything is shutting off before setting the new port value. I would use a hardcoded value, like PORT=0 or PORT=255 (depending on your switching transistors).

author: hun_yeti
author_rank: Contributor
timestamp: August 09, 2012, 06:22:43 am
content: Quote from: MikeK on August 09, 2012, 12:13:59 amThe software does turns off and it is hardcoded:Code:P2OUT |=BIT0+BIT1;//turn off both segments (pnp bc327- so they have to be high to turn off)P1OUT=pic1;//Push character to segment(npn bc337)P2OUT &= ~BIT1;//Turn on Active segmentOnly the First and Second bits are toggled because the other Bits on this port are used for buttonsAnd the thing is that it only appears on faster multiplexing speeds,above 100Hz.

author: amyk
author_rank: Super Contributor
timestamp: August 09, 2012, 09:21:13 am
content: If you haven't read this thread already:https://www.eevblog.com/forum/projects-designs-and-technical-stuff/mysterious-led-problem-could-use-some-help/

author: MikeK
author_rank: Super Contributor
timestamp: August 09, 2012, 12:02:09 pm
content: Do the PNPs have pullup resistors to prevent floating?

author: ColinB
author_rank: Contributor
timestamp: August 09, 2012, 02:04:45 pm
content: Quote from: amyk on August 09, 2012, 09:21:13 amThat really sounds exactly like the problem hun_yeti is having. It's the capacitance of the LED itself that stores enough charge to light the LED very briefly and dimly, but if driven at a high enough frequency, it is visible.Try putting a resistor from the PNP collector (A, B connected to LED anodes) to ground. This will discharge the LED capacitance when the A, B drive is turned off. Try something like a 4.7 k ohm to start with, but maybe 100k will work fine.

author: hun_yeti
author_rank: Contributor
timestamp: August 09, 2012, 02:57:42 pm
content: Quote from: ColinB on August 09, 2012, 02:04:45 pmFirst i thought this as well, but I don't know anymore...I tried to connect a resistor to the collector of the PNP transistors, but it did not made any difference, not a 100k nor a 100r.The program can control the brightness of the LED-s with PWM(well sort off)But it does not matter how long the pulse is ( how bright the LED i want to be on) the other LED (that should stay off) turns on the same amountThis is the code for multiplexing I'm using in my program ( with the pulse leng control aswellCode:if (mpx==16){//check flag for interrupt (2khz)//The loop increments mpx every timempx=0;//clear flagif (mpxs==1){//multiplex segmentP2OUT |=BIT0+BIT1;//turn off both segments (pnp bc327)P1OUT=pic2;//Push character to segment(npn bc337)P2OUT &= ~BIT1;//Turn on Active segmentmpxs=0;}//Next time start withelse if(!mpxs){//the other segmentP2OUT |= BIT0+BIT1;P1OUT=pic1;P2OUT &= ~BIT0;mpxs=1;}}else if (mpx==bright){P2OUT |=BIT0+BIT1;} // shut off all LEDs earlier to reduce the brightnessBut maybe this is all because this is all done on the back of a perf board.After all it is not a deal breaker problem, I just wanted to know what is happening.

author: Skibane
author_rank: Contributor
timestamp: August 11, 2012, 05:37:44 am
content: Phosphor persistence?

author: David_AVD
author_rank: Super Contributor
timestamp: August 11, 2012, 06:45:42 am
content: Quote from: Skibane on August 11, 2012, 05:37:44 amAny phosphor persistence would be many magnitudes of order shorter than the times observed here.

author: andersendr
author_rank: Regular Contributor
timestamp: August 13, 2012, 08:04:50 pm
content: When I look at that video, it looks like the light fron the LED that is being lit, is reflecting off the non lit LED's. To me the tell tale sign was that you had to hold the board at the correct angle to get the problem to show up in the camera. One thing to try would be to put some paper or tape around the LED and see if the problem still exists. Another way to verify this would be to hook up a scope or a volt meter to the LED that lights up that should not. This would tell you if there was trully any voltage across that LED.

author: ColinB
author_rank: Contributor
timestamp: August 14, 2012, 03:52:57 pm
content: Quote from: andersendr on August 13, 2012, 08:04:50 pmI considered that it might be reflected illumination from the adjacent LED as well, but itseemsto be a greater effect at higher multiplexing frequencies, so I don't think it's the problem. The reason you need to get the angle exactly right is because the LED lens focuses fairly tightly and if you really want to get a direct shot at the LED die, you need to look directly down on it -- when it's so faintly illuminated, any angle offset may obscure the output.

author: hun_yeti
author_rank: Contributor
timestamp: August 16, 2012, 08:17:23 pm
content: Quote from: ColinB on August 14, 2012, 03:52:57 pmReflection was my first guess as well, but i ruled that out.And yes, i really have to hold the LEDs straight to to camera because these are very focused LEDs, with a viewing angle of about 15-20°.I wish i had an oscilloscope, that would instantly reveal the problems i think.

author: kripton2035
author_rank: Super Contributor
timestamp: August 16, 2012, 09:33:54 pm
content: can you try to place a small capacitor like 100nF in parallel with each row of leds causing that problem ...just my 2 cents...

author: Colin55
author_rank: Contributor
timestamp: August 16, 2012, 10:18:13 pm
content: First of all we don't know which way you are scanning.Turn on one LED in a high-speed scan and let us know if the mirror is before the LED or after the LED.The fault is definitely due to not turning off the LED fully after illuminating.