ywRobot I2C LCD problem / solution

Hi everyone,

I made a short video detailing testing out a ywRobot I2C (16 x 2) LCD as well as the problems I had with it and the solution. Hopefully this will stop someone else getting stuck with it

Nice vid thanks for taking the time.

I have got one of these on the way http://www.ebay.co.uk/itm/170955063639?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649

Do you think it will work with the dfrobot code also?

All these boards do work. It isn't really a hardware problem.
(well some do have issues with their backlight control circuitry)
The problem is software and the most common issue is the libraries and the fact that not all the boards are wired up
to the LCD modules the same way so getting the proper library and more importantly the proper
lcd library constructor for the library is very important.
Often the maker of these low cost boards, isn't supplying a working library or examples
that are properly configured for their board.

For PCF8574/PCF8574A based boards, (which both of the two above boards are), I recommend using
this library:
https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home
The reason being is that it works. Plus the constructor for the PCF8574 chip allows configuring
any wiring. So that means as long as you fill in the constructor properly to match how the LCD module
is connected up to the PCF8574 chip, the library will take care of the rest.
This library has quite a bit of testing on it and has several fixes in it for initialization and
for other sized lcds that are not in the majority of lcd libraries out there.

Not sure about the ywRobot pin wiring but I have a pair of of "mjkdz" boards that look
like the ones in the photo and wrote up some information on how it is wired up
which can be used to fill in the lcd constructor for
the i2c device layer in fm's library.
See attached note for information on the "mjkdz" board.

--- bill

LCD-I2C-MJKDZ.zip (299 KB)

See attached note for information on the "mjkdz" board.

Isn't it clever how they have obscured the markings on the IC so that you can't determine the type of device and thus it's I2C address? You can determine that it is in the PCF8574 family from the pinout, but the PCF8574 and PCF8574A have the same pinout with different address ranges.

Don

floresta:

See attached note for information on the "mjkdz" board.

Isn't it clever how they have obscured the markings on the IC so that you can't determine the type of device and thus it's I2C address? You can determine that it is in the PCF8574 family from the pinout, but the PCF8574 and PCF8574A have the same pinout with different address ranges.

Don

It is even more interesting/funny.
When I got the boards, they had what looked like black magic marker ink on top of the IC.
So I got some alcohol and sure enough the black ink came off. But then, even more interesting, the actual chip
had been sanded down so all the markings were gone.
Its all kind of silly because there are essentially 2 chips that are used on all these low cost i2c to hd44780 boards.
PCF8574 and MCP23008. It is easy to tell these apart by simple pin count.
Even more silly is that you can figure it all out in just a few minutes since
the boards are simple dual layer and they usually give you the code to a library and example code.
With open source there is no way to keep anything "a secret".

The address is the only tricky part since even on a 8574 the address can vary depending
on who makes the IC. But you can just run the i2cScanner sketch that is floating around
and the sketch can even tell you that.

-- bill

BIll thats great stuff, just had a read of your txt file and all makes sense!

Crazy the lengths they go too, don't really know why. Like you say in this day and age with all the open source stuff it seems crazy!

Well from past experience its going to be a good few weeks before the boards turn up so I guess I will just have to wait and see!

don't really know why.

When your life depends on it, you will know why.

dhenry:

don't really know why.

When your life depends on it, you will know why.

In this particular instance, masking the i2c chip part number
simply wastes the vendors time and energy.
Erasing the part number is not really providing any additional barrier to competition in this case
since the vendor is supplying the source code to talk to the chip
and the board is a very simple circuit using a
dual layer board where all traces are visible.
Any person who is familiar with i2c chips can look at the board and
have a pretty good idea what chip it is in just a few seconds and if for some reason
they can't tell from looking at the board, a less than 1 minute glance
at the source code will confirm the answer.

I was thinking that it is possible that the vendor might be using PCF8574 "seconds"
which were in some way marked as such and then is sanding them down
and using ink to hide this.
No way to really know why the markings were removed.
The boards I have worked at room temperature for the few minutes that I have
run them so far.

--- bill.

Guys
I have one through Terry King at Yourduino.
Mine has a PCF8574T and the I2C address is 027.

There is everything you need at http://arduino-info.wikispaces.com/LCD-Blue-I2C

Cheers
Mark

From looking at that yourduino code. The two libraries are identical. The difference between the two
is only the examples. One is for 16x2 and the other is setup for 20x4.

The most important information from that code is pin mapping/wiring.
According to that code, the PCF8574 output register bits are assigned as follows.

8574  LCD
---------------
P0    RS
P1    RW
P2    EN
P3    Backlight
P4    D4
P5    D5
P6    D6
P7    D7

From that you can see that it is nibble flipped from the i2c board I had
and the backlight uses positive logic.
To match that configuration when using fm's library
https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home
and i2c device layer, the includes and constructor will be:

#include <Wire.h> 
#include <LiquidCrystal_I2C.h>
                  //  addr, en,rw,rs,d4,d5,d6,d7,bl,blpol
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);  // Set the LCD I2C address

I appreciate all the comentary and suggestions from everyone. I am however still struggling to get
some code for my YwRobot. I watched the video and downloaded the recommended code and all
the libraries everyone recommended but I am new at this and I don't know what to do with
multiple libraries. For that matter I'm not 100% sure where to put them or what other files should
be in that directory. I've seen comments from people saying they should be in the My Documents
\Arduino\Libraries directory and other people saying they should be in the directory created by
the IDE on installation which is C:\Program Files (32 bit) or C:\Program Files(X86) (64 bit) .
I'm a technician so I can follow the hardware discussion but I'm lost when it comes to libraries.
I couldn't even get the Morse Code sample code working with the Morse.zip library and reading
the Arduino website tutorial. Almost all the code I've obtained online worked right off the bat
but this is different. If anyone can offer any specific suggestions I would really appreciate it
but quite frankly unless the Readme file is a .txt file and not .dm (which I can't open) and unless
there are some specific instruction I don't think I'm going to be able to get my lcd working. I did
find an I2C Scanner that worked just fine and returned the address 0x27.

If anyone can offer any specific suggestions I would really appreciate it...

One of the reasons that you may be getting conflicting information is because the Arduino IDE has been evolving so answers posted in old threads (such as this one which you resurrected after 10 months) may no longer be valid.

The search function at the upper right of each page will sometimes yield some useful information. Have you tried searching for ywRobot I2C LCD ?

A google search for something like ywRobot I2C LCD site:arduino.cc will typically give better results.

As far as the library location is concerned you should not go wrong if you follow the advice here: --> http://arduino.cc/en/Guide/Libraries

I don't think I'm going to be able to get my lcd working. I did find an I2C Scanner that worked just fine and returned the address 0x27.

That's a good start. If the searches don't help then start a new thread. Before you do this be sure to look at the sticky post titled How to use this forum - please read . Pay particular attention to item #11.

Don

raschemmel:
I did find an I2C Scanner that worked just fine and returned the address 0x27.

Good start. Now try the "LCD Guesser" sketch.

This problem has been solved.
see:
http://forum.arduino.cc/index.php?topic=200061.msg1475084#msg1475084