Made sure about the address with i2c scanner that its 0x27.
Im using LiquidCrystal_I2C V2.0 library.
When LCD is attached to 5V only or without the basic "hello world" example i see backglight.
But when i upload the sketch the lcd backlight goes off. And still i see no text.
What could be wrong here? I2c scanner shows the address so i2c is working. '
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x20 for a 16 chars and 2 line display
void setup()
{
lcd.init(); // initialize the lcd
// Print a message to the LCD.
lcd.backlight();
lcd.print("Hello, world!");
}
void loop()
{
}
Code seems ok. " lcd.backlight();" should turn the backlight on but...
This library allows you to deal with the fact that various manufacturers use different connections between the IC and the pins going to the LCD on their individual pc boards. I believe that the constructor that will work for you is:
I'd suggest following the installation instructions.
The reason is that if you deviate, and just rename things,
now you have header file name collisions,
(multiple libraries with the same header file name)
and depending on which version of the IDE you have and what names you use
you can end up not getting the library you are wanting.
Even worse, you can end up using more than one or part of one an part
of another.
neepie:
First thing I notice with the new library is the name. I don't want to overwrite the original LiquidCrystal do I?
Yes, you absolutely do want to remove the original library.
neepie:
Can I just rename the new library? I actually did stumble on to that new LiquidCrystal but I had the same question on my head that can I rename it.
Just move it to somewhere else in your file system. If it is not working, you need to get rid of it.
Now - I like your breadboard, particularly how you have mounted the "backpack" and display, perhaps because it resembles what I might have here. I presume you have solidly soldered a pin header to the LCD which works well in this manner but would be inconvenient when you actually want to more permanently mount the backpack. As most backpacks come with a pin header mounted and most LCDs do not, the best approach is to solder a socket header to the LCD. If you then want to mount it to a breadboard, you just interpose another pin header.
I am a trifle surprised bperrybap has not directed you to his "i2cLCDguesser" sketch which is what you run to determine the "descriptor" for your particular backpack. The previous call you cited using "LiquidCrystal_I2C lcd(0x27,16,2)" is essentially obsolete as it presumes you are using a particular backpack which is now relatively uncommon. The proper call incorporates all the pin assignations and the "i2cLCDguesser" gives you the exact ones to insert.
You are of course correct against the unhelpful hecklers insofar as if the "i2cscanner" or the more sophisticated "guesser" tells you the address is 0x27, then that obviously is what it is.
Paul__B:
I am a trifle surprised bperrybap has not directed you to his "i2cLCDguesser" sketch which is what you run to determine the "descriptor" for your particular backpack.
I'm actually trying to stay low for a bit
as I'm working a new LCD library that should make all these types of issues go away.
I really feel for the less technical users trying to get their i2c LCDs up
and working and I'll have solution that makes it really easy,
but it isn't quite there yet.
I'm still working on it.
Yes, you absolutely do want to remove the original library.
Please tell me why? If i do remove it, does my existing sketches with parallel lcd work?
I presume you have solidly soldered a pin header to the LCD which works well in this manner but would be inconvenient when you actually want to more permanently mount the backpack.
Actually i got 3 16x2 lcd:s which i've already soldered a header. And yes, the i2c backpack did have a nice row of headers soldered already. So i went out and test the lcd on a breadboard.
Later i will of course solder the backpack to the lcd.
This brings me a question.
I always used these parallel 16x2 lcd:s with 4-bit mode. So i can save few pins on arduino. Does this i2c backpack require all 16 pins attached on the lcd-backpack or can i use 4-bit mode lcd with the backpack?
That seems like the i2c is only using 4bit mode? Which is fine for me. Or am i wrong and i need all the 16 pins (yes, the backlight too) to run the i2c backpack correclty?
Thanks alot guys for giving me more information. Just cant wait to get home!
I will be forgetting about 4bit lcd:s and parallel mode. When i get this i2c backpack working ill be ordering more to save pins/wiring!
Just need to get this working first
Im off from home until end of the week. I wil be then testing more and trying that new liquidcrystal library!
If i do remove it, does my existing sketches with parallel lcd work?
Yes. FMs library will run your existing sketches.
Does this i2c backpack require all 16 pins attached on the lcd-backpack or can i use 4-bit mode lcd with the backpack?
You don't have to connect the four adapter pins that go to the lower four LCD data pins but all you will save by not attaching them is a tiny bit of solder.
You must use the 4-bit mode because the I2C adapter does not drive the lower four LCD data pins. The library takes care of this for you when you invoke the proper constructor.
Righto, will change to it then. Care to shortly tell me whats new on it? Other than it runs the i2c lcd:s?
Thats good that it only supports 4bit. I do have some lcds which have the 16 pin headers. But when i learned that i dont need them all i only soldered the necessary ones to make it a bit simpler.
If i only use this: LiquidCrystal_I2C lcd(0x38); // Set the LCD I2C address
I get a blinky LCD.
That seems very unlikely since you are saying both are talking to the LCD
but they are using two different i2c addresses.
(Details matter when trying to get something up and working)
Ignoring the i2c address issue,
When you use the constructor that only specifies the address, it says:
my address is 0x38 and I want to you pick all the other values for me.
I don't recommend ever using defaults.
If you don't specify everything,
it is kind of like the constructor saying:
"What pins would like to use, and you say, 'It doesn't matter, any pins'".
Which so reminds me of the Hornitos commercial:
When not specified, the pin values used are for fm's LCD extra i/o board which you do not have.
That is why the i2cLCDguesser sketch gives you the full constructor.
So you know what you are getting.
That seems very unlikely since you are saying both are talking to the LCD
but they are using two different i2c addresses.
Actually i did have the right address while testing it. But i removed it and copied here from another sketch.
That is why the i2cLCDguesser sketch gives you the full constructor.
I tried that guesser but when it says in serial monitor to "hit enter or click send", it does nothing.
About backlight, seems like the lcd.noBacklight and lcd.backlight is working. But if i want to dim it i need to use a PWM pin instead of the jumper there.
That is why the i2cLCDguesser sketch gives you the full constructor.
I tried that guesser but when it says in serial monitor to "hit enter or click send", it does nothing.
Did you folllow step #6 of the instructions?
If so, I really want to know more in case there is an issue.
The few times this has come up before and I ask for more information to be able
to repeat it, the person with the issue either didn't follow #6 or they disappear.
So have yet to actually personally see a real case of the guesser not responding to or [send].
About backlight, seems like the lcd.noBacklight and lcd.backlight is working. But if i want to dim it i need to use a PWM pin instead of the jumper there.
It may a bit more complicated, depending on the h/w design of the backpack.
The jumper typically isn't connecting the base of the transistor to a PCF8474 pin.
If not, you will have modify the board so that the base of the transistor connects
to your Arduino pwm rather than a pin on the PCF8574.
Then you will have to make modifications to the LiquidCrystal_I2c code in order
to get setBacklight() to work or modify your sketch code
use analogWrite() as the existing LiquidCrystal_I2c code only has support for driving
PCF8574 pins.