ESP8266 and HW-364A display

Hey everyone!

I’ve learned a lot from this community, so I thought I’d share something I put together.

I recently picked up a NodeMCU ESP8266 Development Board with a 0.96-inch OLED display—a totally impulsive buy since I had no idea what to do with it. :sweat_smile: After some experimenting, I managed to get it working like this:



If anyone’s interested, here’s the key part of the code:

# I2C Configuration for HW364A OLED
i2c:
  sda: GPIO14
  scl: GPIO12
  scan: true # Enable to detect I2C devices
  frequency: 400kHz

# OLED Display Configuration
display:
  - platform: ssd1306_i2c
    model: "SSD1306 128X64" # Adjust if your display has a different resolution
    address: 0x3C
    id: hw364a_display
    pages:
      - id: page1
        lambda: |-
          it.print(0, 0, id(gfont_font), "Hello, World!");

That’s it! To be honest, I’m still not sure what else I can do with this display. Any ideas? :smiley:

1 Like

can you post the rest of the code? I’m still figuring out YAML configurations, and an entire dump of your YAML minus any PII would be helpful. I posted some questions, edited it now after having spent a bunch of time learning about lambda and fonts. Despite spending time reading about fonts I still cant get a font to work - fails write due to config issue / syntax err. Also, whatever you put in your other pages too, having the ability to copy paste what’s needed and maintain whitespace would be helpful.

Hey. I just want to say thanks. I too bought one of these not knowing what I’d do with it. And when I finally got around to it and searched I only found one other person asking about it… and the reply was not at all helpful (bordering on rude).

Your post and YAML got me on the way.

Notes for future readers:

  • The display is 128 x 64 pixels
  • The top 16 pixels (0-15) of the display are yellow
  • The lower 48 (16-63) are blue
  • there is a small gap between the yellow and blue. So it’s best to keep anything you are displaying either fully above or below that line

If you need YAML to get you going the original above was enough for me. But if you want a more complete

esphome:
  name: espwdisplay
  friendly_name: espwdisplay

esp8266:
  board: esp01_1m

# Enable logging
logger:

i2c:
  sda: GPIO14
  scl: GPIO12
  scan: true # Enable to detect I2C devices
  frequency: 400kHz

font:
  - file: "RobotoMono-Thin.ttf"
    id: font8
    size: 8

# OLED Display Configuration
display:
  - platform: ssd1306_i2c
    model: "SSD1306 128X64" # Adjust if your display has a different resolution
    address: 0x3C
    id: hw364a_display
    lambda: |-
      it.printf(64, 0, id(font8), TextAlign::TOP_CENTER, "Hello world");

      it.line(0, 0, 128, 64);
      it.line(0, 64, 128, 0);

      it.line(0, 15, 128, 15 );
      it.line(0, 16, 128, 16 );


# Enable Home Assistant API
api:
  encryption:
    key: "replaceme"

ota:
  - platform: esphome
    password: "replaceme"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Espwdisplay Fallback Hotspot"
    password: ""

captive_portal:
    

glad you found the answer you were seeking

That got me curious, since I have found this forum to generally be a friendly place.

I believe this is the post you considered borderline rude.

The fact that link is so ugly and the OP followed none of the guidelines for writing a good post/question and then didn’t follow up and try again leads me to see it in a different light.

I take the time to answer many posts. I do it because I like the challenge and it forces me to learn esphome better in order to be able to explain it to someone else. The original post you referenced made it incredibly hard to answer. Someone trying to help asked for the OP to respect the community enough to ask a good/answerable question. I have seen this play out differently dozen of times over the last few months.

Most people realize that the question they were asking was not that clear and try again using what they learn from the how to ask a good question post. They then get an answer to their question. The other thing I have seen is people just don’t respond for unknown reasons.

1 Like

If indeed that was the post, I was quite prepared to help them but they needed to help us first by posting the question in a way that was easy to understand. Like both posts here that are well formatted and easy to comprehend.

Also looking at their post history they did not follow up any of their questions when others tried to help them.

2 Likes

I was talking about the post “ESPHome with DHT22 and 128x32 OLED Display” that the replier basically told the poster to go read the docs.

okay, I can see how someone could be intimidated from that thread, though it did end in success.

I am a trained professional and I have complaints about the esphome documentation (as a trained professional I am used to dealing with less than great documentation and know how to figure things out). So far I have not attempted to make the documentation better, but might at some point.

That is one of the “problems” with esphome. It makes some things so easy, people think you don’t really need to know anything to use it. For many things this is likely true, you can install it and it just works.

But, I have been hanging around here long enough to see that is not the case for many things. Sometimes it really is as simple as someone missed adding a single line that is clearly in the example in the documentation. I know there have been times where I have needed another pair of eyes to see the error that is plainly right there.

Other times, the example in the documentation covers the topic, but not ALL of what you need to know to use it correctly. This is why I look deeper to find multiple examples to find what I am missing.

This is why it is also great when people respond with what worked for them. It can really help someone else in the future with a similar problem.

Sometimes when the case IS decently documented and replier sees that one didn’t bother to read the documentation at all, that kind of reply is correct to my opinion.