Esp 8266 with ssd1306 no wifi

Hi, not an expert at these things so bare with me.

a generic 8266 board from Ebay and a ssd1306 screen. Using the code on the esp website I have managed to get it working. However, when I use 3.3v from the 8266 to the screen the screen doesn’t work, logs find device at 0x3c but wont communicate to it.

Power the screen with 5v then the screen works as expected but the 8266 wont connect to HA or the network. the wifi stops working.

Tried a different usb cable and power source and manual ip.

Could anyone help please? If you need any further info (logs etc) then let me know which ones.

Thanks
Russ

Well, your display should work with 3,3V according to the adapfriut datasheet and the ESPHome website, so you might perhaps have some wirering issues.
My ESP’s sometimes show the “I’m not connecting to HA” issue when tinkering and having a value that is polled very frequent. It seems that some quickly updated sensors/information can disturb the WLan connection. This is a very rough observation and not a scientifically prooven fact :wink:

Ok thanks.

I have used the generic code on the Esphome webpage so it looks for time and two entities which dont exists for me.
So From your reply I shall Change this and get it to print hello world or something and go from there.

Thanks for your input.
Russ

May you please share wiring of your ESP/ssd ? and your ESPHome code ?

esphome:
  name: marine_temp_water
  platform: ESP8266
  board: d1_mini

wifi:
  ssid: "yo"
  password: "yo-yo"

  manual_ip:
    static_ip: 192.168.50.247
    gateway: 10.0.0.1
    subnet: 255.255.255.0
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Marine Temp Water"
    password: "yoyo"

captive_portal:

# Enable logging
logger:
  level: VERY_VERBOSE
# Enable Home Assistant API
api:

ota:

#time:
 # - platform: homeassistant
  #  id: esptime
    
#sensor:
#  - platform: homeassistant
#    id: inside_temperature
#    entity_id: sensor.mellanvaning_temperature
#    internal: true

#  - platform: homeassistant
#    id: outside_temperature
#    entity_id: sensor.10_00080192969d_temperature
#    internal: true
    
font:
  - file: 'slkscr.ttf'
    id: font1
    size: 8

#  - file: 'BebasNeue-Regular.ttf'
#    id: font2
#    size: 48
#
#  - file: 'arial.ttf'
#    id: font3
#    size: 14
    
i2c:
  sda: D1
  scl: D2
  scan: true

display:
  - platform: ssd1306_i2c
    model: "SH1106 128x64"
    reset_pin: D0
    address: 0x3C
    lambda: |-
      // Print "Mitt Smarta Hus" in top center.
      it.printf(64, 0, id(font1), TextAlign::TOP_CENTER, "Mitt Smarta Hus");

 #     // Print time in HH:MM format
#      it.strftime(0, 60, id(font2), TextAlign::BASELINE_LEFT, "%H:%M", id(esptime).now());
#
#      // Print inside temperature (from homeassistant sensor)
#      if (id(inside_temperature).has_state()) {
#        it.printf(127, 23, id(font3), TextAlign::TOP_RIGHT , "%.1f°", id(inside_temperature).state);
#      }
#
#      // Print outside temperature (from homeassistant sensor)
#      if (id(outside_temperature).has_state()) {
#        it.printf(127, 60, id(font3), TextAlign::BASELINE_RIGHT , "%.1f°", id(outside_temperature).state);
#      }

OK thanks… the code is what’s running at the moment and the picture attached shows the results and wiring.

Its not talking to HA and red on the ESPHome integration page. the logs show no connection, and no connection on network. If I add time back into yaml it just runs from 00:00.

Thanks
Russ

So the wiring seems ok. Maybe we go a step back. If you comment all display related code and the manual IP code:

  manual_ip:
    static_ip: 192.168.50.247
    gateway: 10.0.0.1
    subnet: 255.255.255.0
  # Enable fallback hotspot (captive portal) in case wifi connection fails

The ESP should just fine talk to HA. If this is established, uncomment the display code.

Might be getting somewhere.

commented out the, manual ip, all the display lines and the text lines.

Power still set to 3.3v and its connected to network and HA - which didn’t previously.

The logs have now lost the “can’t communicate device error”

Switched power to 5v and I get the same, (ie connected to ha and wifi).

So its the yaml code, I wonder of the device type is correct. Have tried ssh1306 and sh1106. This is the Ebay item number for the display. 392911521357 (Ebay uk).

Thanks for you help its much appreciated.

Russ

To my understanding, SSD1306 should work just fine. Please try the following:

  • unpower the ESP
  • go to ESPHome and your configuration, it should have a “show log” button. Press it
  • power the ESP

after some time you should see the logs rushing trough. We are searching for the I2C debug outputs. Here it should show something like “I found one i2c client with adress xxx”

Check if the adress corrosponds to your adress in your code.
Also please comment the “reset_pin” line. This is optional and since you are not having one of those, this might confuse the code or the user :wink:

There is currently a post on Reddit about knockoff/clone Wemos D1 Mini boards, and many of them have a lower-current power regulator installed. If yours has this, it may be the power supplied is not sufficient to power both the display and the wifi simultaneously.

I will look at making the suggestion tomorrow now.

The post on Reddit… thanks. I appear not to have that one. from that site there is link in Lolin. I appear to have that one but no logo. Incidentally I have tried this board with a Dallas thermometer and a ph sensor with limited luck on the temp and no luck on the ph.

thanks
Russ

Careful also of your network configuration that is non-sense !! You can’t get gw in 10.0.0.1 with device IP in 192.168.50.X. …

1 Like

Are you sure that is right? The GPIO page tells me it is around the other way

|D1|GPIO5|OK|OK|often used as SCL (I2C)|

|D2|GPIO4|OK|OK|often used as SDA (I2C)|

I just met same (?) problem, and the search engine guided me to this topic. Unfortunately, not the answer could solve my headache.

problem:

  • esp-01s with ssd1306, if only text displayed, no problem. if little picture used, can’t connect to wifi! logs:

[I][wifi:235]: WiFi Connecting to ‘xxxxxx’…
[W][wifi_esp8266:444]: Event: Disconnected ssid=‘xxxxxx’ bssid=xx:xx:xx:xx:xx:xx reason=‘Auth Expired’
[W][wifi:532]: Error while connecting to network.
[W][wifi:570]: Restarting WiFi adapter…

endless repeat, while the display got on and normal.

And finally, I found the solution, with a seldom introduced option: setup_priority.
put setup_priority: -100 under i2c and display, like this:

i2c:
  sda: 0
  scl: 2
  scan: false
  setup_priority: -100
display:
  - platform: ssd1306_i2c
    model: "SSD1306 128x64"
    id: ssd1306
    setup_priority: -100

then everything works fine!

10 Likes

After spending MANY hours with exactly the same problem (WiFi + SSD1306 display = No WiFi connection), I found this solution from XCray.
With the setup_priority option included (as the above XCray suggestion), everything works just fine ( WiFi + SSD1306 display = No WiFi connect problems !!)…
Thank you XCray for sharing this information !!!

2 Likes

I just started out to tinkering around with the ESP Home stuff. I didn’t have expericend any connections issues with the ArduinoIDE way of things. As switched to ESP Home the WIFI connection issues immediately started if a SSD1306 display was connected. Eventuelly wifi started to work after 5 to 15 min. But totally unreliable. When disconnecting vcc from the display connection, wifi immediately started to work as it should.

Spending hours finding a solution, sadly this post didn’t come up earlier in my search results as it should. setup_priority: -100 fixed it for me too, so also many thanks to Xray for sharing this information !!!

Hello,

doesnt work for me.

related to https://github.com/esphome/issues/issues/1920#issuecomment-803429566

add

update_interval: 10s

in the display: config works.

I have already set

interval:
  - interval: 10s
    then:
      - display.page.show_next: my_display_bureau
      - component.update: my_display_bureau

but seems to not be enough and the

update_interval: 10s

make it work for me.

This helped in my case:

AWESOME catch @XCray. Have been struggling with this for a while. Was seeing the i2C initializing before WIFI and was figuring this was the issue but could not find how to prioritize loading of modules. Interesting that this was not needed in previous instances of ESPHome as this happened a year after this code had been working when I made some changes.

Thanks A Million for sharing this.

Amazing. Thanks @XCray. I have been banging my head against the wall trying to figure this out. I believe there is some kind of a bug as I found this while searching for the fix.