OVERVIEW
The LC-075 Smart Keypad Adapter module simplifies the
use of 3×4 or 4×4 dome keypad matrix modules with
microcontrollers or SBCs like Arduino and Raspberry Pi.
The LC-075 is designed to achieve 3 important results:

  1. Reduce pin usage from 7-8 pins to 1-2 pins
  2. Simplify programming with analog voltage
    output, I2C or UART(“Serial”) outputs
  3. Reduce code footprint – no libraries required.

FEATURES

  • 3.3-5V input power and logic operation
  • Only 1 or 2 pins required from host
  • 3 outputs: Analog Voltage, I2C and UART (Serial)
  • Reverse polarity protection
  • Low power consumption < 30mA
  • Simple programming – no library required
  • Compatible with Arduino/Raspberry Pi

PIN FUNCTIONS
The module has a 4 pin 2.54mm pitched header with
the following functions.

SELECTING I2C OR UART MODE

  1. Remove power.
  2. Insert a 3×4 or 4×4 matrix keypad in the
    assigned pin header
  3. Press and hold the * and 4 key for
    UART/”Serial” mode or * and 1 for I2C mode
  4. Apply power while still holding the key
    combination selected.
  5. After one second, from power up, release the
    keys.
  6. Power cycle or reset the host microcontroller
  7. Done. Test to confirm. Repeat if operation
    failed.
    KEYPAD INSTALLATION
    Follow indicated installation area labelled on the board.
    4×3 keypads are installed between R1 and C3 pins and
    facing up. While 4×4 keypads are installed between R1
    and C4 and also facing up. See figure 2 for details.

PIN USAGE

The table below shows the pin requirements for each
output mode:

APPLICATION NOTES

The LC-075 can be interfaced to an Arduino board using
any of the 3 available outputs discussed below. The
code examples demonstrate the very basic usage of the

device and are intended for a quick test of the
capabilities or of the product. For practical examples,
please contact us or search through our Github page.

Analog Output
The pin AO outputs a voltage that corresponds to the
keypresses. Releasing the key will pull the AO pin to 0V.
The table below summarizes the output voltage to be
expected along with values expected from a 10-bit ADC
board such as the Arduino Uno / Nano / Mega /
ProMini / Leonardo and other boards. The table is for
reference only there may be slight deviations in each
board

Circuit

 
Arduino Analog Voltage example 
void setup() { 
  Serial.begin(9600); 
} 
 
void loop() { 
  int val = analogRead(A0); 
  if (val>(32-10)&&val<(32+10)){ 
    Serial.println("1"); 
  } 
  else if (val>(63-10)&&val<(63+10)){ 
    Serial.println("2"); 
  } 
  else if (val>(93-10)&&val<(93+10)){ 
    Serial.println("3"); 
  } 
  else if (val>(123-10)&&val<(123+10)){ 
    Serial.println("4"); 
  } 
  else if (val>(154-10)&
   Serial.println("5"); 
  } 
  else if (val>(184-10)&&val<(184+10)){ 
    Serial.println("6"); 
  } 
  else if (val>(216-10)&&val<(216+10)){ 
    Serial.println("7"); 
  } 
  else if (val>(247-10)&&val<(247+10)){ 
    Serial.println("8"); 
  } 
  else if (val>(277-10)&&val<(277+10)){ 
    Serial.println("9"); 
  } 
  else if (val>(308-10)&&val<(308+10)){ 
    Serial.println("*"); 
  } 
  else if (val>(339-10)&&val<(339+10)){ 
    Serial.println("0"); 
  } 
  else if (val>(370-10)&&val<(370+10)){ 
    Serial.println("#"); 
  } 
  else if (val>(401-10)&&val<(401+10)){ 
    Serial.println("A"); 
  } 
  else if (val>(432-10)&&val<(432+10)){ 
    Serial.println("B"); 
  } 
  else if (val>(463-10)&&val<(463+10)){ 
    Serial.println("C"); 
  } 
  else if (val>(492-10)&&val<(492+10)){ 
    Serial.println("D"); 

I2C Mode

The I2C address is 0x50. There is only one data byte
corresponding to the key pressed. If no key is pressed,
0x00 is received. When a key is on hold, the data
remains while a key is on hold. Therefore, the host must
implement a form of polling method to monitor key
changes.

UART / “Serial” Mode
The output is a single character at 9600 baud rate. The
received data is the key pressed. Example, if key 8 is
pressed, expect the character ‘8’ (0x38). As long as the
key is pressed the UART also sends the data.

Arduino I2Cexample
The example below uses the I2C pins of the LC-075 with
a host Arduino to poll for the key every 1ms. The key
pressed is printed on the serial monitor set to 9600
baud.

#include <Wire.h> 
void setup() { 
Wire.begin(); 
Serial.begin(9600); 
} 
void loop() { 
Wire.requestFrom(0x50, 1); 
while (Wire.available()) {  
char c = Wire.read()
Serial.print(c); 
} 
delay(1); 
} 

Arduino Serial example
The example below uses the Arduino’s software serial
port as interface to the LC-075. You may also use
hardware serial.

#include <SoftwareSerial.h> 
SoftwareSerial mySerial(2, 3); // RX, TX 
void setup() { 
Serial.begin(9600); 
mySerial.begin(9600); 
} 
void loop() { 
if (mySerial.available()) { 
char c = mySerial.read(); 
Serial.println(c); 

Similar Posts