New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for SH1107 #2913
Comments
I encountered similar problems, and decided to compare esphome/esphome#2967 to working examples (1 2), and to the chipset datasheet. Findings:
Notes regarding Adafruit module specifically:
I have rolled up all the fixes into https://github.com/nikitakuklev/esphome/tree/sh1107_fix, and it works with the following config:
Will submit a PR, but first some independent testing would be appreciated (above config will pull the corrected files). You should see a circle moving across the screen. |
I can confirm, it fixed the problem. Thanks a loot! |
I can also confirm, it works. Thanks |
Cool! Is this fix only for I2C? What about SPI OLED's? For me it's not working... only a small part of the screen. [17:37:11][C][logger:233]: Logger:
[17:37:11][C][logger:234]: Level: DEBUG
[17:37:11][C][logger:235]: Log Baud Rate: 115200
[17:37:11][C][logger:236]: Hardware UART: UART0
[17:37:11][C][spi:097]: SPI bus:
[17:37:11][C][spi:098]: CLK Pin: GPIO18
[17:37:11][C][spi:100]: MOSI Pin: GPIO23
[17:37:11][C][spi:102]: Using HW SPI: YES
[17:37:12][C][uptime.sensor:031]: Uptime Sensor 'Uptime Sensor'
[17:37:12][C][uptime.sensor:031]: State Class: 'total_increasing'
[17:37:12][C][uptime.sensor:031]: Unit of Measurement: 's'
[17:37:12][C][uptime.sensor:031]: Accuracy Decimals: 0
[17:37:12][C][uptime.sensor:031]: Icon: 'mdi:timer-outline'
[17:37:12][C][ssd1306_spi:019]: SPI SSD1306
[17:37:12][C][ssd1306_spi:019]: Rotations: 90 °
[17:37:12][C][ssd1306_spi:019]: Dimensions: 128px x 64px
[17:37:12][C][ssd1306_spi:020]: Model: SH1107 128x64
[17:37:12][C][ssd1306_spi:021]: CS Pin: GPIO14
[17:37:12][C][ssd1306_spi:022]: DC Pin: GPIO27
[17:37:12][C][ssd1306_spi:023]: Reset Pin: GPIO33
[17:37:12][C][ssd1306_spi:024]: External VCC: YES
[17:37:12][C][ssd1306_spi:025]: Flip X: NO
[17:37:12][C][ssd1306_spi:026]: Flip Y: NO
[17:37:12][C][ssd1306_spi:027]: Offset X: 0
[17:37:12][C][ssd1306_spi:028]: Offset Y: 96
[17:37:12][C][ssd1306_spi:029]: Inverted Color: NO
[17:37:12][C][ssd1306_spi:030]: Update Interval: 1.0s
[17:37:12][C][web_server:162]: Web Server:
[17:37:12][C][web_server:163]: Address: m5stack_hass.local:80
[17:37:12][D][sensor:113]: 'Uptime Sensor': Sending state 5.93100 s with 0 decimals of accuracy Config: display:
- platform: ssd1306_spi
model: 'SH1107_128x64'
rotation: 90
flip_x: false
flip_y: false
offset_y: 96
offset_x: 0
reset_pin: 33
external_vcc: true
cs_pin: 14
dc_pin: 27
lambda: |-
it.line(0, 0, 128, 64);
it.rectangle(5, 5, 10, 10);
it.circle(118, 54, 5);
it.rectangle(0, 0, 128, 64);
it.filled_circle(((int)id(uptime_sensor).state)*10 % 128, it.get_height() / 2, 10); |
What hardware are you using? Link to product? |
Old version of M5 Stick: https://docs.m5stack.com/en/core/m5stick It uses: OLED Screen 1.3 inch, 64 x 128, SH1107 |
Looks like the SPI implementation needs an small update. If you are lucky, perhaps @nikitakuklev can fix in the branch. |
I don't have a SPI module to test, so just copied I2C changes into SPI component. @rpaludo, can you see if these work? You will need to modify config to include:
|
All right! It worked like a charm. Thanks @nikitakuklev and @jenscski. |
Which YAML editor are you using? This probably happens because there is a change in the external_components library. |
It's the default editor that pops up when you click the "EDIT" button in ESPHome inside of Home Assistant. I'm using ESPHome version 2022.1.2, with Home Assistant version 2021.12.10 Interesting, I went back to get another screenshot and now the red x is gone. I had saved/closed the editor multiple times while changing the lambda around and the red x stayed there. I think doing a new browser window may have fixed it? Probably safe to disregard that issue, everything is working great for me so far. |
The red x issue was probably due it not fetching files before first compilation - part of patch changes offset limits (it was -32 to 32 before). I came upon another issue with Adafruit module specifically - when using I2C connector, it sometime takes several tries to get the screen working from a cold power up. I suspect it has something to do with SH1107 power-up sequence requirements, the APX803 reset circuit on OLED board (150ms delay from power on before SH1107 is released from reset), and lack of direct reset pin control (unlike in case of soldered shield). The issue seems random, and was not fixable with artificial command delays/slow I2C frequency. A viable but ugly fix was adding:
However, since things work for everyone else it is prudent to proceed - will make a pull request on the weekend. |
Has this been fixed? Planning to buy a SH1107 display. |
@nikitakuklev Where you able to submit your fixes to the main repo? I am trying to get the M5Stack OLED SH1107 working. It's I2C. |
@nstrelow I am trying to get the M5 Stack SH1107 OLED display but all I get is the random dots all over. I tried a few of the code sample above but it doesn't even compile. Should it work or is it not fully supported yet? Based on this https://esphome.io/components/display/ssd1306.html?highlight=sh1107 I thought it would work. |
@alexruffell I couldn't get it working, the M5 display works a bit different apparently. |
That is weird - is anything different between above M5 stick that was reported as working and yours? Different revision? I will rebase my patches as potential fix, but won't have time for proper pull request until a few week from now. |
@nikitakuklev At the web page provided by @nstrelow ( https://docs.m5stack.com/en/unit/oled ) there are schematics, a library and code samples but none for ESP. Maybe those may help. |
@nikitakuklev I haven't tried your fix for the Adafruit module, maybe that works. It'll try at some point. One thing that definitly didn't work, was the |
Ok, I can set the But I get the following error on compile on the newest esphome.
|
I've done a rebase on the current esphome dev branch, with a couple of additional quick fixes. It's available here: https://github.com/bekriebel/esphome/tree/sh1107_fix. This is working for me, but I'm seeing the initial startup issue sometimes occurring. The |
@bekriebel Awesome I am FINALLY seeing something on my screen. Thanks so much 🥳 |
Thank you to nikitakuklev and bekriebel; your fixes did the trick for me |
I finally got my M5 Stack SH1107 display to work! Thank you! This is the code I had to use, note the
EDIT: Is there any chance this fix will make it to the standard distribution of esphome? |
Also got a 128x128 SH1107 display working with this fix. Thank you @nikitakuklev and @bekriebel! :) Only had to include a few small tweaks to the code to add Here is the config used.
BTW, display tested is from TZT 1.5 inch OLED 4pin. In the back it reads Following @alexruffell comment, maybe the whole fix could make it to esphome repo. |
Has anyone tried to use this with PicoW? |
@bekriebel and @nikitakuklev confirming this (rebased) fix works with ESPHome 2023.5.5 on a FeatherS2 with FeatherWing OLED - 128x64. Please make a PR to the main ESPHome repo for this. |
@bekriebel @jacobparra @nikitakuklev this patch broke today with the release of ESPHome 2023.6.0. |
Definitely Broken! See the attached image...
|
Ok, fixed in esphome/esphome#4991 external_components:
- source: github://pr#4991
components: [ display ] |
Hopefully that PR fixes things, but if not, a somber promise to submit a proper fix in two weeks. I will finally again have access to test in hardware (after breaking my previous feather...water 'accident'). For now, one can manually merge both patches? |
Yes. |
@nagyrobi - Just confirming the fix worked on a couple systems I have with the following display:
Thanks! |
Well I assume PR#4991 will be soon merged and released in an upcoming bugfix release. But how about the fixes from this thread? Why none of the authors want to make a proper PR for it? |
All working again on my devices. Thanks guys |
Can someone post the currently working yaml? I'm still getting the static on my display (using a esp32-s2 feather). |
I managed to get this working with the following configuration: `external_components:
font:
display:
I'd love to not be relying on some external patches to get this working, but I don't know if those patches are ever going to make it in, since the changes were apparently 2 years ago on that fork. |
I had also bought the U119 M5Stack Display SH1107 because according to ESPHOME it should be supported. I was taught better and ended up here. Only white noise... I can't get it to work, the available fixes (e.g. @jenscski ) doesn't seem to work with the current Esphome version. As asked bevor by @alexruffell : Is there any chance this fix will make it to the standard distribution of esphome? |
I have rebased my branch (github://nikitakuklev/esphome@sh1107_fix) to latest dev and am currently testing. Some stuff seems broken as you note, fix tbd. |
Issue appears to be related to esphome/esphome#5002. It is necessary to switch to dev version, then current branch works. For HA users, just install ESPHome dev add-on and make sure to set refresh low:
If someone else can confirm everything works, will make a PR at long last. |
The problem
I was looking for support for the SH1107 OLED driver, and found a merged PR esphome/esphome#2967, which actually was testing on the same HW I was searching for support on, the Adafruit FeatherWing OLED - 128x64 OLED.
But I was unable to make it work, the display is only showing white noise.
I have supplied my full config.yaml, and I'm using the example from the PR
Which version of ESPHome has the issue?
Version: 2022.1.0-dev
What type of installation are you using?
pip
Which version of Home Assistant has the issue?
No response
What platform are you using?
ESP32
Board
featheresp32
Component causing the issue
ssd1306_i2c
Example YAML snippet
Anything in the logs that might be useful for us?
Additional information
No response
The text was updated successfully, but these errors were encountered: