Keypad and LCD over I2C

Hello,

I'm using an Arduino Uno R3 to create a baby incubator. The number of pins is enough for the project, however I also need to use a keypad (4x4) and a character LCD.

Since there aren't enough pins for the keypad and LCD I was wondering if I could use both the keypad and LCD on an I2C bus.

I know there are modules that can be attached to LCDs to adapt them for I2C. Is there something similar for keypads?

And how can I use them both on the same I2C bus?

Did you do a Google search for "I2C keypad" (1,150,000 hits)?

And how can I use them both on the same I2C bus?

Make sure that they each have a unique I2C address, that's it.

The best LCD library at this time is the hd44780 library.Home · duinoWitchery/hd44780 Wiki · GitHub That library will auto detect the I2C address and the I2C expander to LCD pin mapping (the thing that trips up most first time I2C LCD users). If you have another I2C expander on the I2C bus the auto detect can pick the wrong address for the LCD. The solution is to specify the LCD I2C address in the hd44780 LCD constructor.

The hd44780 library is available from the library manager. Open library manager and in the Topic drop down choose Displays and in the Filter box enter "hd44780". Then select and install the hd44780 by Bill Perry library. Use the hd44780_I2Cexp class.