Go Down

Topic: Trying to dim an LCD Backlight (Read 4 times) previous topic - next topic

MikeMoLang

I bought the following:
   > I2C backpack (YwRobot LCM1602 IIC v1)
   > LARGE 20x4 LCD (JHD762M5) (http://tinyurl.com/ar99rj2)

It didn't work out of the box, but a little searching led me to this, which works fine:
   >[SOLVED] SainSmart/YwRobot I2C LCD works well
   > http://arduino.cc/forum/index.php?topic=106655.0

The problem is that I really want to be able to turn down the backlight brightness and I do not seem to be able to do anything more than turn the backlight on and off using "lcd.setBacklight()".  Is this a limitation of the I2C, or the LCD (either?  neither?)

I do not need to control the brightness via software (I just figured that this would be the simplest solution), and I would prefer not to set up PWM control.  I would be happy to just put a pot on it and be done, but when I researched that solution I read that it is not the preferred method, and to use a transistor...  I got a bit confused at that point.  Can someone please point me in the right direction regarding how to proceed?  Is the solution as simple as putting a pot inline at pin 15 or pin 16.

This is a very large display.  I measured about 90mA current draw with the screen lit up, so if I do go the PWM route I think that I will need to use a transistor.  Right?

Thanks!
MML

MAS3

It's a LED (array), so the way to go is to regulate current, not voltage.
It really isn't difficult to wire up a pot to your Arduino and have your Arduino control a transistor through PWM, which on its turn controls the backlight.
You should indeed use that transistor and not wire the backlight directly to an Arduino output as it draws almost five times the current specified for the Arduino per output pin.
Only reason not to do it this way i can think of, is when you have no spare input and/or output available.
Have a look at "blink without delay".
Did you connect the grounds ?
Je kunt hier ook in het Nederlands terecht: http://arduino.cc/forum/index.php/board,77.0.html

MikeMoLang

Thanks.  Because I do not intend to change the LCD backlight after i set it the first time I was hoping to solder in a resistor and be done.  I do understand that adding a pot and transistor to the Arduino and them implementing PWM is not terribly difficult, but still it is several more things for me to work through.

I have another question.  Both of these claim to be able to dim an LCD backlight via I2C:

  • http://www.web4robot.com/files/SerialLCDCtrl.pdf
    http://www.hobbytronics.co.uk/datasheets/ht/ht_lcd_i2c_backpack_datasheet_v01.pdf




Can you tell me if that is a function of the backpack, or a function of the LCD? One of these is selling an LCD and backpack together, but the other is selling just the backpack, so it seems to be a function of the backpack, but I want to be sure.

I have an Adafruit backpack that I have not yet tested and I wonder if that can do LCD dimming.

Thanks!
Mike



MAS3

It is a function of the backpack for both.
You can see that yourself by reading the documents you are linking to.
These show you how to connect, and you can see that these are simply connected to pins 15 and 16 of a standard LCD .
These pins are the backlight power pins.
The "Hobby Electronics" pcb is shown clearly and shows it uses a Microchip PIC 18F(something) that does the receiving of your commands and controlling the LCD.
Following the traces, you can also see that pin 16 (Cathode of the backlight LED) is controlled (by the PIC processor) through transistor U2.
Have a look at "blink without delay".
Did you connect the grounds ?
Je kunt hier ook in het Nederlands terecht: http://arduino.cc/forum/index.php/board,77.0.html

harilaos

I made a simple dimmer for LCM1602 IIC. I connect it at the jumber and works good

Paul__B


I would be happy to just put a pot on it and be done, but when I researched that solution I read that it is not the preferred method, and to use a transistor.

I got a bit confused at that point.  Can someone please point me in the right direction regarding how to proceed?  Is the solution as simple as putting a pot inline at pin 15 or pin 16.


It is indeed as simple as putting a resistor in series with pin 15 or pin 16.  You merely have to interrupt that connection between the backpack and the LCD module.  The only reason to use a transistor to control it (as there already is in the backpack) is as noted, to provide software control.  In fact, you can use PWM in software to continuously and rapidly switch the backlight on and off, but this is not always practical.

If you only want to set and not change the brightness, you just add the resistor.  The "setbacklight" function will still turn it on or off.

Alternately, if you want it to be either dim or bright, but never off, you can simply add a resistor between pins 1 and 16 which will set the minimum or "off" brightness.

Just try different resistor values, starting with around 1K.

bperrybap


The problem is that I really want to be able to turn down the backlight brightness and I do not seem to be able to do anything more than turn the backlight on and off using "lcd.setBacklight()".  Is this a limitation of the I2C, or the LCD (either?  neither?)

Neither. It is a limitation of the h/w on the backpack.
The backpack contains a PCF8574 i2c i/o expander. This allows a host (the Arduino)
to use the i2c bus to control pins on the PCF8574.
One of the PCF8574 i/o pins is hooked up to a transistor that turns the power going to the backlight on or off.

setBacklight(dimvalue) where dimvalue is 0-255 is use to set the brightness
while backlight() and noBacklight() are used to turn the backlight full on/off.

For the h/w on that i2c backpack setBacklight(dimvalue) really doesn't work as setBacklight(dimvalue) is
use to set a brightness and that h/w is not capable of controlling the brightness.
That hardware can only turn the backlight on/off so the library attempts to offer setBacklight() s/w compatibility by
doing the best it can so a dimvalue of zero will turn off the backlight and any other dimvalue
will turn on the backlight since the h/w is unable to actually do any dimming.

--- bill


RTdeG

Hello,

I'm using a NPN transistor for dimming my LCD. I have a PCF8574 I2C interface mounted at the back of a HD44780 LCD. There's a jumper on the back of the two LED pins, remove this jumper. I've connected one LED pin to the the collector pin of the transistor and the other LED pin to the emitter. In my case it doesn't matter which LED pin is connected to a transistor pin, it all works. The transistor's base pin is connected to a Arduino PWM pin. now try using the analogWrite(pinNumber, value) method, for example analogWrite(3, 100), and turn the LCD backlight on, now the backlight will be dimmed! XD

Note: I'm using the LiquidCrystal_I2C library.

Go Up