[ASK] Swap SPI (7pin) to I2C (4pin) on code made for 7pin

I search online but confuse about this.

I have 7 pin oled display, i want to swap it with the 4 pin oled display. Less wire less solder.

What i have to change in the program code?

Or its as easy as just change

display.begin(SSD1306_SWITCHCAPVCC, 0x3D);


display.begin(SSD1306_SWITCHCAPVCC, 0x3C); ?

The details of the OLED display are not posted, but I think 7 pins uses SPI communication and 4 pins uses I2C communication.
You need to change the at Arduino connection pin and the code probably needs to change the definition of the LCD.

By the way, the change from SPI to I2C significantly reduces the rendering speed.
This has the potential to be a disadvantage depending on the intended use of OLED.


its okay with the slower speed as i only use it for light meter display.

And yes its SPI vs I2C.

So, its just like what i think right? Other than different pin to connect

SPI > analog
I2C > digital

Only change D & C right?



Learn with this video.

I edited the title hoping someone could understand what i trying to do here.

I have a running project on my arduino nano made for 7 pin spi display.

In order to "less wire" what lines i had to edit on the code?

@fyrus, your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with your project.

You just say:

#include <Adafruit_SSD1306.h>
//Adafruit_SSD1306 display(128, 64, &SPI, OLED_DC, OLED_RESET, OLED_CS);
Adafruit_SSD1306 display(128, 64, &Wire);
    display.begin(SSD1306_SWITCHCAPVCC, 0x3C);

I am assuming that your new OLED has only got 4 pins.

If you want to use a physical 7-pin module for I2C, please post a link to the actual display that you have bought.


Correct, the new display is 4-pin i2c. The old one 7-pin spi.

The sketch im working on is made for spi display and the only different i notice in the code is just that "display.begin" line & its wired 5 of the pins to D8/D9/D/10/D11/D12 & 5V/GND.