Using Arduino UNO wifi Rev2 with LCD 1602 Keypad

Hello,
New on this forum, I'd like ask question about using LCD 1602 keypad.
My problème is that I want to use digital pin 2 entry with a contact in pull up.

All works fine without LCD keypad, but with LCD keypad, the signal digitalRead(Contact) is sometime moving from 0 to 1 without pressing button or not moving at all when pressing
My pull up resistance is 10 K

Is there a problem using D2 or is the resistance OK
I tried 5K with the same issue

Thank you for your help

Can you post a picture of your wiring setup please, along with your code?

@AC74, your topic has been moved to a more suitable location on the forum. At the moment that you can upload code, it's not an Installation and Troubleshooting question.

Do you mind sharing your code (and please use code tags).

Post a link to that LCD keypad.

Thank you for your replies

LCD key pad : LCD 1602 keypad

And this is part of my code
Affectation.h (1.8 KB)
Boutons.h (1.1 KB)
Dosage.h (2.0 KB)
Ecran.h (731 Bytes)
Mangeoire2.ino (1.6 KB)

Sometime it works, sometime not
Why ?

Yep, thought that was what you meant.


OK, I cannot see any reference on that schematic for D2 connecting to anything, so there should be no interaction. Anybody else see something?

Can't see your code so I have no idea of any problem in the code.

Do you not have the shield actually mounted on the UNO?

Since you are (correctly) switching to ground and using a pull-up, it should read 1 unless the switch is pressed when it should read 0. Test your jumper wires.

Hello,
Different tests confirm my first idea, everything OK without LCD1602 keypad, contact works fine, I can manage my step motor.
When I use LCD with 6 buttons, sometimes OK , sometimes not, signal on pin 2 (button) is 0 or 1 without pressing button.

It looks like an interference with LCD which normally doesn't use pin 2.

Any idea ?

Thanks

Hello,
More tests show this:

  • Uno WiFi card + pull up 10K + button => works fine , I get immediate signal on pin 2
  • Uno Wifi card + LCD 1602 keypad + the same pull up 10K = button
    I don't activate the stepper motor

=> I get signal on pin 2 which can be as follow :
. void loop()
{
Serial.println(digitalRead(2));
delay(1000);
}
button released => pin 2 starts = 0 then 1 after a few seconds
button pressed => pin 2 = 1 then 0 after a few seconds
sometimes waiting time can be either short or more than a few seconds

pin 2 is the last available digital pin on the lcd 1602 keypad shield

How can we explain this ?
(power supply is 12V 5 A for the stepper motor)

following my tests:
in my code there are differents tasks , I can see that the problem occurs inside certain tasks

Using interrupts ?

Do you actually know what interrupts are?

Hello,

I never have used interrupts, but I have an idea of what it is
I have made tests using interrupts, no problem with an arduino UNO, button on pin 2, pull up, LCD, but the same test with UNO Wifi + LCD keypad fails
There is something I don't understand with LCD keypad
What ?

Never used them, but have used them to make tests? Well, that is a bit of a puzzle to be sure.

Suffice to say, using interrupts is not appropriate for this, a common misunderstanding for "newbies". :grin:

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