ESP Home display ili9341

Hello everyone.

I’m trying my first display with a D1 mini AZdelivery and a display driver ili9341. My first problem is when I define and upload the display and that is SPI in the ESP code, I no longer get any log output. without already.
and I ordered the 2.4 display from AZdelivery and there is a description there that I can’t find in any forums or tutorials.

What am I doing wrong with the code?
It does a great job of uploading and I can also see that it’s online in the Homeassistand interface.

esphome:
  name: display-001
  friendly_name: Display 1

esp8266:
  board: d1_mini

api:
  encryption:
    key: "xxx"

ota:
  password: !secret ota_pass

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

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

display:
  - platform: ili9xxx
    model: ili9341
    dc_pin: D4
    cs_pin: D2
    reset_pin: D1
    rotation: 0    
spi:
  clk_pin: D5
  miso_pin: D6
  mosi_pin: D7

HIer the display:

Thanks in advance to everyone who is thinking about it

How are you powering everything? Maybe the display is drawing too much current.

Also possibly a memory issue - have a read in the ILI9XXX component about recommending an ESP32.

There than that, you config is fine assuming of course your wiring matches.

Thanks for your answer @zoogara

My D1 mini is an esp8266.
I connected the D1 mini to a 2am Net device via USB. but even without the display connected I can’t get a log.
The display lights up when I connect it via 5V. Apart from that, I’m not sure which of the pins is the same as the display doesn’t have the pin labels like others of its kind.
This is the log after writing via ESPhome Wifi:

INFO ESPHome 2023.10.1
INFO Reading configuration /config/esphome/display-001.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing display-001 (board: d1_mini; framework: arduino; platform: platformio/[email protected])
--------------------------------------------------------------------------------
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
Dependency Graph
|-- ESP8266WiFi @ 1.0
|-- ESP8266mDNS @ 1.2
|-- noise-c @ 0.1.4
|-- SPI @ 1.0
Compiling .pioenvs/display-001/src/main.cpp.o
Linking .pioenvs/display-001/firmware.elf
RAM:   [====      ]  38.3% (used 31388 bytes from 81920 bytes)
Flash: [====      ]  41.1% (used 429299 bytes from 1044464 bytes)
Building .pioenvs/display-001/firmware.bin
esp8266_copy_factory_bin([".pioenvs/display-001/firmware.bin"], [".pioenvs/display-001/firmware.elf"])
========================= [SUCCESS] Took 16.27 seconds =========================
INFO Successfully compiled program.
INFO Resolving IP address of display-001.local
INFO  -> 192.168.11.151
INFO Uploading /data/build/display-001/.pioenvs/display-001/firmware.bin (433456 bytes)
INFO Compressed to 308221 bytes
Uploading: [============================================================] 100% Done...

INFO Waiting for result...
INFO OTA successful
INFO Successfully uploaded program.
ERROR Logger is not configured!

if I take out display and spi and just upload:

esphome:
  name: display-001
  friendly_name: Display 1

esp8266:
  board: d1_mini

logger:

api:
  encryption:
    key: "TRrrcFY+YKzkwqJd4fIT3f4ZX5DSjPBrcS7PzNfUIBU="

ota:
  password: "2d3face818055a10de12bf77084b45ca"

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

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

I get a log:

INFO Compressed to 311239 bytes
Uploading: [============================================================] 100% Done...

INFO Waiting for result...
INFO OTA successful
INFO Successfully uploaded program.
INFO Starting log output from display-001.local using esphome API
WARNING Can't connect to ESPHome API for display-001.local: Error resolving IP address: [Errno -5] No address associated with hostname (APIConnectionError)
INFO Trying to connect to display-001.local in the background
INFO Successfully connected to display-001.local
[12:01:53][I][app:102]: ESPHome version 2023.10.1 compiled on Oct 24 2023, 12:00:06
[12:01:53][C][wifi:546]: WiFi:
[12:01:53][C][wifi:382]:   Local MAC: 08:3A:8D:F5:B8:A3
[12:01:53][C][wifi:383]:   SSID: [redacted]
[12:01:53][C][wifi:384]:   IP Address: 192.168.11.151
[12:01:53][C][wifi:385]:   BSSID: [redacted]
[12:01:53][C][wifi:387]:   Hostname: 'display-001'
[12:01:53][C][wifi:389]:   Signal strength: -66 dB ▂▄▆█
[12:01:53][C][wifi:393]:   Channel: 1
[12:01:53][C][wifi:394]:   Subnet: 255.255.255.0
[12:01:53][C][wifi:395]:   Gateway: 192.168.11.254
[12:01:53][C][wifi:396]:   DNS1: 192.168.11.254
[12:01:53][C][wifi:397]:   DNS2: 8.8.8.8
[12:01:53][C][logger:361]: Logger:
[12:01:53][C][logger:362]:   Level: DEBUG
[12:01:53][C][logger:363]:   Log Baud Rate: 115200
[12:01:53][C][logger:365]:   Hardware UART: UART0
[12:01:53][C][mdns:115]: mDNS:
[12:01:53][C][mdns:116]:   Hostname: display-001
[12:01:53][C][ota:097]: Over-The-Air Updates:
[12:01:53][C][ota:098]:   Address: display-001.local:8266
[12:01:53][C][ota:101]:   Using Password.
[12:01:53][C][api:138]: API Server:
[12:01:53][C][api:139]:   Address: display-001.local:6053
[12:01:53][C][api:141]:   Using noise encryption: YES

I’d say get yourself an ESP32. With 1MB of RAM it probably disables logger trying to give enough RAM to render the display.

Have you actually tried displaying some text?

1 Like

Yes, I had a Hello world lamda in it.

color:
  - id: my_light_red
    hex: FF3340
font:

  # gfonts://family[@weight]
  - file: "gfonts://Roboto"
    id: roboto
    size: 10

display:
  ...
    lambda: |-
      it.fill(COLOR_BLACK);   
      it.print(0, 0, id(roboto), id(my_light_red), TextAlign::TOP_LEFT, "Hello World!");

But I’m still not sure about the pin assignment of the display. whether everything is correct there.
I currently have:

D4 <–> LCD_ RS
D2 <–> LCD_CS
D1 <–> LCD_RST
D5 <–> SD_SCK
D6 <–> SD_DO
D7 <–> SD_DI
5v <–> 5v
3v <–> 3v
GND <–> GND

Did I plan this correctly?

Ah - Ok - so now that you have supplied your wiring I have taken a closer look at your display board.

This is not a SPI display, SPI is limited to the SD card interface on these. The display interface is parallel.

You can use these by writing your own code using Arduino framework, but they are not yet supported in ESPHome.

Google ILI9341 parallel Arduino for examples and info.

thank you I will look thair or Change the Display.

I use these a bit and they have a touch interface as well. The ILI9341 version…

https://www.aliexpress.us/item/3256804371601818.html

https://www.aliexpress.us/item/3256805899317482.html

This is the issue. The D1 mini does not have enough RAM.

On my hardware I was running a firmware made with the Arduino framework and it worked for about 2 years. For some reason I lost my Ardu installation. I tried adding the correct libraries to a new install but with the latest versions the project just did not run stable anymore.

So, I was thinking I would give esphome a try. But unfortunately the ILIxxx display component + WiFi + API + OTA is already to much.

Now it runs without the display component in the configuration, just with the CO2 sensor and the rest of the home assistant needed components.

I will need to have a look, to see if I can replace the D1 mini with an D1 Mini 32. There is not that much space between the CO2 Sensor an the D1.