A quick note on how to add 6 buttons to a PCF8574 I2C display, like the kind you commonly get on ebay/aliexpress, so you can get a convenient input interface to your project.
If you are willing to forego controlling the backlight, you can easily add 6 buttons to a PCF8574 I2C LCD display. See the attached schematic.
The modifications required are:
1. Remove the transistor Q1 that controls the backlight (it is a small SOT-23 transistor).
2. Connect the "K" of pin 16 of the backlight LED source to ground (pin 1) if you still want the backlight to be lit when powered on.
3. There is a 4.7k 0805 SMD resistor between +5V/VDD and pin 7 of the PCF8574. Solder a small wire to the pad of the resistor connected to pin 7.
4. Construct a keypad of six buttons, each button in series with a 1N4148 diode. The cathodes of the diodes (the terminal with the band) are all connected together and to the pad you soldered to for pin 3.
5. The other terminal of each button is connected to the following 6 pins on the display: RS(4),R/W(5),DB4(11),DB5(12),DB6(13),DB7(14).
As long as the backlight pin (P3 on the PCF8574) is high, the display behaves normally. To read the buttons, keep the P2/ENABLE(6) pin on the display low and pull the P3/backlight pin low, and all other pins (P0,P1,P4-P7) are high, so a I2C write is performed with the value 0xF3. Because the pins of the PCF8574 have weak pullups and strong current sinks, when P3 is low, each pin of the display is shorted to P3/low which registers the button press as a zero. A I2C read then reads the state of the pins in P0,P1,P4-P7 with a low state for a button press. To restore normal operation, put the P3/backlight pin high again, or I2C write 0xFB.
I have a modified LiquidCrystal_I2C library that includes reading the buttons as well.
Dan