IIC/I2C/TWI 2004 20X4 Character LCD Module Display

Make sure you have selected the proper board under the Tools menu. I'm having good success with the library called "LiquidCrystal_I2C" on displays 16x2 and 20x4.

After you compile the sketch, you can use the "I2C" library example sketch "i2crepl" to scan the port and find the I2C address of your LCD.

wizhacker:
I use LiquidCrystal_I2C and wire library with the examples, and I have found 4 examples but none will
compile, with one I got real close with only one error "does not name a type"

You appear to have the same display and library as me. I use the line

LiquidCrystal_I2C lcd(0x27,20,4);

error "does not name a type" can, and may always, mean it cannot find the library. It is likely that you simply have it in the wrong place. There is instruction in the getting started about this. If you put it with the other libraries under the IDE, it should work. You may find that fartarsing around with a swag of IDEs was more likely to exacerbate the problem than solve it.

I'm having a similar issue, same board (Arduino UNO) and same lcd 20x4. I even got the sketch to compile and upload but I still end up with two black bars.. any suggestions??

My 20x4 is working fine with version 1.1 of the LiquidCrystal_I2C library. Won't work with a later 2.0 version. Don't know why.

Anizuka:
I'm having a similar issue, same board (Arduino UNO) and same lcd 20x4. I even got the sketch to compile and upload but I still end up with two black bars.. any suggestions??

I guess, if a library is dodgey, it won't stop the programme compiling and uploading.
I have two libraries, each in its own subdirectory, for 2x16 and 20x4. I guess the line

LiquidCrystal_I2C lcd(0x27,20,4);

determines which is used.

I see that the first line in the library is

//YWROBOT

which is the same as the crowd that makes the I2C adapter on the back of the LCD.
The display works perfectly on Uno and Mega.

the other library's will compile just fine and upload to the Arduino uno, but the LiquidCrystal_I2C lcd(0x27,20,4); will not compile I'm using 1.03 on windows 8 as 1.52 has problems compile the libraries that 1.03 will compile, my next attempt will be to use a clean XP with 1.03 and only LiquidCrystal_I2C lcd(0x27,20,4);

wizhacker:
to use a clean XP with 1.03 and only LiquidCrystal_I2C lcd(0x27,20,4);

OK, good luck. I find it hard to believe that would be the problem. If it was, it would be common knowledge but I am using 1.0.1 on XP. Have you checked the library has

//YWROBOT

in the first line?

Have you try the New LCD library?
http://playground.arduino.cc//Code/LCD

New LCD library - Replacement for the original LiquidCrystal Library to control LCDs with different control interfaces: 4bit, 8bit, I2C, ShiftRegister, SPI comming soon. The library is faster than the original, more flexible and extendable.

I've tried a zillion libraries until I found this one that worked well with my LCD:
http://arduino-info.wikispaces.com/LCD-Blue-I2C

hope it helps...

M

Normally I tend to be a bit skeptical about web pages that use large multicolor fonts but the one in your link appears to be generated by Terry King, a long time contributor to this forum, so you should be able to trust the information you find there.

You should be aware that all of the 20x4 displays are essentially the same and any differences that you experience are more likely due to differences in the small interface pc board that is attached between your Arduino and the display. It is also not inconceivable that there may be some mix and match involved. That is a specific display may have a different interface pc board used with it at a later date.

The interface pc boards are all essentially the same as well. There are two almost identical ICs that can be used. The version with a 'A' suffix has a base address of 0x38 and the version without the 'A' (there may be other letters on each version) has a base address of 0x20. The board may or may not have jumpers available to change the address. The jumpers, if they exist, are typically solder blobs labeled A0, A1, and A2. If you are lucky there may be removable jumpers instead of the solder blobs. If you are even luckier there may be switches. I haven't seen either of these on the photographs posted lately.

Don

floresta:
The interface pc boards are all essentially the same as well. There are two almost identical ICs that can be used. The version with a 'A' suffix has a base address of 0x38 and the version without the 'A' (there may be other letters on each version) has a base address of 0x20. The board may or may not have jumpers available to change the address. The jumpers, if they exist, are typically solder blobs labeled A0, A1, and A2. If you are lucky there may be removable jumpers instead of the solder blobs. If you are even luckier there may be switches. I haven't seen either of these on the photographs posted lately.[/color]

Don

Just to add to this.
From what I've seen on ebay and other vendors selling i2c to lcd boards,
the vast majority are "essentially the same" since they use the same i2c chip (pcf8574).
However, not all boards use the PCF8574 chip. Some like the adafruit i2c to lcd board use a MCP23008 chip.
For those not aware, the pcf8574 and MCP23008 are two different i2c i/o expanders.
While they are both i2c 8 bit i/o expanders, they do not work the same and require slightly
different code to drive them.

But for the boards that do use the pcf8574,
the biggest difference between them, and the reason for most of the issues people are having,
is how that i2c chip is wired up to the hd44780 interface (lcd module).
While the hd44780 pinout and interface is standardized, how you hook up a pcf8574 chip
to an hd44780 interface is not.
Different i2c to lcd boards wire up the 8 output pins to the lcd module differently.
There is no way for the s/w to determine how the pcf8574 chip is wired up to the lcd module.
Because of this, the s/w has must "know" how the i2c chip is wired to the LCD.
Most libraries are hard coded for a particular wiring, some like fm's library allow the sketch
to configure the wiring.
If the library is hard coded and the library's assumptions on the wiring do not match the actual wiring,
the library will think everything is working ok, but the LCD will not work
correctly and usually just sit there with a row of boxes on the top line.

Compounding this, is that vendors are taking the same "LiquidCrystal_I2C" library code
and modifying it to match their particular i2c to lcd board and providing links to
their modified libraries.
So that means that are several different versions of the "LiquidCrystal_I2C" libraries
floating around. Unless you look closed at the library code, you cannot tell which version
of the library you have.

Even worse, some vendors provide links to versions of the libraries that do not
match the hardware they are selling.

What all this means is that when using the "LiquidCrystal_I2C" library, it isn't
guraranteed that the library will necessarily match the i2c to lcd board that you have.
And if the library is not matched to the board you have, it won't work.

fm's library, mentioned above, is different. It can be configured. This means that the sketch
must tell the library how the pcf8574 chip is wired to the hd44780 interface.
The user's sketch must fill in the library's constructor to tell the library how
the pcf8574 is wired up to the hd44780 interface.

While the libraries that used hard coded pcf8574 to hd44780 pin mappings
are slightly easier to use, in that the user does not have to fill in the mappings,
the user must ensure that he has the correct version of the library since there
is more than one version of the library because not all boards use the same pin
mappings.

--- bill

OK, so it looks like luck is a bit of a player here.

My 20x4 looks exactly the same as that alluded to above. Attached is the library I use with IDE 1.0.1 under XP.
I can't recall where I got it, probably a link on eBay.

LiquidCrystal_I2C2004V1.zip (19.2 KB)

Nick_Pyner:
OK, so it looks like luck is a bit of a player here.

My 20x4 looks exactly the same as that alluded to above. Attached is the library I use with IDE 1.0.1 under XP.
I can't recall where I got it, probably a link on eBay.

No. It's not luck.
It is a matter of making sure that the s/w matches the hardware.
The library you linked to used the following hardcoded mappings:

PCF8574 BIT     HD44780 Function
0               RS
1               RW
2               EN
3               backlight (POSITIVE)
4               D4
5               D5
6               D6
7               D7

My preference is to use fm's library which can be configured for any
mapping/wiring vs being hard coded.

Getting the pin mappings correct is pretty important since
most of these i2c to hd44780 boards are hooking up the RW line to the PCF8574.
IMHO, this is a very dumb thing to do since it isn't really used
and can potentially damage the LCD module or i2c chip.
The hd44780 RW line should be connected directly to ground instead.

By connecting it to a PCF8574 output pin
damage can potentially occur if the s/w and the hardware do not match.
For example, it is possible that the pcf8574 output pins could be configured
in such a way that the LCD is in read mode and driving the data bus at
the same time the PCF8574 is driving the bus. You now have shorts
on the d4 to d7 lines and is is possible that one of the components could
be damaged.

Getting it correct is not luck, and trial really shouldn't be used either.
It is best to understand how the hardware is wired up and then make the s/w match the hardware.

--- bill

bperrybap, I appeal to you as you seem to know what you are talking about. I am a newbie with ardurino and have this display (several of them I bought on Ebay). I have tried NUMEROUS libraries and sample 'hello world' sample code - to no avail. They either compile, load, and do not do anything to the display, or they compile with errors.

I understand what you were saying, but I still don't know where to get a good library that works, and make this damn display show something. I am an EE - 37 years experience -- been programming in C since 1979, so I can follow some of the technical jargon, but I am on the sharp edge of the learning curve at this point (day 2).

I have: ardurino uno R3. Using pin 4 for data, pin 5 for clock ( and if I ever get this to work, i would like someone to explain how i can get the dedicated SDA and SDC pins next to AREF on the board to work, but later)

The Display is a 20x4 using the PCF8574T chip. the address lines are 3 solder links (all unlinked) labled a0,a1,a2 which I interpret as address 0x27.

I feel that if I could get a library that works with this along with a hello world sample program - i can stop swearing and disturbing my co-workers. after that miracle, i would like to figure out how to master the control to make it cursor addressable, custom char sets, etc. BUT NOW, I cannot get it to say "hello world'

I Would GREATLY appreciate any hand holding you can give me to get there.

thanks

RTFM - I solved my problem. Of course, it was a stupid issue, stupidity on my part.
I read another post where someone , THANKFULLY, posted "The I2C interface is not just pin 4 and 5, but whichever pins are denoted for that board - as SDA and SCL. For a UNO, (Pro) Mini or a Nano it is A4 and A5, not digital 4 and 5"

I was, of courese, using digital pins 4, and 5. Moved over to A4 and A5 and would you believe? it works.

thanks for your fine comments I found everywhere on this board - you are very helpful.

rick

ALTHOUGH, now that I have that running - a question for the GURU.

using UNO R3 A4 and A5 works fine for I2C -- BUT - the R3 board has a SDA and SCL pin next to the AREF pin.

How do you use those as opposed to A4 and A5? how do you define pins other than A4 or A5 -- say i want to use A6 and A7?????

TIA

nucloid:
ALTHOUGH, now that I have that running - a question for the GURU.

using UNO R3 A4 and A5 works fine for I2C -- BUT - the R3 board has a SDA and SCL pin next to the AREF pin.

How do you use those as opposed to A4 and A5? how do you define pins other than A4 or A5 -- say i want to use A6 and A7?????

TIA

Have a look at the schematic:

The SDA and SCL labeled pins are same exact physical pins as A4 and A5.
i.e.
SDA and A4 both connect to physical pin 27
SCL and A5 both connect to physical pin 28

The Arduino team added those two header pins so that all future boards
would have the SCL and SDA pins in the same location.
This allows a shield that needs to use i2c work on both R3 and Leonardo
without having to use jumpers.

--- bill

Hi
Can someone give me the way to display a text line by line on my I2C LCD 2004 ?

I mean at the moment I can display a number of characters but it begin to display the first line, then go to the 3rd then the second ...then the fourth line !

How to manage this ?

Thanks

DR49

You have a totally unrelated problem which should be addressed in a new thread. Use the [New Topic] button.

Did you not see this message?

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Don