16x2 LCD with I2C interface (without i2c module)

Hey there,

I recently bought an 16x2 LCD with I2C interface. I downloaded the library from liquid_cristal and I installed the library as instructed. I ran a few codes to test the board and after I connected the I2C interface I ran I2C Scanner to find the adress, but doesn’t work.

In serial appers the follow text:

Address Not Found.

Here is the datasheet,


I find nothing about this display goggling, if anyone could help me please.
Thank you.

I2C requires pull-up resistors on both signal lines. 4.7K or 10K are typical values.

If that is not your issue, please provide a schematic of your circuit. Hand drawn on paper is good enough.

I2C requires pull-up resistors on both signal lines. 4.7K or 10K are typical values.

If that is not your issue, please provide a schematic of your circuit. Hand drawn on paper is good enough.

So I tried to make the changes that you mentioned and now the Serial appears only this message “Searching…” and find nothing (using the I2C_Scanner) …

HC1627-SYH-I2C-30_Eng,A.pdf (1.94 MB)

I2C_Scanner.ino (1.91 KB)

Here the schematic…

display IIC-convertido.pdf (132 KB)

How have you treated pins 11 (ID1) and 12 (ID2)? They need to be set right to enable I2C mode per the data sheet. Figure 1.5 and paragraph 4.2.

I don't get it this part very well, I just put the others pins to GND, but reading again now I see that I have to set the I2C mode, right? But how? Have I to create and add specific code to make it work? It seems too advanced topic to me hehe :frowning:

Now my circuit is this attachment...

How to post images.

The way that I read para 4.2 is that pin 11 is tied LOW and pin 12 is tied HIGH.
In addition pins 4,5,6 and 14 are tied LOW and 13 is tied HIGH. That is my interpretation (AKA guess) as the data sheet is not really very clear. And the data sheet mentions that SERMODE is to be set HIGH, but I find no pin called SERMODE. All in all, not a great data sheet.

Really, If I were you, I would buy a bog standard 1602 or 2004 HD44780 based display with a PCF8475 I2C backpack. They are cheap, plentiful and easy to use. Use the hd44780 library to make setting them up a breeze. The library is available through the library manager and should only be installed that way. Let me know if you need help to install the library.

I2C displays.

It works brother :slight_smile: … I’m so happy, I can’t believe it hahahah

I made what you said, I wire up and program as you said and finally the sketch to find de I2C address works well (I2C_scanner)

But one more doubt, the program gives me 2 I2C address, could you see? Which one do I need to use?

I2C device found at address 0x3A !
I2C device found at address 0x3B !

That is unusual. I have not seen that before, but this is the first time that I have heard of that particular display.

Have you found a library for the display? If not the hd44780 library may work for you. You would use the hd44780_I2Clcd class. Of course I have not used that display with that library,but if it works it will make it easier on you.

At this point I would suggest that you request that a moderator move this thread to the Displays topic. The author of the hd44780 library visits there regularly and can certainly help you with his library. Use the report to moderator button below left of this post. Let me know and I will make the request if you want.

“ Which one do I need to use?”

Try each to see what results you get ???

Just by the way, you show the contrast potentiometer connected to Vcc, 5 V. That is a mistake! I wonder why you did that?

If you note page 6 of the datasheet. it actually shows the correct connection of the potentiometer as a variable resistor between Vo and ground. :grinning: A 1k potentiometer (trimpot) will work best.

Thank you all for the answers, it helps me a lot ...

So I already made the request, thank you groundFungus, and I tryed to use the library that you said but I'm not familiar than I made the request as you suggest to get more inrformation...

It looks like easy to you larryd , I'm a basic user of arduino, but I'm in love with it hahahah, it's increadible work with arduino...

Paul__B sorry for that, I only follow some tutorials that I found goggling, thank you for your help.

I will make the adjusts and I return here with the results.

Since I have never used that display I cannot be of much more help. Hopefully Bill will be along. I will wager that he can answer any of your questions regarding the hd44780 library’s use with that display.

Thank you a lot for everything. When and how can I talk with him ?

Bill (bperrybap) frequents, at least, the Displays section of the forum almost every day. He will respond to your post if he can help.

Paul__B sorry for that, I only follow some tutorials that I found goggling, thank you for your help.

Absolutely nothing to be sorry about. :grinning: Therein lies the danger in "tutorials".

The problem here relates to people blindly copying designs over and over without the engineering "nous" to examine the consequences of what they are doing. Long ago, some designer looked at the wrong part of the datasheet showing a test circuit and what he did worked - not at all well but sufficiently - so one after another just copied it. Of course this happens all to often in society. :roll_eyes:

So, hello again...

I made the adjustment of the potentiometer circuit.

And I try everything that I knew, but not working...yet...

I really wanna know how to work with this display with two I2C addresses...

Or what am I doing wrong ...?

I looked at the data sheet. This lcd uses a communication interface that is different from any i2c display interface I've ever seen.
Which likely means you may not find an Arduino library that can control this LCD device.

The part to look at is page 8 (page 9 of the pdf)
That explains everything as to the i2c addressing and communication protocol.
That figure shows reads vs writes and each read or write uses 2 addresses.
To communicate with the LCD you actually must use both addresses
The lower address is set using LCD board pins 11 and 12)
pins 13 and 14 set I2C mode and must be set as indicated on page 5 of the datasheet.

To see how it all works look at the bits after the "S" bit.
For writes you see: 0-1-1-1-ID1-ID0-RS-0
For reads you see : 0-1-1-1-ID1-ID0-RS-1

Look at all 8 bits as whole and focus on the the right most bit which is bit 0.
You see all 8 bits of the Address that is put out on the i2c bus.
By convention slave addressing is only 7 bits with bit 0 being the Read/Write bit.
But that isn't why there are two addresses for this device.

Lets assume ID1 and ID0 are both 0 (which it looks like they were during the scans)
(BTW, offtopic but FYI, an I2C scanner should never scan below address 8, as 0-7 are reserved for special functions and can cause problems like a lockup on implementations that implement those special functions.
I wish all these i2c scanners would clean up their code to conform to the i2c spec)

So with those bits you end up with write address of 011100R0 and a read address of 011100R1
It is the RS bit that creates the 2nd address.
Here are the four 8 bit addresses:
01110010 - write with RS set to 1
01110000 - write with RS set to 0
01110011 - read with RS set to 1
01110001 - read with RS set to 0

But with the 7 bit addressing convention you end up with only 2 address as you only use the upper 7 bits of the 8 bits
0111001 - 0x39
0111000 - 0x38

With 7 bit addressing (which is what Arduino uses) bit 0 of the 8 bit address is implied by read vs write with write setting the bit to 0 and read setting the bit to 1

0111001 - 0x39 read/write from/to here will read or write with RS bit set
0111000 - 0x38 read/write from/to here will read or write with RS bit clear

So this is how you use the two addresses
0x39 - write to here to write to DDRAM/CGRAM
0x39 - read from here to read from DDRAM/CGRAM
0x38 - write to here to send a command
0x38 - read from here to read status & address counter

What this means that none of the "LiquidCrystal" type libraries I've seen will work with this device.
The hd44780 library includes a hd44780_I2Clcd i/o class but the way this LCD device works is different than the way the PCF2116/PCF2119x chips work.
This device uses a different address to set RS vs the other devices use a single address with a control byte to set RS.
This means that a new i/o class would be needed to work with this device.

It is a very small/simple i/o class as the code would be very similar to the hd44780_I2Clcd i/o class.

I can take a shot at putting one together but I REALLY don't like tossing out code that I cannot test and trying to debug things remotely is quite difficult.
Basically, it will either work out of the gate or I'll need to have one in my hands to test with.

I'll PM you with the code and we can report back here once it works or doesn't work.
In the mean time, please post some photos of your actual board front and back and your wiring so we can look it over.

--- bill

i/o class code is ready for testing. PM me your email address and we can work offline to get it working.

I am curious though. Where did you get this display?

--- bill

So, in essence, it's a dog! :roll_eyes:

I can't seem to find anyone selling it, but as I suspect it is somewhat expensive (and most on eBay are not), I cannot see a reason to use it. :astonished: