Help me with my display lcd

My display doesn’t have any output, it’s a 1602A and it’s connected to the correct ports.

This is my logs

[18:39:35][W][component:214]: Component lcd_base took a long time for an operation (0.07 s).
[18:39:35][W][component:215]: Components should block for at most 20-30ms.
[18:39:36][W][component:214]: Component lcd_base took a long time for an operation (0.07 s).
[18:39:36][W][component:215]: Components should block for at most 20-30ms.
[18:39:37][W][component:214]: Component lcd_base took a long time for an operation (0.07 s).
[18:39:37][W][component:215]: Components should block for at most 20-30ms.
[18:39:38][W][component:214]: Component lcd_base took a long time for an operation (0.07 s).
[18:39:38][W][component:215]: Components should block for at most 20-30ms.
[18:39:39][W][component:214]: Component lcd_base took a long time for an operation (0.07 s).
[18:39:39][W][component:215]: Components should block for at most 20-30ms.
[18:39:40][W][component:214]: Component lcd_base took a long time for an operation (0.07 s).
[18:39:40][W][component:215]: Components should block for at most 20-30ms.
[18:39:41][W][dht:169]: Requesting data from DHT failed!
[18:39:41][W][dht:060]: Invalid readings! Please check your wiring (pull-up resistor, pin number).

and here is my code in esphome

substitutions:
  esphome_name: esp32_ssd130

esphome:
  name: "${esphome_name}"
  friendly_name: Esp1

esp32:
  board: esp32dev
  framework:
    type: arduino

logger:

api:
  encryption:
    key: "BKhP/AvEf5VCKFGETTqLlPwCNyLoVzmRS0KDxXOgKeA="

ota:
  password: "c410da6cd9e1563bd33aaa5d11f4d10a"

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

  ap:
    ssid: "Acqua-Callidus Fallback Hotspot"
    password: "Lgp5pPm1ErIm"

captive_portal:

i2c:
  - id: bus_a
    sda: 21
    scl: 22
    frequency: 400kHz
    scan: true


globals:
   - id: current_page_num
     type: int
     restore_value: no
     initial_value: '1'

sensor:
  - platform: dht
    pin: GPIO13
    model: dht11
    temperature:
      name: "office_temperature"
      id: office_temperature
    humidity:
      name: "office_humidity"
      id: office_humidity
    update_interval: 20s
  - platform: bmp280
    temperature:
      name: "Outside Temperature"
      id: outside_temperature
      oversampling: 16x
    pressure:
      name: "Outside Pressure"
      id: outside_pressure
    address: 0x76
  - platform: uptime
    name: "${esphome_name} - Uptime Sensor"
  - platform: wifi_signal
    name: "${esphome_name} - WiFi Signal"
    update_interval: 60s

text_sensor:
  - platform: wifi_info
    ip_address:
      name: endereco-ip
      id: enderecoip
      icon: mdi:ip-network   

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO2
      inverted: true
      mode:
        input: true
        pullup: true
    id: display_button
    on_press:
      then:
        - lambda: |-
            id(current_page_num) = 2;
        - logger.log: "Current page set to 2"
        - output.turn_off: led2
        - output.turn_off: led3
        - output.turn_off: led4
        - output.turn_off: led5
        - output.turn_off: led1

  - platform: gpio
    id: button1
    pin:
      number: GPIO4
      mode: INPUT_PULLUP
      inverted: true
    on_press: 
      then:
        - lambda: |-
            id(current_page_num) = 3;
        - logger.log: "Current page set to 3"
        - output.turn_off: led2
        - output.turn_off: led3
        - output.turn_off: led4
        - output.turn_off: led5
        - output.turn_on: led1   

  - platform: gpio
    id: button2
    pin:
      number: GPIO5
      mode: INPUT_PULLUP
      inverted: true
    on_press: 
      then:
        - lambda: |-
            id(current_page_num) = 4;
        - logger.log: "Current page set to 4"
        - output.turn_off: led1
        - output.turn_off: led3
        - output.turn_off: led4
        - output.turn_off: led5
        - output.turn_on: led2

  - platform: gpio
    id: button3
    pin:
      number: GPIO15
      mode: INPUT_PULLUP
      inverted: true
    on_press: 
      then:
        - lambda: |-
            id(current_page_num) = 5;
        - logger.log: "Current page set to 5"
        - output.turn_off: led1
        - output.turn_off: led2
        - output.turn_off: led4
        - output.turn_off: led5
        - output.turn_on: led3

  - platform: gpio
    id: button4
    pin:
      number: GPIO18
      mode: INPUT_PULLUP
      inverted: true
    on_press: 
      then:
        - lambda: |-
            id(current_page_num) = 6;
        - logger.log: "Current page set to 6"
        - output.turn_off: led1
        - output.turn_off: led2
        - output.turn_off: led3
        - output.turn_off: led5
        - output.turn_on: led4

  - platform: gpio
    id: button5
    pin:
      number: GPIO19
      mode: INPUT_PULLUP
      inverted: true
    on_press: 
      then:
        - lambda: |-
            id(current_page_num) = 7;
        - logger.log: "Current page set to 7"
        - output.turn_off: led1
        - output.turn_off: led2
        - output.turn_off: led3
        - output.turn_off: led4
        - output.turn_on: led5


light:
  - platform: binary
    name: "LED1"
    output: led1
  - platform: binary
    name: "LED2"
    output: led2
  - platform: binary
    name: "LED3"
    output: led3  
  - platform: binary
    name: "LED4"
    output: led4    
  - platform: binary
    name: "LED5"
    output: led5    

output:
  - id: led1
    platform: gpio
    pin: GPIO23
  - id: led2
    platform: gpio
    pin: GPIO32
  - id: led3
    platform: gpio
    pin: GPIO14
  - id: led4
    platform: gpio
    pin: GPIO25
  - id: led5
    platform: gpio
    pin: GPIO26

font:
  - file: "stocky.ttf"
    id: my_font
    size: 14
  - file: "arial.ttf"
    id: my_font2
    size: 13
  - file: "arial.ttf"
    id: my_font3
    size: 12
  - file: "arial.ttf"
    id: my_font4
    size: 15

  - file: materialdesignicons-webfont.ttf
    id: icon_font
    size: 25
    glyphs:
      - "\U000F1447" # clock
      - "\U000F0E66" # sprout

  - file: materialdesignicons-webfont.ttf
    id: icon_font20
    size: 20
    glyphs:
      - "\U000F0A5F" # ip
      - "\U000F059F" # web
      - "\U000F0028" # web no checked
      - "\U000F05A9" # wifi on
      - "\U000F05AA" # wifi off
      

  - file: materialdesignicons-webfont.ttf
    id: icon_font15
    size: 15
    glyphs:
      - "\U000F058C" # water
      - "\U000F04C5" # speedometer
      - "\U000F050F" # thermometer

time:
  - platform: homeassistant
    id: ha_time

display:
  - platform: lcd_pcf8574
    dimensions: 20x4
    address: 0x27
    id: lcd
    update_interval: 1s 
    lambda: |-
      it.print(0,0,"Hello World");

Someone help me please

I don’t believe you can use fonts with lcd_pcf8574. I believe you’re stuck with the built in ones.

If it’s a 16x2 display why have you defined it as a 20x4 display in the code? Possibly that is one issue?

Also what Nick said, no TTF fonts with this style of LCD display. You can define 8 custom characters, this is described in the docs for your display.

Could you explain this to me?

I was using a different display before, that’s why I have these fonts in the code

The 1602A is 16 characters by 2 lines, thus:

display:
  - platform: lcd_pcf8574
    dimensions: 16x2
    address: 0x27
    id: lcd
    update_interval: 1s 
    lambda: |-
      it.print(0,0,"Hello World");

The custom characters?

Lastly, have you turned the backlight on? You should be able to read the text regardless…

I tried with the 16x2 dimension, this different dimension was one of my tests.

I didn’t use those fonts, I used them on another display.

Can you post a photo of the back of your display model, connected to the ESP?

And the full logs.

Having re-read your config file, I see you aren’t using the ttf font. Nevertheless the font file will take up space on the esp. try removing them.

1 Like

I managed to solve it, it was necessary to adjust a component in the converter to input sda, scl

1 Like

So you wrongly reported this, which I assumed to be true. Assumption, the mother of f ups.

Hello! I have the same issue, can you explain how you solved it? Thanks.

You responded to the post where he described how he fixed it. Please play attention.

EDIT: problem solved, the error in the wiring below was that the PIN3 V0 on the LCD shall be connected to GND.

Have similar issue with my 1602A v5.5. I do not connect it with i2c but as gpio with following code:

display:
  - platform: lcd_gpio
    dimensions: 16x2
    data_pins:
      - GPIO18
      - GPIO17
      - GPIO16
      - GPIO15
    enable_pin: GPIO23
    rs_pin: GPIO19
    lambda: |-
      it.print("Hello World!");

I have following wiring:

  • PIN01-VSS → GND
  • PIN02-VDD → 5V
  • PIN03 V0-> 3.3V
  • PIN04 RS-> GPIO19
  • PIN05 RW-> GND
  • PIN06 E → GPIO23
  • PIN07 D0-> NOT USED
  • PIN08 D1-> NOT USED
  • PIN09 D2-> NOT USED
  • PIN10 D3-> NOT USED
  • PIN11 D4-> GPIO18
  • PIN12 D5-> GPIO17
  • PIN13 D6-> GPIO16
  • PIN14 D7-> GPIO15
  • PIN15 A-> 5V
  • PIN16 K-> GND

Unfortunately I can not get anything on the LCD…

Any hing would be highly appreciated. TIA.

Sometimes my friends call me Caption Obvious but, in the future you should opt for the i2c versions and save yourself the gpio’s for somethings fun! Also, I’d recommend that you use a mosfet for controlling and dimming the back light on BLA/BLK. You definitely don’t want to leave it on at full brightness 24/7 and only doing an On/Off switch isn’t of much use if it’s somewhere that will get varying levels of sunlight during a day or ambient light levles of sunlight in a room and dimming will make it a much friendlier experience for people if they can adjust the backlight as needed instead of only On/Off.

Thanks a million, these are very useful hints. The reason I am using the gpio is that the LCD has been a part of a starter kit, which I have ordered month ago and I had no i2c adapter with it, I was just about to order it when I got it working… but definitely that would be a no brainer in future. As far as the brightness is concerned - yes I am going to work on this in next days… (I am VERY new to all of the esp/electronics stuff…).

In the meantime I will seek for another advice. Actually the LCD we are talking about is working very nice but (as always there is a “but”) - when I flash it it works flawlessly, when I disconnect the ESP from opwer source and reconnect after a while the CO2 sensor I have (on i2c) works properly but the LCD displays only 16x2 sqares… after I re-flash it oit works perfectly again… What am I missing here?

Many thanks in advance.

Best. J.

Oh i didn’t realize it was a starter kit, that makes more sense. I actually highly recommend those to new people actually. They’re a good price and give someone a lot of exposure to sensors and components.

As far as brightness, sometimes people get used to working with it on their workbench and dont realize that wherever you eventually install it, it may not be at the same visual angle and may be different lighting conditions which can really make those displays hard to see unless they have a physical adjustment like a potentiometer or you could use a rotary encoder with push button and then dim +/- and use the botton for maybe a quick On/Off or whatever you would want, either would work just fine.

Heres a guide for “potentiometer vs. rotary encoder” if your not already overwhelmed and can jam more information in your brain lol.

https://www.arrow.com/en/research-and-events/articles/encoder-vs-potentiometer-how-to-choose

Something else you might consider is that Esphome has come a long way with their support of displays and you can get very nice LCD touchscreen displays for relatively cheap so, keep that in mind when getting one for a project.

Heres one as an example. This has an esp32 impeded inside and is ready to go right out of the box.

The one thing i will stress to you is, verify a display or whatever is supported by Esphome BEFORE buying it and youll save yourself a lot of unnecessary headaches.

Lvgl is kind of more for creating the UI for any display that supports LVGL and here is the broader display documentation for the one i linked too above. You’ll notice that they have a list of currently known models supported so, just try to use any of those models untill you are looking for a challenge!

As far as a mosfet for the dimming this led or any most led’s, i really like these modules and have used them for years.

1 Like

Thanks a million, that is really quite of an impressive instruction, I really appreciate it! I have some oleds already but I love to expand the opportunities so I am definitely following some of your suggestions… many thanks again.