EspHome LCD

Hello
I would like to use a LCD 1602 shielded for displaying a menu…

With the 5 buttons (all on A0 but with a value changing with the button clicked :
Enter
Up
Down
Left
Right

Does it possible to navigate in all the menu
I have read that it possible with a rotary encoder but I have not found a solution with button…

Sorry for my poor english (I am french)

Character-Based LCD Display — ESPHome

You can make your solution using any input device: Rotary encoder, button(s) or a potentiometer. What’s your preference?

Also this

https://esphome.io/components/display_menu/lcd_menu#lcd-menu

@stevemann
I am sure there is a possiblity to navigate into the menu of the LCD
But I have not found an example with a but button on A0 with different values…

And I have not the culture esphome (sorry)

How does A0 tell which button is pressed? Do they all deliver a different voltage?

Do you have an example of a one wire keypad like you want to integrate?

@nickrout

When I put this code into the YAML :

  - platform: adc
    pin: A0
    name: "Value"
    id: cur2
    update_interval: 2s
    filters:
      - lambda: return x * 10;

and this code for displaying the value of A0 :

    lambda: |-
      it.printf(0,1, "Amp:%.2f", id(cur2).state);

The value are different like the button I tick , the value is diffrent for each button…
Select : 4.41
Left : 3.73
Right : 0.17
Up : 1.74
Down : 2.98

No button ticked : 4.98

The OP hasn’t shared any hardware information, but you can use a resistor ladder and the voltage on A0 is different for each switch.

Here is a rough sketch of how this would work:

Hello

I use this LCD1602 :

This is internal wiring like your shema…

Seems an awful system when you could simply write each button to a gpio.

You could take the voltage and an if/elseif type of case statement to produce the key pressed, but how you tell when a key event occurs is a mystery to me.

I agree, but the OP still hasn’t provided any details about his project or hardware. The GPIO pins may be used to control relays, leds, etc.

Hello
I will clarify what I would do (project) and list the material I have…

thanks for this helps

Hello, I return here to “explain” what I would like to do :

I use a NodeMcu 12F 8266 under EspHome with tree devices :

  • PZEM-004T V3
  • DS18B20 sensor
  • LCD 1602 shielded with button (link below)

So I would to have a menu on the LCD who display menu :
Menu 1 : display 2 data (for example Current and Voltage)
Menu 2 : display 2 data (for example Energy and Power)
Menu 3 : Display temperature
Menu 4 : Time and data

Selection of the menu with the button connected on the LCD shielded (to A0)

I hope be clear

Thanks

It looks like the screen may be able to work with this esphome component

You probably will have already found the pzem and ds18b20 components as they are easy to find on the esphome page.

I have already discussed the buttons, and I don’t think they are going to be easy.

Hello

Displaying values on this screen is not the problem ( I succeed to connect and have the values…sale wiring like mine)

Ds18b20 : wiring and coding OK too
PZEM : wiring and coding seems OF too
Create menu : I have succeed but not navigate on this sub-menus

The hard to do is to use button for navigate into menu

Thanks for all

Have you tried this?

Hello @nickrout

I have succeed to read the value (the voltage) of each button

But this is is the how to navigate into the menu (validate a line of menu to access into this …) I don’t know how to do
for resume this is the structure of the program menu I cannot define…

Have you read this https://esphome.io/components/display_menu/

And https://esphome.io/components/display_menu/lcd_menu