Touch Keypad Interfacing with ATmega32 Microcontroller

In this tutorial we are going to interface a 4×2 (8 key) touch keypad with ATMEGA32A microcontroller. We all know keypad is one of the most important input devices used in electronics engineering. This module does not have actual keys, but have specially designed capacitive metal pads, and these pads are very sensitive. So when a person gets in contact with one of the pads, there will a capacitive change in the corresponding loop, and this change will be sensed by the control electronic in the module. As a response to the touch the corresponding pad output pin goes high.

Touch Keypad Interfacing with ATmega32 Microcontroller
Touch Keypad Interfacing with AVR Microcontroller

For a eight key touch pad we will have eight outputs. Although there are other features with this module, we are not going to discuss them here.

Components Required

Hardware: ATMEGA32 microcontroller, power supply (5v), AVR-ISP PROGRAMMER, JHD_162ALCD (16x2LCD), 100uF capacitor, 100nF capacitor, 1KΩ resistor (2 pieces), Touch keypad module.

Software: Atmel studio 6.1 or Atmel studio 6.2, progisp or flash magic.

Circuit Diagram and Working ExplanationSchematic Touch Keypad Interfacing with ATmega32 Microcontroller

In circuit PORTB of ATMEGA32 is connected to data port LCD. Here one should remember to disable the JTAG communication in PORTC to ATMEGA by changing the fuse bytes, if one wants to use the PORTC as a normal communication port. In 16×2 LCD there are 16 pins over all if there is a back light, if there is no back light there will be 14 pins. One can power or leave the back light pins. Now in the 14 pins there are 8 data pins (7-14 or D0-D7), 2 power supply pins (1&2 or VSS&VDD or gnd&+5v), 3rd pin for contrast control (VEE-controls how thick the characters should be shown), and 3 control pins (RS&RW&E)

In the circuit, you can observe that I have only took two control pins, this give the flexibility of better understanding, the contrast bit and READ/WRITE are not often used so they can be shorted to ground. This puts LCD in highest contrast and read mode. We just need to control ENABLE and RS pins to send characters and data accordingly.

The connections which are done for LCD are given below:

PIN1 or VSS to ground

PIN2 or VDD or VCC to +5v power

PIN3 or VEE to ground (gives maximum contrast best for a beginner)

PIN4 or RS (Register Selection) to PD6 of uC

PIN5 or RW (Read/Write) to ground (puts LCD in read mode eases the communication for user)

PIN6 or E (Enable) to PD5 of uC

PIN7 or D0 to PB0 of uC

PIN8 or D1 to PB1 of uC

PIN9 or D2 to PB2 of uC

PIN10 or D3 to PB3 of uC

PIN11 or D4 to PB4 of uC

PIN12 or D5 to PB5 of uC

PIN13 or D6 to PB6 of uC

PIN14 or D7 to PB7 of uC

In the circuit you can see we have used 8bit communication (D0-D7) however this is not a compulsory, we can use 4bit communication (D4-D7) but with 4 bit communication program becomes a bit complex.

So by observing the above table we are connecting 10 pins of LCD to controller in which 8 pins are data pins and 2 pins for control.

For more detail: Touch Keypad Interfacing with ATmega32 Microcontroller


About The Author

Ibrar Ayyub

I am an experienced technical writer with a Master's degree in computer science from BZU Multan University. I have written for various industries, mainly home automation and engineering. My writing style is clear and simple, and I am skilled in using infographics and diagrams. I am a great researcher and am able to present information in a well-organized and logical manner.

Follow Us:
LinkedinTwitter
Scroll to Top