LCD Shield "SELECT" button doesn't work

Hi everybody! I've just buy a LCD keypad shield and I've already tried it. But when I tried it, the "SELECT" button didn't work. After I checked the read analog signal, the "SELECT" button didn't decrease the value. When I didn't press any button, the analog signal gave value 1024. But when I pressed "SELECT" button, nothing change, still 1024. Any solution?

Without letting us know what LCD keypad shield you are talking about, a solution is almost impossible. Provide a link, and datasheet (if available).

I don't know what type is it. But it looks like this

image

Oh well, can't help then. Looks like the 3.3K resistor may be missing or soldered badly.

I don't know where the resistor is, but the other button is working

OK, What do you expect from us?

Schematic of the board

okay thanks

@vgomasjaya, your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with your project :wink: See About the Installation & Troubleshooting category.

I use one such board. The resistors are well hidden.....
Check the soldering of the Select button.

Disconnect all power and use a DMM to figure out what pins are doing the switching action. Solder 2 temporary cables to those pins. Using those temporary cables bypasses the eventually defect Select button.

okay thank you

I just get that this error just occurs in WEMOS D1 R1, when I change to Arduino Leonardo, the "SELECT" button works...

this my code

#include <Arduino.h>
#include <Wire.h>
#include <LiquidCrystal.h>
#include <ESP8266WiFi.h>

// Create LDC instance
LiquidCrystal lcd(D8, D9, D4, D5, D6, D7);

// key defines 
#define KEY_RIGHT           0
#define KEY_UP              1
#define KEY_DOWN            2
#define KEY_LEFT            3
#define KEY_SELECT          4
#define KEY_NOT_PRESSED     5
#define KEY_ANALOG_TRESHOLD 50

byte PressedKey = KEY_NOT_PRESSED;

void setup()
{
  lcd.begin(16, 2); 
  lcd.setCursor(0,0); 
  lcd.print("Engsta.com");
}

int GetKeyValue()
{
  int ADCVal = 0;
  ADCVal = analogRead(A0); 

  if (ADCVal > 900 + KEY_ANALOG_TRESHOLD)   return KEY_NOT_PRESSED;
  if (ADCVal < 10  + KEY_ANALOG_TRESHOLD)   return KEY_RIGHT;
  if (ADCVal < 200 + KEY_ANALOG_TRESHOLD)   return KEY_UP;
  if (ADCVal < 400 + KEY_ANALOG_TRESHOLD)   return KEY_DOWN;
  if (ADCVal < 550 + KEY_ANALOG_TRESHOLD)   return KEY_LEFT;
  if (ADCVal < 750 + KEY_ANALOG_TRESHOLD)   return KEY_SELECT;
 
  return KEY_NOT_PRESSED; 
}

void loop()
{

  lcd.setCursor(0,1); 
  PressedKey = GetKeyValue();
  
    switch (PressedKey) 
    {
      case KEY_RIGHT: {  
        lcd.print("RIGHT          "); 
        break;
      }
      case KEY_LEFT:  {
        lcd.print("LEFT           "); 
        break;
      }
      case KEY_UP: {
        lcd.print("UP             ");
        break;
      }
      case KEY_DOWN: {
        lcd.print("DOWN           ");
        break;
      }
      case KEY_SELECT:{
        lcd.print("SELECT         ");
        break;
      }
      case KEY_NOT_PRESSED:{
        break;
      }

      default:
      break;
    } 
    delay(50);
}

is it because Wemos D1 R1 run in 3.3v whereas Arduino run in 5v?


Well, yes, it is - or sort of.

The ADC in the ESP8266 can only handle up to 1.1 V but there is a voltage divider on the "D1 R2". that allows voltages up to 3.3 V, So if "VCC" in the above circuit is 5 V, then with no button pressed, the voltage on "A0" is 5 V, well above the ADC limit and it simply reads maximum.

When you press "Select", the voltage on "A0" is now 3.6 V, still above the ADC limit and again, it simply reads maximum.

Only when you press "Left" does the voltage drop to 2.7 V which is a value that the ADC - prescaled by the 220k/ 100k divider - can actually read. :sunglasses:

Can you change this? Not easily. :face_with_raised_eyebrow: It would require modifications to the shield or the WeMOS D1 R2.

wow it's so nice explanation... Thank you very much!

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.