LCD I2C backlight problem

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

lcd.setBacklight(HIGH);

and

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

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 ?

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

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.

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

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

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

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

lcd.setBacklight();

and

lcd.backlight();

and the problem is still or do im doing something wrong?

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

lcd.setBacklight(LOW);

well done

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

// 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

// 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 :

lcd.baclight();

or

lcd.setBacklight(HIGH);

u get on PCF8574A/P/AP the IO pin12 OUTPUT to high

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