We're Using ESP12E as our MCU and we have three functionality :

  • SIM800 connected to TX(GPIO1), RX(GPIO3)
  • Matrix Keypad connected to GPIOs: 14,13,2,10,0,4,5,16
  • GLCD connected to GPIOs: 15,12

And we also need to communicate with an RTC(DS3231) module via I2C bus!

So i'm wonder how we could do this?

Is it possible to share I2C pins with any other pins ?

And BTW for some reason we can't use IO expander such as PCF8574

  • Why can't you use a IO expander? It'll save you those 8 pins needed for the matrix keypad. Can you use any other external IC? – ratchet freak May 16 '18 at 9:28
  • Yeah i know, that's a great IC but for now we've some restriction on PCB and some other issue on supply – IMAN4K May 16 '18 at 9:36
  • GLCD (graphical LCD) connected via two wires? How is that possible, it usually requires far more wires? If this is already an I2C bus device, just put the RTC module on the exact same lines? I2C is a bus after all.. – Maximilian Gerhardt May 16 '18 at 9:45
  • @MaximilianGerhardt It's a ST7920 GLCD with 3 Wire software SPI using this nice lib:github.com/olikraus/u8g2 , also we're in serial mode so cs is chip enable and is connected to logic 1 – IMAN4K May 16 '18 at 9:49
  • Then if you used another display with same characteriscs (columns, lines, ..) but with a I2C interface, wouldn't your problems be solved? Then you have still 2 wires but with 2 devices on the I2C bus. Or throw in an I2C to SPI converter chip like NXP SC18IS602B. – Maximilian Gerhardt May 16 '18 at 9:56

Since you already want to use I2C it makes sense to move other things onto that same I2C bus to save IO pins. And even off-load processing.

For instance, you could move your keypad to a dedicated matrix keypad interface chip, such as the MAX7365 (probably overkill for a small keypad), or a general I2C GPIO IO expander, such as the MCP23017.


We found 74C922 at long last! without any other choices.

A cheap, available, reliable and easy setup IC.

The simple schematic we use:

enter image description here

here is a good topic to start with

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.