adafruit / adafruit/Adafruit_CircuitPython_DisplayIO_SH1106

Raspberry pi pico sh1106 display issues

Open
#3 8 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
9
Forks
6
PR merge metrics
No merged PRs in 30d

Description

I tried to get 2 sh1106 displays working on the raspberry pi pico for the last 2 days. One of them is a Waveshare 1.3 inch 128x64 SH1106 OLED (in SPI mode), the other one is a generic 128x64 SPI OLED experimentally identified to be an SH106 module since just like the first one it worked perfectly with an aruino nano with the following [library](https://github.com/wonho-maker/Adafruit_SH1106). However, when trying to get it working in CircuitPython on 6.3 the display occasionally only turned on and showed noise, however when switching to latest release of 7.0.0-beta I got some text out of the display, also randomly but not like it's supposed to be. In both cases the latest release of this repo was used for the libraries. It also appears that perhaps some memory mishap is going on since on several occasions I witnessed the REPL output appearing on the OLED:
![image](https://user-images.githubusercontent.com/25513498/124165713-c9363300-daaa-11eb-98e2-53f82ef81af7.png)

The code I used is as follows:
```import busio
import board
import displayio
import terminalio
from adafruit_display_text import label
import adafruit_displayio_sh1106

displayio.release_displays()

oled_reset = board.GP6

# Use for I2C
# i2c = board.I2C()
# display_bus = displayio.I2CDisplay(i2c, device_address=0x3C, reset=oled_reset)

# Use for SPI
spi = busio.SPI(clock=board.GP2, MOSI=board.GP3, MISO=board.GP4)
oled_cs = board.GP7
oled_dc = board.GP5
display_bus = displayio.FourWire(spi, command=oled_dc, chip_select=oled_cs,
reset=oled_reset, baudrate=1000000)

WIDTH = 128
HEIGHT = 64 # Change to 64 if needed
BORDER = 5

display = adafruit_displayio_sh1106.SH1106(display_bus, width=WIDTH, height=HEIGHT)

# Make the display context
splash = displayio.Group(max_size=10)
display.show(splash)

color_bitmap = displayio.Bitmap(WIDTH, HEIGHT, 1)
color_palette = displayio.Palette(1)
color_palette[0] = 0xFFFFFF # White

bg_sprite = displayio.TileGrid(color_bitmap, pixel_shader=color_palette, x=0, y=0)
splash.append(bg_sprite)

# Draw a smaller inner rectangle
inner_bitmap = displayio.Bitmap(WIDTH - BORDER * 2, HEIGHT - BORDER * 2, 1)
inner_palette = displayio.Palette(1)
inner_palette[0] = 0x000000 # Black
inner_sprite = displayio.TileGrid(
inner_bitmap, pixel_shader=inner_palette, x=BORDER, y=BORDER
)
splash.append(inner_sprite)

# Draw a label
text = "Hello World!"
text_area = label.Label(
terminalio.FONT, text=text, color=0xFFFFFF, x=28, y=HEIGHT // 2 - 1
)
splash.append(text_area)

while True:
pass

```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the provided CircuitPython reproducer and the adafruit_displayio_sh1106.SH1106 entry point, using the Raspberry Pi Pico, both SPI displays, and the reported CircuitPython versions. Compare the output with the 6.3 and 7.0.0-beta releases. Done means the displays consistently show the expected text without noise or REPL output appearing on the OLED.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.