Pages: [1]   Go Down
Author Topic: LCD I2C backlight problem  (Read 1068 times)
0 Members and 1 Guest are viewing this topic.
Germany
Offline Offline
Jr. Member
**
Karma: 1
Posts: 80
Arduino in VS MODE
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
lcd.setBacklight(HIGH);

and

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



Logged

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

Offline Offline
Sr. Member
****
Karma: 4
Posts: 327
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 ?

   
Logged

Germany
Offline Offline
Jr. Member
**
Karma: 1
Posts: 80
Arduino in VS MODE
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

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

Offline Offline
Sr. Member
****
Karma: 4
Posts: 327
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Germany
Offline Offline
Jr. Member
**
Karma: 1
Posts: 80
Arduino in VS MODE
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 
Logged

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

Offline Offline
Sr. Member
****
Karma: 4
Posts: 327
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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

Germany
Offline Offline
Jr. Member
**
Karma: 1
Posts: 80
Arduino in VS MODE
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
lcd.setBacklight();
and
Code:
lcd.backlight();
and the problem is still or do im doing something wrong?
Logged

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

Germany
Offline Offline
Jr. Member
**
Karma: 1
Posts: 80
Arduino in VS MODE
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
lcd.setBacklight(LOW);
Logged

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

Offline Offline
Sr. Member
****
Karma: 4
Posts: 327
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

well done
Logged

Germany
Offline Offline
Jr. Member
**
Karma: 1
Posts: 80
Arduino in VS MODE
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

well i go liltel bit furtherer and change the few val of LIquidCrystal_I2C.cpp
orginall:
Code:
// 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:
// 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:
lcd.baclight();
or
Code:
lcd.setBacklight(HIGH);
u get on PCF8574A/P/AP the IO pin12 OUTPUT to high
Logged

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

Dallas, TX USA
Offline Offline
Faraday Member
**
Karma: 70
Posts: 2741
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Pages: [1]   Go Up
Jump to: