0

I'm building a little audio streamer box, using a Rpi4. This box has a few buttons, such as play/pause, next track, previous track, etc, as well as a power button that I want to use for turning it on (by shorting pins 5 and 6) and for sending a shutdown command.

I'm also using a small OLED display that is connected to the I2C bus (pins 3 and 5).

Is there a way to either move the I2C bus to other pins, so I can free up pin 5 for the power button, or can I somehow safely use pin 5 for both the I2C bus and the power button?

starfly
  • 3
  • 2

2 Answers2

0

The only pins usable for hardware I²C are 3,5.

You should be able to also use pin 5 to reboot (but AFAIK not shutdown).

See Will pulling pin 5 low will make the pi boot up again

You can use other pins to shutdown dtoverlay=gpio-shutdown.

Frankly there is little point. Reboot only works after a soft shutdown, which leaves most of the Pi running but still using significant power.

Milliways
  • 62,573
  • 32
  • 113
  • 225
0

You cannot share pin 5, but the RPi 4B has several hardware-based i2c channels, and at least one software-based i2c (i2c-gpio), available for use. These GPIO channels are listed and defined in your local /boot/overlays/README file; there's also a copy of this README file on RPi's GitHub site. These additional channels are declared and configured in your /boot/config.txt file as overlays.

I was forced to relocate my RTC from i2c1 because I also needed to use GPIO3 for another purpose. I chose to move my RTC from i2c1 to i2c0, and it has worked fine for months now. I wrote up the procedure I followed on this GitHub page.

Note that not all of the RPi's alternative i2c channels have pullup resistors (i2c0 & i2c1 have on-board pullups), and they may need to be added if your OLED display does not have them.

Seamus
  • 23,558
  • 5
  • 42
  • 83