5V IIC/I2C/TWI LCD Module Adapter For Arduino from eBay

I tried to interface cheap eBay I2C display module. I have tried with many libraries, finally succeed using the attachment in this topic. But the Hello world example prints only the character "H". I have not changed anything except the address. Any help would be grateful. Thank and regards

What arduino are you using, and with what version of the IDE?

Are you using the F Malpartida library?

I'm not exactly sure which library you are using or which IDE, but I'm guessing that you are using a new IDE like 1.6.6 or newer. This version of the IDE looks at the return value of the write() function. There are i2c lcd libraries out there that screwed up their code in their write() function. In the older IDE's it didn't matter, but this is not the case on the very recent IDE. The write() function is supposed to return the number of characters processed. If it is less than what was requested, it is an error and further output is thrown away. In those libraries that are screwed up, the write() function is being called with a single character, and the write() function is returning 0, which is an error telling the upper layers not to send any more characters. It should be responding with a 1 indicating that 1 character has been successfully processed.

The proper solution is to go fix the broken code down in the .cpp file of the library. It may look something like this:

inline size_t LiquidCrystal_I2C::write(uint8_t value) {
 send(value, Rs);
 return 0;
}

Or it may be different depending on which library you have. The important thing to note is that the write function needs to return 1 and not 0

Alternatively, you could drop back to an older IDE where the broken/incorrect library will work because the other Print class code doesn't check for the error status.

--- bill

1 Like

cattledog: What arduino are you using, and with what version of the IDE?

Are you using the F Malpartida library?

Sorry, I forgotten to mention. IDE is 1.6.6.

I tried fmalpartida library "NewLiquidCrystal 1.3.4" . No success. In fact fmalpartida referred the below post for pointing out pin change .

The library I am using is : Attachment available from the post Here

I am using Arduino UNO board

The i2c board is this one.

bperrybap: I'm not exactly sure which library you are using or which IDE, but I'm guessing that you are using a new IDE like 1.6.6 or newer. This version of the IDE looks at the return value of the write() function. There are i2c lcd libraries out there that screwed up their code in their write() function. In the older IDE's it didn't matter, but this is not the case on the very recent IDE.

Bill, Excellent! You are right. It works in IDE 1.0.

As per your suggestion, I changed the return value to 1. Now the same library works fine in the new IDE.

I belive fmalpartida library "NewLiquidCrystal 1.3.4" supposed to be updated and should work. but did not work. I have posted details of i2c board just before replying to your post. Could you suggest something to use the library? For me it seems little complex piece of work.

Thank you.

I belive fmalpartida library “NewLiquidCrystal 1.3.4” supposed to be updated and should work. but did not work. I have posted details of i2c board just before replying to your post. Could you suggest something to use the library?
For me it seems little complex piece of work.

I don’t think that using a modified(inverted) version of the Mario_H library is not a good solution for the long term. What if you need to replace the i2c adaptor? Using the F Malpartida library in conjunction with Bill Perry’s i2cLCDguesser sketch to determine the constructor is robust and flexible.

I don’t know why you had trouble with the F Malpartida library, but I would encourage you to work through your issues and get on solid ground with transparent access to the proper “constructor” for all the adaptors which have shown up so far.

Had the same problem, those those searching I had a funduino LCM1602. First problem solved, now to try and amend the fact it doesn't scroll!

they have made the change but it still doesn't work for me i am using the last IDE and the last version of Liquid_Crystal_I2C

bullecoureur: they have made the change but it still doesn't work for me i am using the last IDE and the last version of Liquid_Crystal_I2C

I have never heard of a library called: "Liquid_Crystal_I2C"

But since your issue is different from the original topic, you should start your own thread, particuarly since the issue for this thread, made by the OP, duraiyuvaraj, has been solved.

Don't clutter up this revolved thread, by asking for help on some other issue.

--- bill

bperrybap: Don't clutter up this revolved thread, by asking for help on some other issue.

What goes around comes around?

Paul__B: What goes around comes around?

I'm guessing Humor??

I made an unintentional "oops" typo... and meant "resolved" as the OPs issue had been resolved. Although the typo was actually pretty funny given how often we are seeing i2c backpack issues lately.

This solves the problem. Use this library: https://github.com/marcoschwartz/LiquidCrystal_I2C

szawus: This solves the problem. Use this library: https://github.com/marcoschwartz/LiquidCrystal_I2C

The library you reference above will be the one you get when if you use the library manager and search for LiquidCrystal_I2C That library is the one that had 1 character write() issue. While it was updated to correct this bug in late 2015, Marco forget to retag it to make it available to the IDE library manager. This was issue #7 in that library: https://github.com/marcoschwartz/LiquidCrystal_I2C/issues/7 I nudged him to create a new release tag so that the IDE library manager would see it. The library you get now from the IDE manager will have this write() bug fix in it.

--- bill

bperrybap: I'm not exactly sure which library you are using or which IDE, but I'm guessing that you are using a new IDE like 1.6.6 or newer. This version of the IDE looks at the return value of the write() function. There are i2c lcd libraries out there that screwed up their code in their write() function. In the older IDE's it didn't matter, but this is not the case on the very recent IDE. The write() function is supposed to return the number of characters processed. If it is less than what was requested, it is an error and further output is thrown away. In those libraries that are screwed up, the write() function is being called with a single character, and the write() function is returning 0, which is an error telling the upper layers not to send any more characters. It should be responding with a 1 indicating that 1 character has been successfully processed.

The proper solution is to go fix the broken code down in the .cpp file of the library. It may look something like this:

inline size_t LiquidCrystal_I2C::write(uint8_t value) {
 send(value, Rs);
 return 0;
}

Or it may be different depending on which library you have. The important thing to note is that the write function needs to return 1 and not 0

Alternatively, you could drop back to an older IDE where the broken/incorrect library will work because the other Print class code doesn't check for the error status.

--- bill

ltore123, What is your point with that quote above? The LiquidCrystal_I2C library has been fixed and is currently available in the library manager. So the issue has been fixed/solved. (see post #12 of this thread)

If you would like to try another library that has additional features and is a a bit faster, you could try my hd44780 library. It is available in the IDE library manager and can be installed in a just a few seconds from the IDE GUI using the IDE library manager. You can read more about here: https://github.com/duinoWitchery/hd44780 It includes a diagnostic sketch that will test the i2c lines and the LCD memory inside the LCD module.

The library will locate the backpack i2c address and auto detect the pin mappings between the PCF8574 chip and the hd44780 signal pins.

The i/o class for PCF8574 based backpacks is hd44780_I2Cexp and the diag sketch is called I2CexpDiag --- bill

If you search for :

send(value, Rs); return 0;

In LiquidCrystal_I2C.cpp and change return 0; to return 1; it does work. I am really irritated with with whoever is responsible for this library. FIX IT YOU JERK! I spent all day trying to get this to work and for what... to find out NO library would have worked at all. Pretty lame Arduino, I feel like you have some responsibility in this too. I could have written my own in the time I noodled around with this thing.

Completely disgusted, and it's such a simple fix for the maintainer. Happy though now that it works with the great support I found here. Thanks guys! You are life savers! =D

Drew

pikadroo, clearly you didn't read the thread. This specific issue was fixed in the library over a year ago and the code is available through the IDE library manager. The issue is yours for using the wrong code. All you had to do is install or update the LiquidCrystal_I2C library using the IDE library manager to get the latest version and you could have had a working solution in seconds.

And BTW, even if you did spend "all day" trying to get something to work, it would take much longer than that to write & test a full featured LiquidCrystal API compatible i2c lcd library. (I've done several so I know what is involved)

--- bill

bperrybap: pikadroo, clearly you didn't read the thread. This specific issue was fixed in the library over a year ago and the code is available through the IDE library manager. The issue is yours for using the wrong code. All you had to do is install or update the LiquidCrystal_I2C library using the IDE library manager to get the latest version and you could have had a working solution in seconds.

And BTW, even if you did spend "all day" trying to get something to work, it would take much longer than that to write & test a full featured LiquidCrystal API compatible i2c lcd library. (I've done several so I know what is involved)

--- bill

No, I did read it. I've never used the library manager I just download what I need like I used to and never had a problem with that. So, perhaps I will try that in the future, but then tell me why if that is so then there is so many broken versions and misinformation out there still. This page here:

http://playground.arduino.cc/Code/LCDi2c

...this page is full of broken libraries and links. Looks like an arduino URL to me, doesn't it to you? I realize ardruino can't control what everyone else does, but they can keep their own house in order, but they don't in this case. The last noted update is in 2011 and clearly there hasn't been and official update to this page since. So disappointing, because this is the only page that continually came up for me when trying to figure this out. Not this thread at all till I went several pages deep into google. Your results may vary, I can only describe my experience and the answers were not forth coming till I arrived here.

Glad to hear you know it all, but I didn't need a full featured library, I just needed to do one little thing. So I should have just done that and moved along.

Anyhow, that is all I have to say on the matter. I have it working. thanks! =)

Drew

pikadroo: No, I did read it. I've never used the library manager I just download what I need like I used to and never had a problem with that. So, perhaps I will try that in the future, but then tell me why if that is so then there is so many broken versions and misinformation out there still.

If you googled around a bit and really did look for a day like you said, you would have seen that there are many different libraries all called "LiquidCrytal_I2C" by several different authors and they work differently. You would have seen many i2c LCD threads with comments by floresta and myself about this and how to work around various issues as well as specific recommend libraries that work and where to get them, including in this thread. For a while there it seemed like a new thread about this was starting nearly every day. There are MANY of these types of threads. Had you read this thread closely, you would have noticed that the thread started 2015-11-23 and as time passed things changed. So what I recommend in post #2 on 2015-11-23 was no longer needed on 2016-04-30 when I responded in #12 where I stated that you could get the updated library directly and easily from the library manager. (you could still install it manually using the github repo link in post #11) You will also notice in post #12 that I was the one that got with marco to get the updated code into the IDE library manger by commenting in github issue 7 on 2016-02-28 to get marko to re-tag the library.

This page here:

http://playground.arduino.cc/Code/LCDi2c

...this page is full of broken libraries and links. Looks like an arduino URL to me, doesn't it to you?

Yes and No. Yes it goes to an arduino.cc address but no is not a web page maintained by the Arduino.cc development team.

I realize ardruino can't control what everyone else does, but they can keep their own house in order, but they don't in this case.

But the playground site really isn't "their house" this "house" was created for the community. It is a somewhat free for all playground for the arduino community. And well ok, it kind of has some broken down things in it now.

Your results may vary, I can only describe my experience and the answers were not forth coming till I arrived here.

There are MANY MANY threads on this issue/topic if you just look around. Granted the new forum SUCKS when it comes to searching but if you do search around it is easy to find many threads that cover this very issue. In fact this issue as well as the confusion over multiple i2c lcd backpack libraries using the name LiquidCrystal_I2C as well as wanting an easier to install and use i2c lcd solution is what drove me to create the hd44780 library package.

Glad to hear you know it all, but I didn't need a full featured library, I just needed to do one little thing. So I should have just done that and moved along.

Keep in mind that the LiquidCrystal_I2C library in the IDE library manager (which is what the thread was about) only works on certain PCF8574 backpacks. So if you change or replace your backpack, the new backpack may not work with the library. Some libraries like fm's LiquidCrystal_I2C i/o class library are configurable but users often struggle with getting that library installed correctly and then getting the configuration parameters correct. hd44780 solves that by using the library manager for installation and auto configuring everything.

--- bill

Thanks bperrybap - edited the .cpp file as per your suggestion and the problem is fixed - great contributor to the forum !