Go Down

Topic: SOLVED: How to wire an mjkdz I2C board to a 20 x 4 LCD (Read 24 times) previous topic - next topic

TomKi

The documentation for the Atmega chips said that SDA was at A4 and SCL was at A5.  I used the i2c_scanner and a couple of LEDS and traced the signals to A0 and A1.  A0 is SCL and A1 is SDA.

If you have a PCF8574 without the A on it, the physical address is set by connecting pins 1,2,3 to either VSS or VDD.  They are A0,A1, and A2, in that order.  Add that to 0x20 and you know the address.  On my board I can see where they are connected, which is to VSS.  If they are all connected to VDD you get an address of 0x27.  Mine works at 0x20.

I got my adapter almost the same day that Farkuino got his, and I just got mine working about ten minutes ago.  I started on Monday. 

Thank you, everyone who helped, and I like that graphic that Tack wrote.  I have a nice blue 16 by 2 display. 

I also learned that you do have to initialize with lcd.begin(columns, rows).  I had a lot of fun figuring out that there was a mistake that I could make that set my MPUs to their factory defaults, so they were running at 1MHz instead of 16, and I got to learn how to edit boards.txt.

bperrybap


I also learned that you do have to initialize with lcd.begin(columns, rows).

It depends on the library.
Some PCF8574 i2c libraries set the geometry in the constructor
and use lcd.init().

And that is what makes it a bit challenging.
There are many different PCF8574 i2c to hd44780
libraries and hardware designs out there. And they all work slightly differently.

As of today, there really is no way to offer a plug and play library solution for an i2c to hd44780 backpack
unless it all comes from the vendor.
Many vendors are not supplying a pre-configured library for their board.

I prefer to use fm's library since it can work on all of the PCF8574(A/N) based backpacks.
(including the ability to concurrently support multiple i2c boards that are wired differently)
The key to this capability is that the constructor configures the library for the hardware.
So the user must properly fill in the constructor to match his hardware.

The problem is many Arduino users don't understand the hardware details of how these
i2c to hd44780 boards work and are assuming (and expecting) that because it is i2c
that it should be "plug and play" and well.... it isn't, and there is no way to get there.

It isn't that difficult to get up and working, but it may require a bit of sleuth work
to look at the i2 board and the traces on it, to determine how the PCF8574 is wired up to the hd44780
interface to be able to properly fill in the constructor
for fm's library since many of the i2c boards come with no documentation.

--- bill

TomKi

Well, in my case I finally realized that I needed to be sure that the signals were actually getting there.  In the process I made a custom boards.txt entry so that I would get the fuses and the wiring variant right.  I'm using an Arduino Serial Mark II board I got from Mouser.

he3r0

I wanted to thank Tack as well for getting my 20x4 LCD to get running with I2C interface, i've got that library alreday but all i was getting is some weird stuff on the screen, i guess devil was hidding in the code :)

Thanks again.
--
HE3r0
d(R)ive safe

GordonShumway

Hello everyone!  I have the same MJKDZ I2C board.  I also ran a I2C scanner, and the port is confirmed to be 0x20.  However, I do not have a 20x4 display, I have a 1602 display that I purchased here:  http://www.ebay.com/itm/170817946781?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649  Does it work in the same way as the 20x4?

I have connected it in a 1:1 manner like in the photograph of the original poster.  So far, I can't get it to work with any sketches that I have tried.  Since my I2C port scanner is working, I will assume that the problem is either the connection or software.

I am very new to Arduino and these types of devices, can someone please explain to me how I can get to the point of working example code, so I can do my own programming?

Go Up