Heltec Wireless Paper V1.1 for Esphome

Im tryting to make Heltec Wireless Paper working with ESPHome for home assistant. I’m using codes from this reddit thread

The following code compiles, it connects to Wifi and MQTT, however the eink paper does not update. Need some suggestions how to make the screen work.

Here is the code-

esphome:
  name: display-2
  friendly_name: 290test2
  on_boot:
    priority: 600.0  # Ensure this runs before other components initialize
    then:
      - switch.turn_on: power3v3
      - delay: 500ms  # Allow time for the power to stabilize


esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: arduino


wifi:
  ssid: "..."
  password: "..."


mqtt:
  broker: 192.168.0.111
  client_id: eink


# Enable logging
logger:
  level: DEBUG


spi:
  mosi_pin: GPIO2 # Replace GPIOY with the pin connected to SDA
  clk_pin: GPIO3  # Replace GPIOX with the pin connected to SCL


switch: # read somewhere that you need to switch the eink display on
  - platform: gpio
    pin: GPIO45
    id: power3v3
    name: "power"


font:
  - file: "font/Roboto/Roboto-Regular.ttf"
    id: myfont
    size: 30


text_sensor:
  - platform: mqtt_subscribe
    name: "Text"
    id: txt
    topic: display-2/text
    
display:
  - platform: waveshare_epaper
    id: my_display
    cs_pin: GPIO4
    dc_pin: GPIO5
    reset_pin: GPIO6
 #   busy_pin: GPIO7
    reset_duration: 200ms
    model: 2.13in-ttgo-dke
    update_interval: 10s
    rotation: 90
    lambda: |-
      it.print(it.get_width(), 0, id(myfont), TextAlign::TOP_RIGHT, id(txt).state.c_str());

Following arduino sketch works for hello world.
But how to make it work for ESPHome? Im pasting working arduino -


#include "Arduino.h"
#include <Wire.h>
#include "HT_lCMEN2R13EFC1.h"

// Initialize the OLED display (modify pins if needed)
HT_ICMEN2R13EFC1 display(6, 5, 4, 7, 3, 2, -1, 6000000); 

void setup() {
  Serial.begin(115200);
  Serial.println("Starting Hello World...");

  VextON();         // Enable external power for OLED
  delay(100);       // Stabilize power
  SPI.begin();      // Initialize SPI bus
  display.init();   // Initialize OLED display
  display.clear();

  // Display "Hello, World!"
  display.drawString(50, 30, "Hello, World!");  
  display.update(BLACK_BUFFER);
  display.display();
}

void loop() {
  // Nothing to do here, display remains static
}

// Power Management Functions
void VextON() {
  pinMode(45, OUTPUT);
  digitalWrite(45, LOW);
}

void VextOFF() { // Default OFF
  pinMode(45, OUTPUT);
  digitalWrite(45, HIGH);
}

How much of a challenge are you up for?

As far as I can tell there is no support for these boards in esphome, which means they don’t just work.

I bought the 3.2 version of the board that has an OLED display. I am fine with the Arduino framework but don’t like the environment so I use Platform.io or esphome which uses platformio under the hood. The support of esp32 in platformio is VERY messy right now. The Heltec board I have is nice but its support is incredibly poor. At least you have a working example, so you just need to figure out how to get it working in esphome.

But, what do you want to do with it? There is no support for Lora in esphome. That is the reason I bought my board. While I got the display to work in esphome, Lora will be even more of a challenge.

I did get Lora working using platformio directly and the range is more than adequate for my needs, so that is likely the path I will take.

Since you have your display working in Arduino, you could do the rest of what you need there. Or, you will need to figure out what is different between the library that Arduino is using and the one you are using in esphome. That requires a decent understanding of what esphome and platformio do “under the hood” to get to the actual code that is being compiled.

I was having an issue with a boot loop. Turning on very verbose debugging helped me see it was when i2c was scanning the bus. I turned off scanning and things worked better.

The other key was looking at the generated code to make sure the GPIO that powers the display was turned on early enough.

It is not an easy path with things that just work magically, but doesn’t that make it so much more rewarding when you do figure out how to make them work?

Thanks Neel, for sharing your experience!

I’m relatively new to ESP development and still figuring things out.

You’re right—ESPHome doesn’t seem to have direct support for these boards, and Heltec’s documentation isn’t great. It took me a week to get my display working in Arduino, and they didn’t even provide a working example!

Lora isn’t my focus right now, but your insights on debugging i2c and ensuring GPIO initialization early on are really helpful. I’ll keep that in mind while troubleshooting my setup. It’s definitely a steep learning curve, but as you said, overcoming these challenges makes it all the more rewarding!