Hello! I'm Arsenijs, I like building stuff with Raspberry Pi's and lately I've been working with character displays, as well as their I2C backpacks, so I've collected some hacks I can show you. Today, I'll tell you how to save a lot of pins on Raspberry Pi if you're using those popular HD44780-based character displays, like the one on the second picture.

For this, I'm using a 1$-a-piece I2C LCD backpack which are available in large quantities on eBay (those which I have on the header image) and are typically used with 5V Arduinos. This backpack is typically run from 5 volts due to the fact that it supplies its VCC to the HD44780 display, and these LCDs most often are 5V-only - and we all remember Raspberry Pi doesn't like 5V on its GPIOs! However, with a single cut trace and a pin added to a header you can modify it so that the backpack itself works with 3.3V (perfect for Pi) and supplies the 5V necessary for the screen to work.

Moreover, I'll also tell you how to hack this backpack so that it can interface with up to 8 buttons using I2C! Not only that, but I'll show you how use interrupt capability of PCF8574 to avoid unnecessary loading of I2C bus and therefore reduce CPU load by monitoring just a single GPIO pin instead of asking about the buttons' state again and again.

I'll also provide you with Python code for both button reading and output to screen. It's easy to read and modify to suit your needs =)

In the end, you can add a screen and buttons (or multiples of them both!) to your project using just 2 I2C pins (can be shared among multiple devices) and an optional 1 GPIO pin. Moreover, if you analyze my code and the IC datasheet, you can even use those boards to increase your GPIO count on the Pi. Those backpacks are using PCF8547 ICs, and these ICs have a lot more features than just driving an LCD. If that's what you're interested to hear about, continue reading and you'll get a glimpse of a recent big project of mine that's sure to catch your attention ;-)



Some links:

A very detailed writeup on HD44780 displays, their different variations, controllers and backpacks

PCF8574 datasheet