I recently acquired, via eBay, a 40X4 HD44780 based LCD screen that has a daughter-board on the back that provides an I2C interface, labled “LCD2004“. This permits interfacing with only two wires (SDA/SCL) plus ground and 5-volts. This particular board is sold by a Chinese company, SainSmart.com. SainSmart provides its own version of the Arduino LiquidCrystal library and some example code. Unfortunately, both the library are for the old version of the Arduino IDE and will not compile with the current Arduino 1.0 version.
To get the I2C display to work I did some reverse engineering. The LCD2004 board utilized the PCF8574 I/O expander. This nifty little chip provides eight bits of parallel I/O addressable by a I2C bus address – 0x00 to 0x27. SainSmart tied all address leads to Vcc, so the LCD2004 board’s I2C address is permanently fixed at hex 27. This is rather limiting since no additional LCD2004s can be added to the bus. Anyway, you simply address the board and write an eight bit value which is then presented on the output pins of the PCF8574, which, in this case, are connected to the HD44780 based LCD screen.
After some reverse engineering to determine which PCF8574 pins were connected to which LCD pins, I was able to use F Malpartida’s NewLiquidCrystal library to write a functional test program. The unit works quite nicely and my code and schematic can be obtained in my BitBucket Repository.
The SainSmart LCD2004 board is identical to one offered by YwRobot and SainSmart’s provided example code is even marked with Ywrobot. Possibly SainSmart merely markets the Ywrobot board under their name, or possibly they cloned it. Furthermore, both Ywrobot may have obtained its design from DFrobot. DFRobot may have been the original board designer given their more professional approach of decent documentation, but given China’s disregard for intellectual property rights, who knows for sure? Also, DFRobot has and active forum with timely responses by their engineers, and a wiki, which is another plus for their professionalism. DFRobot’s board and SainSmart’s significantly differ, physically, so if SainSmart copied DFRobot, it was only from their schematic and not the board design.
A more versatile I2C LCD board would be to use the design offered by F Malpartida. Her I2CLCDextraIO board allows you to define a unique address for each LCD, permitting a multi-display configuration with all controlled over one I2C bus. Her designs are freely available in her BitBucket repository if you’d like to make your own board. You can also buy her bare board or assembled unit from ElectroFUN.