# OLED SPI sh1106 argument error

**URL:** <https://forums.pimoroni.com/t/oled-spi-sh1106-argument-error/23422>\
**Category:** Support\
**Created:** [December 2, 2023, 4:58pm UTC](https://forums.pimoroni.com/t/oled-spi-sh1106-argument-error/23422 "2023-12-02T16:58:46Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Richard238](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard238](https://forums.pimoroni.com/u/Richard238)\
**Post date:** [December 2, 2023, 4:58pm UTC](https://forums.pimoroni.com/t/oled-spi-sh1106-argument-error/23422/1 "2023-12-02T16:58:46Z")

</div>

Trying to get OLED SPI 1.2 in front port of large breakout garden working.  
The garden is OK, as it’s fine with a BME280 sensor  
Host is a Pi Zero 2W  
SPI & I2C interfaces are enabled

`python3 font_awesome.py --display sh1106 --height 128 --rotate 2 --interface spi --gpio-data-command 9 --spi-device 1`

Says:

`font_awesome.py: error: argument --display/-d: invalid choice: 'sh1106' (choose from 'max7219', 'ws2812', 'neopixel', 'neosegment', 'apa102', 'unicornhathd', 'linux_framebuffer')`

Any ideas, please?

Thanks!

---

<div class="post-metadata">

**Author:** ![Shoe](https://avatars.discourse-cdn.com/v4/letter/s/e36b37/32.png) [@Shoe](https://forums.pimoroni.com/u/Shoe)\
**Post date:** [December 2, 2023, 8:10pm UTC](https://forums.pimoroni.com/t/oled-spi-sh1106-argument-error/23422/2 "2023-12-02T20:10:40Z")

</div>

Can you link the screen and code you’re using? At a glance I can’t see any Pimoroni display with that size/driver chip, so if that’s a Pimoroni script it might not be built to support other displays and drivers.

---

<div class="post-metadata">

**Author:** ![Richard238](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard238](https://forums.pimoroni.com/u/Richard238)\
**Post date:** [December 2, 2023, 9:52pm UTC](https://forums.pimoroni.com/t/oled-spi-sh1106-argument-error/23422/3 "2023-12-02T21:52:54Z")

</div>

Product is this [1.12" Mono OLED (128x128, white/black) Breakout - SPI](https://shop.pimoroni.com/products/1-12-oled-breakout?variant=12628508704851)  
_(Apologies for saying 1.2 OLED before.)_

Code would have been from wherever this link took me [GitHub - rm-hull/luma.oled: Python module to drive a SSD1306 / SSD1309 / SSD1322 / SSD1325 / SSD1327 / SSD1331 / SSD1351 / SH1106 OLED](https://github.com/rm-hull/luma.oled)  
I probably tied myself in knots there somewhere.

Thank you.

---

<div class="post-metadata">

**Author:** ![ahnlak](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/ahnlak/32/5610_2.png) [@ahnlak](https://forums.pimoroni.com/u/ahnlak)\
**Post date:** [December 3, 2023, 9:23am UTC](https://forums.pimoroni.com/t/oled-spi-sh1106-argument-error/23422/4 "2023-12-03T09:23:31Z")

</div>

Can’t spot that message anywhere _obvious_ in that repo, so I’m guessing you’ve followed a link to something that doesn’t support a SH1106 display.

Tricky to say much more without knowing what it _is_ that you’re running :-)

---

<div class="post-metadata">

**Author:** ![Shoe](https://avatars.discourse-cdn.com/v4/letter/s/e36b37/32.png) [@Shoe](https://forums.pimoroni.com/u/Shoe)\
**Post date:** [December 3, 2023, 11:06am UTC](https://forums.pimoroni.com/t/oled-spi-sh1106-argument-error/23422/5 "2023-12-03T11:06:53Z")

</div>

It looks like that might be trying to run using `luma.led_matrix`, rather than `luma.oled`, as the [matrix verison](https://github.com/rm-hull/luma.led_matrix/blob/master/luma/led_matrix/device.py) has a simlar list of supported devices.

As @ahnlak said, it’s really hard to know what’s going wrong here without the exact code.

---

<div class="post-metadata">

**Author:** ![Richard238](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard238](https://forums.pimoroni.com/u/Richard238)\
**Post date:** [December 3, 2023, 12:59pm UTC](https://forums.pimoroni.com/t/oled-spi-sh1106-argument-error/23422/6 "2023-12-03T12:59:42Z")

</div>

Trying to use the examples provided, e.g., bounce.py

```auto
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2014-18 Richard Hull and contributors
# See LICENSE.rst for details.
# PYTHON_ARGCOMPLETE_OK

"""
Display a bouncing ball animation and frames per second.
Attribution: https://github.com/rogerdahl/ssd1306/blob/master/examples/bounce.py
"""

import sys
import random
from demo_opts import get_device
import luma.core.render
from luma.core.sprite_system import framerate_regulator

class Ball(object):
    def __init__ (self, w, h, radius, color):
        self._w = w
        self._h = h
        self._radius = radius
        self._color = color
        self._x_speed = (random.random() - 0.5) * 10
        self._y_speed = (random.random() - 0.5) * 10
        self._x_pos = self._w / 2.0
        self._y_pos = self._h / 2.0

    def update_pos(self):
        if self._x_pos + self._radius > self._w:
            self._x_speed = -abs(self._x_speed)
        elif self._x_pos - self._radius < 0.0:
            self._x_speed = abs(self._x_speed)

        if self._y_pos + self._radius > self._h:
            self._y_speed = -abs(self._y_speed)
        elif self._y_pos - self._radius < 0.0:
            self._y_speed = abs(self._y_speed)

        self._x_pos += self._x_speed
        self._y_pos += self._y_speed

    def draw(self, canvas):
        canvas.ellipse((self._x_pos - self._radius, self._y_pos - self._radius,
                       self._x_pos + self._radius, self._y_pos + self._radius), fill=self._color)

def main(num_iterations=sys.maxsize):
    colors = ["red", "orange", "yellow", "green", "blue", "magenta"]
    balls = [Ball(device.width, device.height, i * 1.5, colors[i % 6]) for i in range(10)]
    frame_count = 0
    fps = ""
    canvas = luma.core.render.canvas(device)
    regulator = framerate_regulator(fps=0)
    while num_iterations > 0:
        with regulator:
            num_iterations -= 1

            frame_count += 1
            with canvas as c:
                c.rectangle(device.bounding_box, outline="white", fill="black")
                for b in balls:
                    b.update_pos()
                    b.draw(c)
                c.text((2, 0), fps, fill="white")

            if frame_count % 20 == 0:
                fps = "FPS: {0:0.3f}".format(regulator.effective_FPS())

if __name__ == ' __main__':
    try:
        device = get_device()
        main()
    except KeyboardInterrupt:
        pass

```

```auto
pi@raspberrypi:~/luma.examples/examples $ python3 bounce.py --display sh1106 --height 128 --rotate 2 --interface spi --gpio-data-command 9 --spi-device 1
usage: bounce.py [-h] [--config CONFIG] [--display DISPLAY] [--width WIDTH]
                 [--height HEIGHT] [--rotate ROTATION] [--interface INTERFACE]
                 [--i2c-port I2C_PORT] [--i2c-address I2C_ADDRESS]
                 [--spi-port SPI_PORT] [--spi-device SPI_DEVICE]
                 [--spi-bus-speed SPI_BUS_SPEED]
                 [--spi-transfer-size SPI_TRANSFER_SIZE]
                 [--spi-cs-high SPI_CS_HIGH] [--ftdi-device FTDI_DEVICE]
                 [--framebuffer-device FRAMEBUFFER_DEVICE] [--gpio GPIO]
                 [--gpio-mode GPIO_MODE]
                 [--gpio-data-command GPIO_DATA_COMMAND]
                 [--gpio-chip-select GPIO_CHIP_SELECT]
                 [--gpio-reset GPIO_RESET] [--gpio-backlight GPIO_BACKLIGHT]
                 [--gpio-reset-hold-time GPIO_RESET_HOLD_TIME]
                 [--gpio-reset-release-time GPIO_RESET_RELEASE_TIME]
                 [--block-orientation ORIENTATION] [--mode MODE]
                 [--framebuffer FRAMEBUFFER] [--num-segments NUM_SEGMENTS]
                 [--bgr] [--inverse] [--h-offset H_OFFSET]
                 [--v-offset V_OFFSET] [--backlight-active VALUE] [--debug]
bounce.py: error: argument --display/-d: invalid choice: 'sh1106' (choose from 'max7219', 'ws2812', 'neopixel', 'neosegment', 'apa102', 'unicornhathd', 'linux_framebuffer')

```

Or without the launch arguments/options,

```auto
pi@raspberrypi:~/luma.examples/examples $ python3 bounce.py

OSError: [Errno 121] Remote I/O error

```

Thank you.

---

<div class="post-metadata">

**Author:** ![ahnlak](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/ahnlak/32/5610_2.png) [@ahnlak](https://forums.pimoroni.com/u/ahnlak)\
**Post date:** [December 4, 2023, 10:59am UTC](https://forums.pimoroni.com/t/oled-spi-sh1106-argument-error/23422/7 "2023-12-04T10:59:10Z")

</div>

Well yes, but that still doesn’t tell us what you’ve actually installed, so we’re still guessing.

As @Shoe says above, it looks like you have the `led_matrix` drivers set up, which won’t drive a SH1106 display - you probably need `oled` drivers instead, it being an oled screen and all…

---

<div class="post-metadata">

**Author:** ![Richard238](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard238](https://forums.pimoroni.com/u/Richard238)\
**Post date:** [December 4, 2023, 11:44am UTC](https://forums.pimoroni.com/t/oled-spi-sh1106-argument-error/23422/8 "2023-12-04T11:44:29Z")

</div>

No idea to be perfectly honest. Thanks for all the help, I’m going to re-image the SD card and start again.
