I2C SSD1306 OLED with reset line: Wemos S2 Pico weirdness #10820
-
SPI OLED screens with a reset line are pretty common, but the MicroPython ssd1306 library doesn't have any way to use them with I2C screens. The Wemos S2 Pico is an ESP32-S2 board with a 128x32 SSD1306 OLED built in. For the longest time, I couldn't get the display to work. The i2c bus scan would show the right device number, but attempting to display anything created noise: Looking at the schematic, apart from the nicely-documented pull-up resistors, there's an unexpected RES# line: It seems you have to set this line high for the display to work at all:
Seeing an I2C display with a reset line is a first for me. I wouldn't suggest adding support to the library as it can be handled well without changes. |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 5 replies
-
Here's the complete code, including the required reset line activation, to make the OLED on the S2 Pico work: # for Wemos S2 Pico SSD1306 128x32 display
# https://www.wemos.cc/en/latest/s2/s2_pico.html
# scruss, 2023-02
from machine import Pin, I2C
import ssd1306
# ensure display reset is held high, otherwise nothing will work
oled_reset = Pin(18, Pin.OUT, value=1)
# ESP32 S2 only has one hardware I2C channel, #0 on pins 8 & 9
i2c = I2C(0, sda=Pin(8), scl=Pin(9))
# use default address 0x3C (60) for SSD1306
display = ssd1306.SSD1306_I2C(128, 32, i2c)
display.fill(0)
display.text("* Hello from *", 0, 0, 1)
display.text("* S2 Pico *", 0, 8, 1)
display.show() |
Beta Was this translation helpful? Give feedback.
-
My configuration is Wemos D1 mini clone and OLED 64x48 0.66" shield It seems i get a I2C problem as i2c.scan() function return 112 i2c peripherals from 0x08 to 0x77 ??? i2c.readfrom(0x3C, 16) return 0x3C : b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' (same for 0x3D) any idea ? |
Beta Was this translation helpful? Give feedback.
-
It seems that you do not have pull-up resistors on sda and scl |
Beta Was this translation helpful? Give feedback.
-
It might be necessary to toggle the reset line. On my Lolin S2 Pico the display was still showing noise until I changed your code as follow: from machine import Pin, I2C
import ssd1306
oled_reset = Pin(18, Pin.OUT)
oled_reset.off()
oled_reset.on()
# ESP32 S2 only has one hardware I2C channel, #0 on pins 8 & 9
i2c = I2C(0, sda=Pin(8), scl=Pin(9))
# use default address 0x3C (60) for SSD1306
display = ssd1306.SSD1306_I2C(128, 32, i2c)
display.fill(0)
display.text("* Hello from *", 0, 0, 1)
display.text("* S2 Pico *", 0, 8, 1)
display.show() |
Beta Was this translation helpful? Give feedback.
-
Note: I wasn't really looking for further discussion on this point. This platform doesn't work well for noting observations that don't require further input. |
Beta Was this translation helpful? Give feedback.
Here's the complete code, including the required reset line activation, to make the OLED on the S2 Pico work: