Push Button over I2C - Only 4-wires available

Hi All,

I'd like to add a push button next to an OLED display to essentially switch modes on the graphics of the display.
My main issue is that from the Arduino to the OLED display and housing there is only a 4-wire connection for I2C.

I would like to add a button to this display housing and somehow communicate a state change over I2C using the momentary push button. Is this possible somehow?
Do special I2C buttons exists? I tried searching and nothing good came up.


If you look at something like the Adafruit RGB led board, it has the display plus 5 buttons. To accomplish this, it has a chip on the shield that handles the i2c traffic and button information. You can't do it alone. RGB LCD Shield Kit w/ 16x2 Character Display - Only 2 pins used! [NEGATIVE DISPLAY] : ID 714 : $24.95 : Adafruit Industries, Unique & fun DIY electronics and kits

Like this from Sparkfun?

Library and code.

1 Like

This looks very interesting! I will look into this, but it seems to do what I'm looking for, I2C communicated button.


Not so hard. First hit on a search for "I2C button".

I guess my search results in Switerland are different!
Thanks for the help.

I2C is a bus.

bus-orinetated communication works this way

"hello device with number X please answer."
here is device X

"hello device with number Y please answer."
here is device Y

"hello device with number Z please answer."
here is device Z

if the bitbanging signals on the bus don't match the device-number
the device will not react.

This means it should be possible to simply add an I2C-IO-port-expander to the same
SDA/SCL-wires as the OLED-display and then be able to communicate with both devices
if the OLED and the IO-expander have different device-adresses.
Most IO-expanders are adjustable to different device-adresses.

If all the code is written by you or you understand what the OLED-code is doing
you will be able to add the code for the buttons.

best regards Stefan

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.