News How to Use an OLED Display With Raspberry Pi Pico

Aug 7, 2021
1
0
10
Hi,
I'm trying to copy your example, but I can't get the oled display to work, I've tried several libraries, including the one you propose, but always in all cases it throws me this error:

The error is thrown at me whenever I try to instantiate the SSD1306_I2C object

This is my simple code

Python:
from machine import Pin, I2C
from time    import sleep_ms
from ssd1306 import SSD1306_I2C

import framebuf

ANCHO = 128
ALTO  = 64

PinSDA  = Pin(0)
PinSCL  = Pin(1)
Address = 0x3C

i2c =I2C(0, sda=PinSDA, scl=PinSCL, freq=400000)
sleep_ms(100)

oled = SSD1306_I2C(ANCHO, ALTO, i2c)

This is the error that it returns to me

Code:
>>> %Run -c $EDITOR_CONTENT
Traceback (most recent call last):
  File "<stdin>", line 17, in <module>
  File "/lib/ssd1306.py", line 110, in __init__
  File "/lib/ssd1306.py", line 36, in __init__
  File "/lib/ssd1306.py", line 73, in init_display
  File "/lib/ssd1306.py", line 101, in show
  File "/lib/ssd1306.py", line 119, in write_data
OSError: [Errno 5] EIO
>>>
Could you help me by indicating what the problem would be?
From already thank you very much
 
Aug 27, 2021
1
0
10
I had the same problem and error message. I think there may have been some problem with the ssd1306.py program that was downloaded from PyPl
I had downloaded that program from the micropython website and didn't have an issue.
When I replaced it with the one from PyPl the errors showed up.

My question is how can we enlarge the text?
I want to display temperature and want the 128 x 64 OLED to display 2 large numbers so that it is easier to read.
I'm not sure how to change the font size in this software?
Thanks,
Robin
 
Oct 16, 2021
1
0
10
When I try to install the micropython-ssd1306 library I get the following error:

ERROR: Could not find a version that satisfies the requirement micropython-ssd1306
ERROR: No matching distribution found for micropython-ssd1306
Process returned with code 1

any idea on how to fix this?
 
Feb 7, 2022
1
0
10
HI, thanks for the tutorial.
The i2c port in micropython needs a slight delay before it sends data, to fix the
OSError: [Errno 5] EIO
import utime , then add utime.sleep(100) after the i2c initialisation i2c = I2C...
 
Mar 5, 2023
1
0
10
OLED displays are a cost effective way to add small text output to a project. They are super small but with a bright and clear display.

How to Use an OLED Display With Raspberry Pi Pico : Read more
Thanks for your example, it worked really well for me with some simple changes to work with the SPI version of the display that I have.

Code:
from machine import SPI, Pin
from ssd1306 import SSD1306_SPI
import framebuf

# Assign chip select (CS) pin
cs = machine.Pin(16, machine.Pin.OUT)
dc = machine.Pin(20, machine.Pin.OUT)
res = machine.Pin(21, machine.Pin.OUT)

# Initialize SPI
spi = machine.SPI(0,
                  baudrate=10000000,
                  polarity=1,
                  phase=1,
                  bits=8,
                  firstbit=machine.SPI.MSB,
                  sck=machine.Pin(18),
                  mosi=machine.Pin(19))

oled = SSD1306_SPI(128, 64, spi, dc, res, cs)

while True:
 .............as per your example.