I am trying to use an SH1106 OLED connected by I2C to a pyboard. The OLED is a 1.3" 128x64 module I purchased from amazon
(https://smile.amazon.com/gp/product/B07 ... UTF8&psc=1). I am using the driver I found at https://github.com/scy/SH1106. I am running a slightly modified version of the example code posted with the driver:
from machine import Pin, I2C
import sh1106
#
i2c = I2C(scl=Pin('X9'), sda=Pin('X10'), freq=400000)
display = sh1106.SH1106_I2C(128, 64, i2c, None, 0x3c)
display.sleep(False)
display.fill(0)
display.text('Testing 1', 0, 0, 1)
display.show()
When I run this, get the following error message:
Warning: I2C(-1, ...) is deprecated, use SoftI2C(...) instead
Traceback (most recent call last):
File "<stdin>", line 5, in <module>
File "sh1106.py", line 173, in __init__
File "sh1106.py", line 111, in __init__
File "sh1106.py", line 116, in init_display
File "sh1106.py", line 123, in poweron
File "sh1106.py", line 178, in write_cmd
OSError: [Errno 19] ENODEV
I get the same error if I used SoftI2C instead of the hardware I2C. I think the problem may be in the recent I2C implementation on the pyboard; I get a similar error when trying to use a ssd1306 on a different OLED. Any suggestions are welcome.
SH1106/I2C OLED driver on pyboard
Re: SH1106/I2C OLED driver on pyboard
The reason for a ENODEV error is usually a wiring or configuration problem. It's not the problem of the SH1106 driver or the way you instantiate the I2C object. PyBoard has pull-up resistors at the board. So it's not a problem of missing pull-up. Just to ask the obvious:
Did you connect all of GND, Vcc, SCL and SDA between PyBoard and the display?
After creating the I2C object, what is the result of i2c.scan(). It should return a list containing the I2C address as decimal number. If the list is empty, then it confirms a connection problem.
Did you connect all of GND, Vcc, SCL and SDA between PyBoard and the display?
After creating the I2C object, what is the result of i2c.scan(). It should return a list containing the I2C address as decimal number. If the list is empty, then it confirms a connection problem.
- douglas.young
- Posts: 3
- Joined: Thu Nov 12, 2020 3:16 am
Re: SH1106/I2C OLED driver on pyboard
Thank you for getting back to me. You were correct. The problem was with the power pins I had soldered to the pyboard. Once I plugged the OLED into power pins that were working the i2c scan found OLED and it worked fine. Your help and patient support are very much appreciated!
DTY
DTY