Liquid Crystal Display with Keypad for Arduino Part 1

The sketch can be downloaded from my GitHub page here.

The display described here is a two line, sixteen characters per line, display with keypad. This Arduino Shield plugs onto the Arduino, but allows no further access to the Arduino pins. If you want to add other sensors then the display will need to be mounted on a breadboard. These displays often use the HD44780 parallel interface chip. This part describes using the buttons, part 2 will describe using the display.

The buttons:

The buttons are connected to a resistor chain, so there is a different voltage associated with each button, that can be measured by one of the Arduino’s analog pins. The diagram is shown here:


The sketch just reads the button pressed and prints the value out in the Serial Monitor. Plug the shield onto the Arduino and for this sketch only the buttons are working Nothing will be displayed on the LCD. The next post will show how to write to the display.

There may be some difference in the values read for the buttons on your board. These values can be found near the top of the sketch. If the sketch does not produce the correct result then you can see the voltage produced by each button by uncommenting a line in the byte readButtons () sub routine. The correct values can then be used in the variables at the head of the sketch.

The code is based on the tutorial at Freetronics.com here.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s