Ili9341 with D1_Mini not showing anything

Hi all,

Hope you’re doing well!

I have an issue with a ili9341 as I connected it with a D1 Mini that I had at home but other than turning on the screen is not doing anything. Can someone help me?

To connect it, I used this configuration (plus MOSI to D6):

And I have this code:

esphome:
  name: 3d-battery-unit

esp8266:
  board: d1_mini

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: "85d8b44ecfee4cc653b83630fae8c8f0"

wifi:
  ssid: XXXX
  password: XXXX

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "3d-battery-unit Fallback Hotspot"
    password: "41010509Z"
spi:
  clk_pin: GPIO14
  mosi_pin: GPIO13
  miso_pin: GPIO12

captive_portal:
 
font:
  - file: "Roboto-Regular.ttf"
    id: my_font
    size: 40

color:
  - id: my_red
    red: 100%
    green: 3%
    blue: 5%

image:
  - file: "image/hello.png"
    id: my_image
    resize: 200x200
    type: RGB24

display:
  - platform: ili9341
    model: TFT 2.4
    cs_pin: GPIO04
    dc_pin: GPIO02
    reset_pin: GPIO00

    lambda: |-
      it.image(0, 0, id(my_image));

I tried with text and Images (as in the code right now) but no luck with any.

I know that the configuration is more suitable with a ESP32, but this is what I had at home.

Thanks in advance!

You are using in your yaml GPIO12 as the miso_pin, however on a d1_mini GPIO12 is D6 and in your wiring scheme D6 is not connected. So start checking your wiring and you can use the D-numbers like D5, D6, D7 etc in your yaml. This can prevent errors by using the wrong pin-numbers. See also the picture with the pinout

Yes I agree, the cabling is bad, but just reconfigure the pins correctly. I would also use the designations D1, D2 …

Hi Both,

Thanks for responding.

I tried as suggested re-cabling and the issue persists.

Any suggestions on where the issue could be?

The new code is the this one:

esphome:
  name: 3d-battery-unit

esp8266:
  board: d1_mini

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: "85d8b44ecfee4cc653b83630fae8c8f0"

wifi:
  ssid: XXXX
  password: XXXX

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "3d-battery-unit Fallback Hotspot"
    password: "XXXX"
spi:
  clk_pin: D5
  mosi_pin: D7
  miso_pin: D6

captive_portal:
 
font:
  - file: "Roboto-Regular.ttf"
    id: my_font
    size: 40

color:
  - id: my_red
    red: 100%
    green: 3%
    blue: 5%
# Define a PWM output on the ESP32
image:
  - file: "image/hello.png"
    id: my_image
    resize: 200x200
    type: RGB24

display:
  - platform: ili9341
    model: TFT 2.4
    cs_pin: D2
    dc_pin: D4

    lambda: |-
      it.image(0, 0, id(my_image));

I haven’t tried the D1 mini. I have this display on esp32. How does the display light up? Are there any errors in the D1mini log?

Do you have a photo of your wiring and is the wiring according your yaml file definition?

Hi both,

Sure thing, I upload now the photos.

The screen is all white:

Color scheme:

Red: D1: 5V - Display: VCC and LED
Black: D1: G - Display: GND
Orange: D1: D2 - Display: CS
Brown: D1: D3 - Display: RST
Blue: D1: D4 - Display: D/C
Green: D1: D7 - Display: SDI (MOSI)
Yellow: D1: D5 - Display: SCK
White: D1: D6 - Display: SOOK (MISO)



Hope this helps!

Thanks in advance!

According to the datasheet (See Introduction) https://cdn-shop.adafruit.com/datasheets/ILI9341.pdf the ILI9341 can operate with 1.65V ~ 3.3V I/O interface voltage. You are using 5V, what happens if you change that to the 3V pin. Could you also post the device log file?

I have a 2.8 "Ili9341 at home and I have no problem with the 5V power supply. At the beginning I tried 3.3V and the display flickered slightly.
I use LED brightness control via pin esp.
I noticed that you have a led pin connected to 5V (that’s wrong), connect pin led 3.3V
The display may be overexposed (5V) and nothing may be visible

Then give it a try:

         lambda: | -
           it.fill (Color :: BLACK);
           it.print (0, 0, id (my_font), id (my_red), "Test");

I don’t see this in the suggested config in the docs, nor does it seem to do anything else in your config.

I have tried the same - with same result
different wiring - same result - but works with Arduino weather
So I droped it an use another display

Hi all

Hope you’re doing well and thanks a lot for all your responses.

@jsuanet and @pepe59 I tried using the 3V, but the results is the same. I also playing changing the Led and the VCC adding one to 3V and the other to 5V, but the result is the same. It changes the intensity of the screen, but nothing more. I also tried with your updated code.

About the logs, here is the installation ones, but now it shows, short after I downloaded it this message that has not appear before, although the device seems connected in the ESPHome dashboard.

WARNING Can't connect to ESPHome API for 3d-battery-unit.local: Timeout while connecting to ('192.168.0.59', 6053)

Here is the installation log code, I was unable to attach it as a doc.

INFO Reading configuration /config/esphome/esphome-web-10b34e.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing 3d-battery-unit (board: d1_mini; framework: arduino; platform: platformio/espressif8266 @ 3.2.0)
--------------------------------------------------------------------------------
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
Dependency Graph
|-- <ESPAsyncTCP-esphome> 1.2.3
|-- <ESPAsyncWebServer-esphome> 2.1.0
|   |-- <ESPAsyncTCP-esphome> 1.2.3
|   |-- <Hash> 1.0
|   |-- <ESP8266WiFi> 1.0
|-- <DNSServer> 1.1.1
|-- <ESP8266WiFi> 1.0
|-- <ESP8266mDNS> 1.2
|-- <SPI> 1.0
Compiling /data/3d-battery-unit/.pioenvs/3d-battery-unit/src/main.cpp.o
Linking /data/3d-battery-unit/.pioenvs/3d-battery-unit/firmware.elf
RAM:   [====      ]  42.3% (used 34620 bytes from 81920 bytes)
Flash: [=====     ]  50.8% (used 530669 bytes from 1044464 bytes)
Building /data/3d-battery-unit/.pioenvs/3d-battery-unit/firmware.bin
esp8266_copy_factory_bin(["/data/3d-battery-unit/.pioenvs/3d-battery-unit/firmware.bin"], ["/data/3d-battery-unit/.pioenvs/3d-battery-unit/firmware.elf"])
========================= [SUCCESS] Took 19.14 seconds =========================
INFO Successfully compiled program.
INFO Resolving IP address of 3d-battery-unit.local
INFO  -> 192.168.0.59
INFO Uploading /data/3d-battery-unit/.pioenvs/3d-battery-unit/firmware.bin (534816 bytes)
INFO Compressed to 292211 bytes
Uploading: [============================================================] 100% Done...

INFO Waiting for result...
INFO OTA successful
INFO Successfully uploaded program.
INFO Starting log output from 3d-battery-unit.local using esphome API

@nickrout If I don’t add the spi code, esphome doesn’t allow me to install the configuration, as I receive the following error:

Component display.ili9341 requieres component spi.

Hope this helps!

Does the D1 mini not connect to your entire network?
If so, press the log for this device on the Esphome tab and publish the output here

Weird, because the only mention of spi on the doc page simply says

As this is a somewhat higher resolution display and may require pins beyond the typical SPI connections, it is better suited for use with the ESP32.

Hi!
Have anyone got this to work with esp8266? i have same problem that screen is white and sometimes flickers, but when using arudino test code evrything works and i dont want to use esp32

It’s not working with esp8266 :frowning: