LCD Backlight flicker - how do I get rid of it? (SOLVED) - Page 1
Forum section: electronics / beginners

author: plastygrove
author_rank: Contributor
timestamp: November 22, 2014, 02:54:06 am
content: Hi All,I'm building a clock with a 128x64 graphics LCD (GLCD) display which has a PIC18F4550 as the brain and a DS1307 clock IC and a 74HC595 IC for the data to the LCD. The 595 is updated using hardware SPI and the DS1307 is through software I2C (because this microcontroller allows either SPI or I2C but not both simultaneously).The problem is I see a good amount of flicker with LCD backlight which seems to happen largely when the DS1307 is being read but also slightly when the display is being updated. It's currently being powered by my laptop's USB but the same effect is present when powering using a 5V phone charger.I'm guessing the reason is because there's limited power that's available and when more components demand it there will be a reduction in available power for each individual component. But I'm also hoping this is a problem that's been solved and would appreciate it if someone could share some info on this.Attaching images of the oscilloscope and the circuit.Apologies if this is very basic, I'm a hobbyist and my electronics knowledge is completely self taught. But I want to learn more so will take RTFM responses seriously if you could point me to the docs/notes/wiki/articles/blogs/vids/books

author: TriodeTiger
author_rank: Regular Contributor
timestamp: November 22, 2014, 04:39:01 am
content: Code?

author: plastygrove
author_rank: Contributor
timestamp: November 22, 2014, 04:50:11 am
content: Quote from: TriodeTiger on November 22, 2014, 04:39:01 amDo you think it could be a software issue? I'm not using anything out of the ordinary here am I?I'm happy to post the code if you could tell me which part would help. It's hundreds of lines broken up into 5 files based on function and it won't be possible to post the whole thing here.If you still think it would help, I can push the entire code on to github so you can take a look but that will take time since I will need to set up licensing, create a repo and push it online.

author: kingofkya
author_rank: Regular Contributor
timestamp: November 22, 2014, 04:56:35 am
content: maybe just a bypass cap near the lcds backlight power pin and gnd?Or an rc a lc filter?

author: plastygrove
author_rank: Contributor
timestamp: November 22, 2014, 05:56:52 am
content: Quote from: kingofkya on November 22, 2014, 04:56:35 amThanks for the suggestion! I tried putting a 0.1uF ceramic cap between the high pin and GND but it seems to have increased the effect. Tried doing it with a 1uF electrolytic cap and same effect. Maybe I need something smaller which I don't have at the moment.One thing I forgot to mention, the backlight is controlled by one of the pins of the uC with a 1K resistor to limit the current. This is so that the uC can decide when the backlight should come on. Another thing I just noticed is that the oscilloscope displays similar noise even if the backlight is turned off. Seems to suggest that the uC is adding the noise.

author: janengelbrecht
author_rank: Regular Contributor
timestamp: November 22, 2014, 06:33:53 am
content: Seems like background noise picked up by the long wires?And for me it looks like rather high frequency stuff? Maybe a small pF ceramic capacitor from uC port to ground will kill it.

author: plastygrove
author_rank: Contributor
timestamp: November 22, 2014, 06:47:36 am
content: Quote from: janengelbrecht on November 22, 2014, 06:33:53 amThanks for the suggestion! I tried a 22pF ceramic cap from uC pin to GND but no difference.But you raise a good point. Maybe high frequency changes in the wires in the reasonably long, closely placed wires. Also, maybe the breadboard doesn't play very well with high frequency signals? The uC is running at 20MHz.

author: plastygrove
author_rank: Contributor
timestamp: November 22, 2014, 07:24:20 am
content: Here are a couple of screenshots from the scope with the LED turned on and turned off. So there's definitely noise being introduced from the pin :|

author: sunnyhighway
author_rank: Frequent Contributor
timestamp: November 22, 2014, 12:24:16 pm
content: Seems more like a contrast issue than a brightness issue to me.Looks like you forgot to hook up the third leg of the trimpot to pin 18 of the LCD.

author: plastygrove
author_rank: Contributor
timestamp: November 22, 2014, 02:59:04 pm
content: Quote from: sunnyhighway on November 22, 2014, 12:24:16 pmThanks for the suggestion. But I do have the trimpot connected correctly to pin 18, it wouldn't show anything on the display if the trimpot weren't connected properly.

author: plastygrove
author_rank: Contributor
timestamp: November 24, 2014, 01:14:31 pm
content: Well, I've tried all weekend and couldn't figure it out. Watching Dave's video on noise measurement leads me to believe that that's a road best not taken (at least for this project).I tried powering it via a transistor so that the uC doesn't have to send the current but that didn't help.Right now, my guess is that it's a power limitation which is causing the flicker everytime the clock chip is read. Even if I power the LED backlight directly from VCC, it still flickers. So, I decided to just reduce the brightness by adding more resistance and now the flicker isn't noticeable anymore. It was at 1K, but I've upped it 3K. Assuming around 1.5V drop across the LED, the current draw should be ~1mA. LCD is dimmer but I can live with that.Thanks everyone for your suggestions!

author: Jeroen3
author_rank: Super Contributor
timestamp: November 24, 2014, 02:08:14 pm
content: QuoteThat clock chip should not be able to draw enough current that it is noticed on led, with your eyes. Unless your power supply is only a few milliamps.You've probably mistaken a 10k pullup for a 1k or lower pullup on the i2c lines, or something else that short circuits while using that bus. If you want to stay on that road.It is more likely that the lcd cell voltage fluctuates or that you are updating the lcd in between. (software issue?)

author: macboy
author_rank: Super Contributor
timestamp: November 24, 2014, 06:24:12 pm
content: It seems to me that your power isn't "stiff" enough, it is sagging under even a small extra load. You have a couple teeny tiny electrolytics caps on your power rails, but you need some more "bulk" capacitance there. Can you pop a 220 uF to 1000 uF cap on there? You might also want to look at the power source... it is a regulator? battery? It might need beefing up, but throwing capacitance at the problem might do enough.

author: plastygrove
author_rank: Contributor
timestamp: November 25, 2014, 11:26:23 am
content: Quote from: Jeroen3 on November 24, 2014, 02:08:14 pmThanks so much! I had 2.2K resistors for pull ups and the flickering is gone after I changed it to 10K. Such a relief! Thanks for pointing that out!Quote from: macboy on November 24, 2014, 06:24:12 pmThanks for the suggestion, yes the power source is a bit on the lower side and maybe my 1uF caps aren't cutting it. I've changed them to 200uF, but thanks to Jeroen3's suggestion, I don't see the flicker anymore. It probably still is there but as long as it's not so obvious as it was, it's perfect!