Go Down

Topic: LCD I2C backlight problem (Read 1 time) previous topic - next topic

THX_RoG

hey all im using a PCF8574AP I2C with a standard LCD 20x4 and have some problem with back light 
i try different settings in code

Code: [Select]

lcd.setBacklight(HIGH);


and

Code: [Select]

lcd.backlight();


put the problem is that after i put voltage or connect my device to arduino it initialization the back light its turning off 
i have thought that i make some error connecting a transistor but its still the same

i connect the transistor following:
1.Emitter to +5 Voltage
2.Base to I2C pin 12 with a 1k resistor
3.Collector to my LCD pin 15 with a 50 ohm resistor and a test led connected parallel with a 4,7k resistor

have no ideas how to make that work please advice



UNO,MEGA2560,MEGA2560
Killed:UNO, MEGA2560, ... More to come

drjiohnsmith

does the lcd backlight work when you connect power to the back light , via a resistor if needed ( check your lcd schematics / data sheet, you do have them dont you )

does the IO pin of the I2c PCF8574AP your connecting too toggle as you expect ? do you have a test meter or a scope ?

   

THX_RoG

if i connect the back light to resistor and +5V its working
after initialization the pin 12 OUTPUT on PCF8574AP are in LOW state
after i reset or restart arduino the backlight are on for a few seconds and they switch off and my data are pooping on my LCD
UNO,MEGA2560,MEGA2560
Killed:UNO, MEGA2560, ... More to come

drjiohnsmith

If back light come on then goes off after a bit,
   my bet would be on either

a) your re programing the I2C expander.
b) your setting the IO pin to trisate or input, and the charge is slowly rising, try putting your meter on the pin.

THX_RoG

im using a lib thats called LiquidCrystal_I2C to communicate with my LCD
i have measured the IO of the I2C  pin and the voltage its not rising its HIGH (3,45V) for a 1 second and then LOW (0,0V)
the voltage on transistor emitter is 4,95V and on collector is 0,45V and when base has 0V so i assume its correct 
UNO,MEGA2560,MEGA2560
Killed:UNO, MEGA2560, ... More to come

drjiohnsmith

is the I2C pin going up and down as you expect it too ?

if not its the code,
   if it is, its the hardware .

THX_RoG

yes the hardware its ok but now we i need to look into the code
like i first mention i try the 2 different code setup with this
Code: [Select]

lcd.setBacklight();

and
Code: [Select]

lcd.backlight();

and the problem is still or do im doing something wrong?
UNO,MEGA2560,MEGA2560
Killed:UNO, MEGA2560, ... More to come

THX_RoG

ok never mind found the solution in this thread
http://forum.arduino.cc/index.php?topic=96747.0
i just make somthing like that
Code: [Select]

lcd.setBacklight(LOW);
UNO,MEGA2560,MEGA2560
Killed:UNO, MEGA2560, ... More to come

drjiohnsmith


THX_RoG

well i go liltel bit furtherer and change the few val of LIquidCrystal_I2C.cpp
orginall:
Code: [Select]

// Turn the (optional) backlight off/on
void LiquidCrystal_I2C::noBacklight(void) {
_backlightval=LCD_NOBACKLIGHT;
expanderWrite(0);
}

void LiquidCrystal_I2C::backlight(void) {
_backlightval=LCD_BACKLIGHT;
expanderWrite(0);
}

after i change it
Code: [Select]

// Turn the (optional) backlight off/on
void LiquidCrystal_I2C::backlight(void) {
_backlightval=LCD_NOBACKLIGHT;
expanderWrite(0);
}

void LiquidCrystal_I2C::noBacklight(void) {
_backlightval=LCD_BACKLIGHT;
expanderWrite(0);
}


now when u put :
Code: [Select]

lcd.baclight();

or
Code: [Select]

lcd.setBacklight(HIGH);

u get on PCF8574A/P/AP the IO pin12 OUTPUT to high
UNO,MEGA2560,MEGA2560
Killed:UNO, MEGA2560, ... More to come

bperrybap

This library allows you to configure all the outputs on the i/o expander
including the polarity of the pin controlling the backlight.

https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home

--- bill

Go Up