I have an Adafruit FeatherWing - 128x64 OLED https://www.adafruit.com/product/4650 that has been very temperamental in turning on. It started out ok but now I have to power cycle the board 10-15x to get it to turn on despite none of the CircuitPython code having been changed since it was working properly.
Any suggestions on what I can do to resolve this issue?
FeatherWing OLED 128x64 - Won't turn on consistently
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- Aston01
- Posts: 7
- Joined: Wed Mar 02, 2022 1:09 pm
- adafruit_support_carter
- Posts: 29189
- Joined: Tue Nov 29, 2016 2:45 pm
Re: FeatherWing OLED 128x64 - Won't turn on consistently
Please post a photo of your setup so we can look for any obvious hardware issues.
What code is being run? Can you link to it or provide complete code listing? We'll take a look for any possible software related issues as well.
What code is being run? Can you link to it or provide complete code listing? We'll take a look for any possible software related issues as well.
- Aston01
- Posts: 7
- Joined: Wed Mar 02, 2022 1:09 pm
Re: FeatherWing OLED 128x64 - Won't turn on consistently
adafruit_support_carter wrote:Please post a photo of your setup so we can look for any obvious hardware issues.
What code is being run? Can you link to it or provide complete code listing? We'll take a look for any possible software related issues as well.
Code: Select all
import board
import time
import displayio
import terminalio
from adafruit_display_text import label
import adafruit_displayio_sh1107
import adafruit_scd4x
UPDATE_RATE = 1
displayio.release_displays()
# oled_reset = board.D9
# Use for I2C
i2c = board.I2C()
display_bus = displayio.I2CDisplay(i2c, device_address=0x3C)
scd4x = adafruit_scd4x.SCD4X(i2c)
# SH1107 is vertically oriented 64x128
WIDTH = 128
HEIGHT = 64
BORDER = 2
display = adafruit_displayio_sh1107.SH1107(
display_bus, width=WIDTH, height=HEIGHT, rotation=0
)
# Make the display context
splash = displayio.Group()
display.show(splash)
color_bitmap = displayio.Bitmap(WIDTH, HEIGHT, 1)
color_palette = displayio.Palette(1)
color_palette[0] = 0x000000 # Black
bg_sprite = displayio.TileGrid(color_bitmap, pixel_shader=color_palette, x=0, y=0)
splash.append(bg_sprite)
# Draw place holder label text
co2 = label.Label(terminalio.FONT, text="CO2:", color=0xFFFFFF, x=8, y=10)
splash.append(co2)
temperature = label.Label(terminalio.FONT, text="Temp:", color=0xFFFFFF, x=8, y=25)
splash.append(temperature)
humidity = label.Label(terminalio.FONT, text="Humidity:", color=0xFFFFFF, x=8, y=40)
splash.append(humidity)
scd4x.start_periodic_measurement()
def update_display(co2_value, temp_value, hum_value):
co2.text = "CO2: %d ppm" % scd4x.CO2
temperature.text = "Temperature: %0.1f *F" % temp
humidity.text = "Humidity: %0.1f %%" % scd4x.relative_humidity
while True:
if scd4x.data_ready:
temp = (scd4x.temperature * 1.8) + 32
update_display(scd4x.CO2, temp, scd4x.relative_humidity)
print(scd4x.CO2)
else:
pass
time.sleep(UPDATE_RATE)
- adafruit_support_carter
- Posts: 29189
- Joined: Tue Nov 29, 2016 2:45 pm
Re: FeatherWing OLED 128x64 - Won't turn on consistently
It may be related to reset behavior. Since you are not using the FeatherWing with a Feather main board, and only via a STEMMA QT cable, the OLED reset is not being handled as expected. If you press the RST button on the OLED and then press reset on the Metro (so code restarts), does that help?
- Aston01
- Posts: 7
- Joined: Wed Mar 02, 2022 1:09 pm
Re: FeatherWing OLED 128x64 - Won't turn on consistently
Yes, that does it.adafruit_support_carter wrote:It may be related to reset behavior. Since you are not using the FeatherWing with a Feather main board, and only via a STEMMA QT cable, the OLED reset is not being handled as expected. If you press the RST button on the OLED and then press reset on the Metro (so code restarts), does that help?
Any suggestions on how I should change the code?
- adafruit_support_carter
- Posts: 29189
- Joined: Tue Nov 29, 2016 2:45 pm
Re: FeatherWing OLED 128x64 - Won't turn on consistently
This is more of a hardware issue than a software issue.
Power cycling your entire setup should also work. There's a reset circuit that will reset the OLED after a brief period on initial power up. Add a delay (try 300ms) in your code before attempting to talk to the OLED. That way your code will wait for the reset to finish before initializing the display.
The other option would be to actually wire the RST pin back to the Metro. That's a bit clunky, since it would require an additional wire. But that way you could manually reset the OLED anytime in your code, via a simple digital pin toggle. That would allow recovering from any weird state that may occur at runtime and resetting without needing to power cycle.
Power cycling your entire setup should also work. There's a reset circuit that will reset the OLED after a brief period on initial power up. Add a delay (try 300ms) in your code before attempting to talk to the OLED. That way your code will wait for the reset to finish before initializing the display.
The other option would be to actually wire the RST pin back to the Metro. That's a bit clunky, since it would require an additional wire. But that way you could manually reset the OLED anytime in your code, via a simple digital pin toggle. That would allow recovering from any weird state that may occur at runtime and resetting without needing to power cycle.
- Aston01
- Posts: 7
- Joined: Wed Mar 02, 2022 1:09 pm
Re: FeatherWing OLED 128x64 - Won't turn on consistently
I tried something like this with a delay like suggested and it worked for a week or so with repeated power cycling, but then just stopped working.adafruit_support_carter wrote: ↑Thu Aug 04, 2022 10:51 am This is more of a hardware issue than a software issue.
Power cycling your entire setup should also work. There's a reset circuit that will reset the OLED after a brief period on initial power up. Add a delay (try 300ms) in your code before attempting to talk to the OLED. That way your code will wait for the reset to finish before initializing the display.
Are there any obvious coding issues I am missing or are we just going to have to chalk this one up to hardware?
Code: Select all
import board
import time
import displayio
import terminalio
from adafruit_display_text import label
import adafruit_displayio_sh1107
import adafruit_scd4x
UPDATE_RATE = 1
displayio.release_displays()
# oled_reset = board.D9
# Use for I2C
i2c = board.I2C()
display_bus = displayio.I2CDisplay(i2c, device_address=0x3C)
scd4x = adafruit_scd4x.SCD4X(i2c)
# SH1107 is vertically oriented 64x128
WIDTH = 128
HEIGHT = 64
BORDER = 2
display = adafruit_displayio_sh1107.SH1107(
display_bus, width=WIDTH, height=HEIGHT, rotation=0
)
# Make the display context
splash = displayio.Group()
display.show(splash)
color_bitmap = displayio.Bitmap(WIDTH, HEIGHT, 1)
color_palette = displayio.Palette(1)
color_palette[0] = 0x000000 # Black
bg_sprite = displayio.TileGrid(color_bitmap, pixel_shader=color_palette, x=0, y=0)
splash.append(bg_sprite)
# Draw place holder label text
co2 = label.Label(terminalio.FONT, text="CO2:", color=0xFFFFFF, x=8, y=10)
splash.append(co2)
temperature = label.Label(terminalio.FONT, text="Temp:", color=0xFFFFFF, x=8, y=25)
splash.append(temperature)
humidity = label.Label(terminalio.FONT, text="Humidity:", color=0xFFFFFF, x=8, y=40)
splash.append(humidity)
scd4x.start_periodic_measurement()
time.sleep(0.3)
def update_display(co2_value, temp_value, hum_value):
co2.text = "CO2: %d ppm" % scd4x.CO2
temperature.text = "Temperature: %0.1f *F" % temp
humidity.text = "Humidity: %0.1f %%" % scd4x.relative_humidity
while True:
if scd4x.data_ready:
temp = (scd4x.temperature * 1.8) + 32
update_display(scd4x.CO2, temp, scd4x.relative_humidity)
print(scd4x.CO2)
else:
pass
time.sleep(UPDATE_RATE)
- adafruit_support_carter
- Posts: 29189
- Joined: Tue Nov 29, 2016 2:45 pm
Re: FeatherWing OLED 128x64 - Won't turn on consistently
Try moving the delay line up further in the code. Try putting it right after all the imports.
Code: Select all
import adafruit_displayio_sh1107
import adafruit_scd4x
# wait for OLED reset
time.sleep(0.3)
UPDATE_RATE = 1
- Aston01
- Posts: 7
- Joined: Wed Mar 02, 2022 1:09 pm
Re: FeatherWing OLED 128x64 - Won't turn on consistently
Updated the code as suggested and it will flash this screen (without displaying the values) and go black again.
- adafruit_support_carter
- Posts: 29189
- Joined: Tue Nov 29, 2016 2:45 pm
Re: FeatherWing OLED 128x64 - Won't turn on consistently
Hmm...seems like maybe some other software thing. To get that output, the OLED seems to be working OK.
Do you know how to connect to the serial output? So you can see the print statements like this:
Do you know how to connect to the serial output? So you can see the print statements like this:
Code: Select all
print(scd4x.CO2)
- Aston01
- Posts: 7
- Joined: Wed Mar 02, 2022 1:09 pm
Re: FeatherWing OLED 128x64 - Won't turn on consistently
Yes, the sensor prints values without issue. The issue seems to be mainly around getting those results to display on the screen.adafruit_support_carter wrote: ↑Thu Sep 08, 2022 2:39 pm Hmm...seems like maybe some other software thing. To get that output, the OLED seems to be working OK.
Do you know how to connect to the serial output? So you can see the print statements like this:Code: Select all
print(scd4x.CO2)
- adafruit_support_carter
- Posts: 29189
- Joined: Tue Nov 29, 2016 2:45 pm
Re: FeatherWing OLED 128x64 - Won't turn on consistently
Try changing your update_display() function to this:
Code: Select all
def update_display(co2_value, temp_value, hum_value):
print("update_display: ", co2_value, temp_value, hum_value)
co2.text = "CO2: {}".format(co2_value)
temperature.text = "Temperature: {} *F".format(temp_value)
humidity.text = "Humidity: {} %".format(hum_value)
- Aston01
- Posts: 7
- Joined: Wed Mar 02, 2022 1:09 pm
Re: FeatherWing OLED 128x64 - Won't turn on consistently
Prints as expected, but the screen itself is still black 🤷♂️
- adafruit_support_carter
- Posts: 29189
- Joined: Tue Nov 29, 2016 2:45 pm
Re: FeatherWing OLED 128x64 - Won't turn on consistently
You don't even see this anymore when running the code?
Screen is always blank?
Screen shows something then turns blank?
Screen shows something but it never changes?
At this point, it's confusing what the actual behavior is.Screen is always blank?
Screen shows something then turns blank?
Screen shows something but it never changes?
Please be positive and constructive with your questions and comments.