Monday, July 15, 2013

PCF8574-based I2C LCD backpacks

So it seems that there's a lot of these about. A while back I picked up a bunch of cheap LCD backpacks on eBay, they look like this:

Like most of these cheap LCD backpack units, it utilises a GPIO expander chip. In this case, the chip used is a PCF8574. Most of the other I2C backpacks for Hitachi LCDs seem to utilise Microchip's MCP23008, which seems to be the little brother of the MCP23017 I've been playing with lately. So I had quite a hunt for some quick and easy code libraries to test out the backpacks with. I found one in Atlassian Bitbucket. I used version 1.2.1.

I then found this page which describes a number of the cheap eBay backpacks and clones. The third code example worked fine with the above library.

Unfortunately, after reducing the test sketch to merely the below, it was still gobbling 4768 bytes of flash. Unacceptably large, I think.

At some point in the past I'd picked up a bunch of black-on-green 16x2 LCDs for next to nothing. The total cost per LCD+backpack combo should come to easily less than $10 (AUD) each, including shipping. Pretty happy with that. They even work properly!

1 comment:

  1. Have you looked at why it's 4k of flash? It's possibly just the (one-time) cost of linking in the C++ libraries you're using.

    If you're really trying to save flash space, you can possibly cut out a lot of their code without affecting your specific use-case.