Go Down

Topic: HD44780 LCD Backlight control with PWM (Read 12 times) previous topic - next topic

pixelk

Hi,
I just hooked pin 15 of my JHD 162A (Chinese datasheet) 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) ?

liudr

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.

GaryP

Here's a link for similar info.
http://arduino.cc/forum/index.php?topic=53634.0

Cheers,
Kari
The only law for me; Ohms Law: U=R*I       P=U*I
Note to self: "Damn! Why don't you just fix it!!!"

floresta

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

mowcius

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.

floresta

#5
Mar 14, 2011, 03:42 pm Last Edit: Mar 14, 2011, 03:44 pm by floresta Reason: 1
Quote
Backlights are normally 5V on displays where the data is 5V.
Except when they require 4.2 volts - as his does.

Don

liudr

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.

mowcius

Quote
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 :(

pixelk

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 :)
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.

pixelk

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 !).

GaryP

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
The only law for me; Ohms Law: U=R*I       P=U*I
Note to self: "Damn! Why don't you just fix it!!!"

mowcius

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

GaryP

There you go! Now you can change the circuit.
Kari
The only law for me; Ohms Law: U=R*I       P=U*I
Note to self: "Damn! Why don't you just fix it!!!"

pixelk

#13
Mar 20, 2011, 08:44 am Last Edit: Mar 20, 2011, 08:49 am by pixelk Reason: 1
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.

pixelk

My diagram would then look like this :



Zoom



Does this feel right ?

Go Up