16x2 serial LCD backlight flickering

Hi -.^

I'm asking myself if there's a solution to eliminate backlight flickering when adjusting the brightness under full power on a SparkFun serial LCD (16x2)?
This flickering is not very strong, but in some conditions (neon lights for ex.) it's a clearly visible.

If I'm not wrong it's cause the backlight LED is drive by PWM.
So, is someone had trying to place a capacitor somewhere to "smooth" the PWM?

Or the best way is to use another power source, without PWM?

Is there a need to adjust the back light brightness? Personally i use a pot not a PWM pin to adjust the brightness of the display but leave the back light on a switch. I think a pot would be a better option for adjusting the back light.

I find the backlight very powerfull (very well to use by daylight), but in most of case what I'm making will be use by night (power supply for astro-photo applications) so it's a real need (we try to hide a maximum of lighting).
During tests I set the backlight at a very low value (130, BYTE), in regard of possible parameters; it's quite fine, but not too much ^.^

Else, I asked to find a way with the PWM (capacitor?) cause I wouldlike to keep control of brightness by software; it's a good meaning to send visual alerts, by night :o

Anyway, I'll see for a hack of the LCD PCB, and if it's too hazardous (schematic is cheap for the serLCD-v2.. ^.^) I'll do as you say with another circuit to set the backlight. -.^

You can't use a capacitor to smooth PWM for an LED as you need the voltage pulses to turn on the LED. If you put a capacitor on you will not have enough voltage to turn on the LED when you want it dim.

The way to stop it flickering is to incr4ase the PWM frequency. Lots of info on that just do a search.

Exact Grumpy_Mike, as the voltage is always the same with PWM, if I filtering it, it'll be impossible to change dimming of the LED... -.-

I thought to change the PWM frequency, but as it drive by the PIC on my serial LCD, it may be not easy. I'll see that -.^

as the voltage is always the same with PWM, if I filtering it, it'll be impossible to change dimming of the LED

NO, see how PWM works:-
http://www.thebox.myzen.co.uk/Tutorial/PWM.html

but as it drive by the PIC on my serial LCD,

No the PWM frequency is controlled by the arduino, you just need to alter some values stored in registers.

NO, see how PWM works:-
PWM

Hum, yes, I had to say "voltage is always the same at high level", I spoke about filtering the signal, in our case.
Of course, in PWM, voltage is low or high; not always the same ^.^

No the PWM frequency is controlled by the arduino, you just need to alter some values stored in registers.

:-?
I did not understood that in the serLCD docs..
Could you tell me the process to alter those values?

I did say google it. Never mind I did it for you:-
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1152547089

I did say google it. Never mind I did it for you:-
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1152547089

Thank you to help me, but... I'm not sure to understand what you want to tel me. :-/

In the datasheet of the LCD board I see how changing the duty cycle of the PWM to adjust backlight by sending a cmd to the PIC to change the PWM frequency (0x7C + 128<157). So I think the backlight PWM is driving by the PIC, not by the Arduino (?). :-?
I imagine I have to send a cmd to the PIC to change the PWM frequency like in your example, but I don't see how.

Sorry for all my questions but I like to know what I do and not just copy some code parts ^.^

So can you post a link to the data sheet of the device you are using?

It's a SparkFun serial LCD 16x2:

with a common HD44780 character LCD:

driven by a PIC16F688 (@10MHz) CMOS µcontroller on board:

It looks that backlight is driven through the pin #11 of the PIC, with an 1A NPN. But I'v no ideas about how force/change the PWM frequency generated by this PIC. :-/

Woho... I just understand something..
In:

We can see:
"By sending the special command character 0x7C followed by a number 128-157, the backlight PWM value will be set."

But in fact, we don't know if it's frequency or duty cycle that will be changed...
In regard of results (flickering) at half values it's possible that the command is on frequency and not on duty cycle (?). I don't have scope to see the signal shape.

Well, it does not solve the problem... :-/

Ok having looked at the data sheet it looks like you are stuck with the flicker problem unless you want to hack the LCD and control the back light with the arduino's PWM.

Yes, it's why I ask in my first post if the most simply solution will be by using an auxiliary way to control the backlight. A way where I could have fine tune possibilities.

I will see.. Cause I will have to make a complete power system, use a I/O output on the Arduino, etc. It's a bit a pity to get a component like this pretty serLCD but to have to hack it at end.

However, thank you for your help Grumpy_Mike -.^

It's only a matter of connecting the base of that transistor to the arduino. You should be able to lift off the resistor from the base to the PIC and solder a wire on. Then put it through a resistor before you connect it to an arduino PWM.

Wooh yes, well seen -.^
I could cut the link between the pin #11 of the PIC and the NPN, and link it directly to an I/O port in the Arduino; there's a resistor (R9) on board between the PIC and the NPN. I'll see that, it's a micro-surgery operation ^.^