Comments on: Raspberry Pi Pico: SSD1306 OLED Display (Arduino IDE) https://randomnerdtutorials.com/raspberry-pi-pico-ssd1306-oled-arduino/ Learn ESP8266, ESP32, Arduino, and Raspberry Pi Tue, 09 Dec 2025 14:04:31 +0000 hourly 1 https://wordpress.org/?v=6.8.5 By: Georg https://randomnerdtutorials.com/raspberry-pi-pico-ssd1306-oled-arduino/#comment-1135983 Tue, 09 Dec 2025 14:04:31 +0000 https://randomnerdtutorials.com/?p=132767#comment-1135983 In reply to John Parker.

For PlatformIO users: The setters setSDA() and setSCL() are not available in Wire class.

Instead you can do (e.g. for I2C0):

#define I2C_SDA_PIN 20
#define I2C_SCL_PIN 21
MbedI2C myWire(I2C_SDA_PIN,I2C_SCL_PIN);
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &myWire, OLED_RESET);

and at the beginning of setup() before display.begin(…):

myWire.begin();

]]>
By: Sara Santos https://randomnerdtutorials.com/raspberry-pi-pico-ssd1306-oled-arduino/#comment-1076584 Thu, 31 Jul 2025 13:42:42 +0000 https://randomnerdtutorials.com/?p=132767#comment-1076584 In reply to John Parker.

Thanks for sharing.
Regards,
Sara

]]>
By: John Parker https://randomnerdtutorials.com/raspberry-pi-pico-ssd1306-oled-arduino/#comment-1076559 Thu, 31 Jul 2025 11:36:31 +0000 https://randomnerdtutorials.com/?p=132767#comment-1076559 This is, by far, the best guide to the SSD1306 for Pi Pico I have found.
For anyone coming to this trying to use ports OTHER than GPIO4 and GPIO5, here’s what I worked out.
If the I2C channel you’re using is on I2C1 (GPIO2,3,6,7,10,11,14,15,18,19,26,27), change the initialization string to

Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire1, -1);

Now, you need to add 3 lines to your setup() section before you call the display.begin routine

For I2C0
Wire.setSDA(16); // Change the 16 to the GPIO pin you’re using
Wire.setSCL(17); // Change the 17 to the GPIO pin you’re using
Wire.begin();

For I2C1
Wire1.setSDA(26); // Change the 26 to the GPIO pin you’re using
Wire1.setSCL(27); // Change the 27 to the GPIO pin you’re using
Wire1.begin();

That got it to work for me. I wasn’t able to find this info anywhere and basically stumbled onto it by accident.

]]>
By: Sara Santos https://randomnerdtutorials.com/raspberry-pi-pico-ssd1306-oled-arduino/#comment-1006542 Sun, 09 Feb 2025 09:38:09 +0000 https://randomnerdtutorials.com/?p=132767#comment-1006542 In reply to David.

Hi.
You can use other combination of pins, but you need to choose certain combinations.
See this section about I2C in our pinout guide: https://randomnerdtutorials.com/raspberry-pi-pico-w-pinout-gpios/#i2c

After choosing the pins:

In the setup(), you need to start an I2C communication using GPIO x and GPIO y. So, you need to add the following line:

Wire.begin(x, y);

After that, initialize the display with the following parameters:

if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C, false, false)) {
The parameters set as false ensure that the library doesn’t use the default I2C pins and use the pins defined in the code.

I think this should work but I haven’t tested it.

Regards,
Sara

]]>
By: David https://randomnerdtutorials.com/raspberry-pi-pico-ssd1306-oled-arduino/#comment-1005842 Thu, 06 Feb 2025 17:47:23 +0000 https://randomnerdtutorials.com/?p=132767#comment-1005842 The pico has lots of i2c ports is there any way to specify the sclk and sda pins rather than use the default? I want to use pins 11 and 12

]]>
By: Sara Santos https://randomnerdtutorials.com/raspberry-pi-pico-ssd1306-oled-arduino/#comment-938509 Wed, 17 Jul 2024 15:40:34 +0000 https://randomnerdtutorials.com/?p=132767#comment-938509 In reply to Rijk Meurs.

Hi.
What do you mean?
Regards,
Sara

]]>
By: Rijk Meurs https://randomnerdtutorials.com/raspberry-pi-pico-ssd1306-oled-arduino/#comment-936210 Thu, 11 Jul 2024 06:30:46 +0000 https://randomnerdtutorials.com/?p=132767#comment-936210 Hi

is it possible to change the default I2C adress of the pico?

thank you

]]>
By: Sara Santos https://randomnerdtutorials.com/raspberry-pi-pico-ssd1306-oled-arduino/#comment-907045 Wed, 17 Apr 2024 22:09:10 +0000 https://randomnerdtutorials.com/?p=132767#comment-907045 In reply to Bert.

Great.
I’m glad everything is working as expected.
Regards,
Sara

]]>
By: Bert https://randomnerdtutorials.com/raspberry-pi-pico-ssd1306-oled-arduino/#comment-907035 Wed, 17 Apr 2024 21:12:03 +0000 https://randomnerdtutorials.com/?p=132767#comment-907035 In reply to Sara Santos.

Thank you for your response. I did the entire installation procedure again. When installing the boards I was immediately given an update option. After doing this, all programs worked as before and the error messages disappeared.
I have no idea what went wrong before, but it works again./
Thank you for your patience.

]]>
By: Sara Santos https://randomnerdtutorials.com/raspberry-pi-pico-ssd1306-oled-arduino/#comment-906937 Wed, 17 Apr 2024 14:11:07 +0000 https://randomnerdtutorials.com/?p=132767#comment-906937 In reply to Bert.

Weird….
I’m not sure what might be causing the issue.
You said it worked before… I really don’t know what might have caused the issue…

Regards,
Sara

]]>