HD44780 LCD Backlight control with PWM

Hi,
I just hooked pin 15 of my JHD 162A ([u]Chinese datasheet[/u]) to a PWM output on the Arduino (pin 3) to be able to set and change the brightness of the backlight.

It works well, even if the maximum light level obtained when analogWrite(3,255) is less than when it was hooked directly to +5 (which doesn't matter to me).

The question is, won't it damage the Arduino or the LCD in the long run ? Is there a safest way to do the connection (I'm no EE, so don't be shy to include details in your answer) ? Shouldn't I at least put a resistor between the two (which value) ?

Ah, I think you should stop immediately and add a resistor (maybe 150 Ohm) between Arduino pin and back light. Running without a resistor will eventually damage either the arduino pin or the back light, whichever is weaker.

The diagram is showing a resistor between LED+ and VCC.

Here's a link for similar info.

Cheers,
Kari

I have two observations.

(1) The 14-pin HD44780 LCD interface and the 2-pin Backlight are two completely (electrically) unrelated systems. The HD44780 was around at for least a decade before LED backlights became popular. There were some devices with electroluminescent backlights that required something in the neighborhood of 100 v to operate, but they were not common either.

Even with the incorrect title most people understand what you mean, I just don't think the misconception about a '16-pin interface' as used in some of the Arduino documentation should be encouraged.

(2) There are no standards concerning the LED backlights. They have varying numbers of LEDs in varying series and/or parallel combinations. Some implementations require an external series resistor and others do not since they have the required resistance already on the board.

A series resistance will never hurt anything and it is a essential to use one if you are not sure about your backlight configuration. Since there are frequently several parallel strings of LEDs you may need a much smaller value than 150 ohms.

Don

You need a transistor due to the amount of current the backlight requires and a maximum of 40mA should be drawn from any one arduino pin.

Backlights are normally 5V on displays where the data is 5V.

Backlights are normally 5V on displays where the data is 5V.

Except when they require 4.2 volts - as his does.

Don

I don't like this particular back light for Arduino projects. To regulate its brightness finely, you need very small resistors and there's not a lot of choices among standard resistance values within that range.

Yeah, 150 Ohm is overkill, but it may be enough to help the user see the text in complete darkness, which is much less bright than what most people want, having back light visible and glowing in well-lit rooms.

Except when they require 4.2 volts - as his does.

I knew I shouldn't have posted... I did take a look but it's not been a good day :frowning:

Thank you so much for all your answers. I did not fry the arduino or any LCD I tried (3 differents), but I feel lucky after reading the thread :slight_smile:
I'll try a 150 ohm resistor and decrease the value a bit if it's really unreadable at full PWM.

Again, thank you everybody.

I'm back, trying to get more power to the dimmest LCDs.
The 150 ohm resistor in serial with the pwm works nicely, but I would want to try to use a MOSFET to get more juice to the LCD backlight.

I have a 2N7000 available and wished to use it.
Could you just tell me if this is the right way to do it ?

As I already said, I'm a beginner in electronics and I'm afraid to make some stupid choice which would fry the arduino or the lcd (or both !).

The orientation of the mosfet is making it hard read, but isn't that connection wrong.

Don't make any changes because I say this, until someone else confirms.

But, I think S should be connected to GND, LED+ to Vcc and LED- to D.

Turn that mosfet in your picture, 90 degree left, and draw lines again, with angles.

Cheers,
Kari

Normally you would control the LED- line

Take a look at this page for some info on connection:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1266731629

There you go! Now you can change the circuit.
Kari

Exactly what I needed, Thank you !
Side note : It seems "Justin Berken" use the wrong symbol on his diagram (p-channel instead of n-channel), but judging from the datasheet of his MOSFET, it's a n-channel as my 2N7000.

My diagram would then look like this :

Zoom

Does this feel right ?

What is the R1 for?

Kari

a pulldown resistor so that the mosfet doesn't get high when it shouldn't. Is it wrong ? Should I remove it completely ? I had doubts about it.

Well, examine it a little, and tell me what it does in your circuit.

Kari

I have to admit I'm not really up on FETs but I think that link I posted is confusing :stuck_out_tongue:

In your case you don't want the 10Kohm resistor - it was only there on the linked one due to how it was wired with the external supply.

So LED- to D, S to Ground and G to D3

I'd personally put the 150ohm resistor between S and Ground but that's just personal preference

Kari : looks like the 10k sucked all the juice from the lcd in my previous schematic.

mowcius : It seems right now, thank you.

Here is the final (more simple) design :

Zoom