There is a previous question about this same topic here, but it does not answer my question.

I want to use a generic I2C OLED 128x64 px display and an SPI RF24 radio in the same sketch. I know that it's theoretically possible to do so as long as they're not used at the same time - my question concerns the implementation of this circuit. Can I just leave the two devices as-is without needing some kind of external apparatus to switch power to each one of them?

I know that for SPI a chip will just ignore everything when its CS pin is pulled high, and from my tests the SPI communications don't affect the SDA line of the I2C - the problem comes when I try and use the CLK and SCL line with this setup. The pullup resistor in my circuit is stopping the I2C SCL line from working. When I remove the wire (green in the breadboard schematic shown) that connects the CLK to one end of the diode the I2C starts working and the display updates, but the radio doesn't work. If I remove the pullup resistor from the circuit the I2C starts working again, but the radio doesn't work anymore. I tried switching the CLK signal with a transistor, but it doesn't look like the 2n2222 transistor I was using is fast enough to switch the CLK signal. Will I have to go with the tiny84, or is there a way to get this to work on the ATtiny85?

  • Do you have a AtTiny 85 of 84? They are quite different, you know. Which pins do you need to use for I2C? Which pins do you need to use for SPI?
    – Gerben
    May 25, 2017 at 13:37
  • ATtiny8X does not have specific hardware support for SPI and I2C instead there is a hardware module called USI that can be used to implement SPI and I2C. Your alternative is to use USI for one of the protocols (for instance I2C) and additional pins for software SPI. May 25, 2017 at 14:04
  • I2C should ignore any commands that don't make sense or aren't addressed to it; you can share
    – dandavis
    May 25, 2017 at 20:02
  • Alex - I2C uses addresses rather than a CS line, so the first(?) byte of the message says who the messages is for. Each device has two addresses, a read and a write address which is actually only different in bit7. Don't forget you 4.7K pull-ups on the SDA and SCL lines. May 26, 2017 at 12:00
  • @CodeGorilla ok thanks. I isolated the problem that's not allowing my setup to work and updated my question.
    – Alex Wulff
    May 26, 2017 at 12:05

1 Answer 1


In the setup shown, you have 3 pins free, yes? Although hardware i2c may not be directly possible through software, the use of the other GPIO pins can be used for either a logic circuit to switch around the pull up resistor/green wire/whatever OR you can just use software i2c which is a lot easier to do.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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