DFRobot LCD shield keypad problem

One of the keys doesn't work correctly.
I have the declaration:

int  adc_key_val[5] ={30, 150, 360, 535, 760 };

This means Key 1 -5 (Right, Up, Down, ...) See on this page.
The keys "Right" and "Down" etc. work correctly. When I press the Up-key (nr. 150) the value of Key Down is shown.

I learned that the values are derived from the resistors 1Key - 330R - 2Key - 620R - 3Key ....

Any ideas how to solve that problem, I resoldered the Keys, but couldnt get to the resistors. 8)

Hajo

Do you mean you can't replace the resistors since you don't have those values?
Were the buttons working in the past? Are you using a different analogReference than default (5V)?

Hello Liudr,

No I can not replace them (smd + dont have values and big soldering iron :stuck_out_tongue_closed_eyes: + under a shield).

I didnt check them when I got the board. I use the 5.2 Volt from the usb-cable.

Hajo

PS: Your shield works like a charm but I couldnt get it to work with the ethernet-card. But thats another story. I should have waited...

Could you flip the DFRobot shield upside down and use a multimeter to check the resistances? Maybe they swapped the 330 and 620 resistors?

Could you let me know about the ethernet problem? PM me. Thanks.

Problem solved! No soldering required.
I just had to pipe the values of the keys to the terminal and found out that one value was just over the threshold. When I changed that value it worked.

But:
-The polling frequency is to high - I slowed that down.
-The temperature drift is significant.

So I sometimes have to push the key several times to get the right reaction. I have to play with delay and debouncing.

Thanks for the input.

LeseLaster:
So I sometimes have to push the key several times to get the right reaction. I have to play with delay and debouncing.

Good for you!

I use 20ms wait to debounce my buttons on digital pins. If you have to push the key several times, maybe you're not checking your key press as often as needed. I had that in the past.

With this design, you can't possibly press two buttons at the same time and get both buttons detected. When I only used 4 keys (to save two analog pins) I used to use up+down for escape. This one apparently can't do it. I wonder why they use this interesting way of hookup, as compared with just an R-2R ladder. Maybe to save space.

To save the digital IO pins, the keypad interface only uses one ADC channel.

That is the trick and the problem. Yesterday I found the bounce library and I will have a look at it:

 It debounces digital inputs and more.

So I have to look at the "and more". :cold_sweat:

LeseLaster:
...
I just had to pipe the values of the keys to the terminal and found out that one value was just over the threshold. When I changed that value it worked.
...

Download the example code for check of the keypad signal values:
LCD_KEYPAD_TEST0.ino