This free keypad library for Proteus adds the flat 4×4 membrane keypad to Proteus 8: the black keypad with 16 keys (0 to 9, A to D, * and #) and the 8-pin ribbon that comes in every Arduino kit. It has the real pins (R1 to R4, C1 to C4), and you press the keys with the mouse while the simulation runs.
Proteus has its own phone and calculator keypads, but not this one, and they do not behave like the membrane keypad on your desk. This 4×4 keypad Proteus model has 16 real contacts in a 4 x 4 matrix, so your Arduino sketch scans it exactly as on the bench with the Keypad library. You can hold several keys at once and see the real ghost keys, and even add contact bounce to test your debounce code.
With the keypad library for Proteus installed, place 4X4 MEMBRANE KEYPAD, wire R1 to R4 and C1 to C4 to eight Arduino pins (no resistors needed), and run. Hold the left mouse button on a key to press it. Ctrl + click keeps a key down, so you can press several keys together.
Keypad Library for Proteus: Features
| Feature | 4×4 keypad Proteus model |
|---|---|
| Part | 4X4 MEMBRANE KEYPAD: the black membrane keypad with 16 keys and the 8-pin ribbon |
| Real key matrix | 16 contacts between 4 row and 4 column pins, about 100 ohm when pressed and open when released, like the real membrane. No diodes, no hidden logic |
| Clickable keys | Hold the left mouse button on a key: it stays pressed while you hold it, and the key picture goes down. Slide to another key and the press moves with you |
| Several keys at once | Ctrl + click keeps a key down until you click it again, so you can test key combinations and the Keypad library’s multi-key mode |
| Ghost keys | Hold three keys at the corners of a rectangle and the Arduino also sees the fourth one, exactly like the real keypad |
| Contact bounce | Set the bounce time to a few milliseconds and every press and release bounces like a real contact. Leave it at 0 for clean edges |
| No missed clicks | A very quick click is held for at least 50 ms of simulation time, so a slow loop() still sees it |
| Warnings | Two driven pins shorted through a key, or more than 24 V on the keypad: a warning in the Proteus log says what to change |
| Boards | Arduino UNO, Nano, Mega, ESP32 and any other microcontroller that scans a key matrix |
4x4 Keypad Proteus Model: Pins and Wiring
| Keypad pin | Keys on it | Arduino UNO (example below) |
|---|---|---|
| R1 | Row 1: 1 2 3 A | D9 |
| R2 | Row 2: 4 5 6 B | D8 |
| R3 | Row 3: 7 8 9 C | D7 |
| R4 | Row 4: * 0 # D | D6 |
| C1 | Column 1: 1 4 7 * | D5 |
| C2 | Column 2: 2 5 8 0 | D4 |
| C3 | Column 3: 3 6 9 # | D3 |
| C4 | Column 4: A B C D | D2 |
The pins are in the same order as the ribbon of the real keypad, left to right with the keys facing you. The keypad needs no power and no resistors: the Keypad library turns on the Arduino’s internal pull-ups on the rows and pulls one column LOW at a time.
All rows read HIGH through the pull-ups. The Arduino pulls column C1 LOW and reads the rows: if R2 is now LOW, key 4 (row 2, column 1) is pressed. Then C2, C3 and C4, many times a second. This is called scanning, and the keypad library for Proteus gives the Arduino the same voltages as the real keypad.
Example: Arduino Keypad Door Lock in Proteus
This Arduino keypad Proteus example reads the 4×4 keypad with an Arduino UNO. It is a small door lock that shows the code as stars on a Virtual Terminal: type 1 2 3 4 and then #, and a 12 V solenoid lock pulls in for 3 seconds. * clears the code.
The lock is the SOLENOID DEVICE from our solenoid library for Proteus: a real 12 V, 0.4 A coil. An Arduino pin can only give about 20 mA, so a relay module switches it.
- Place 4X4 MEMBRANE KEYPAD, an Arduino UNO, a relay module, a SOLENOID DEVICE, a 1N4007 diode, a 12 V DC supply and a Virtual Terminal.
- Wire R1 to R4 to D9, D8, D7, D6 and C1 to C4 to D5, D4, D3, D2, as in the table above.
- Relay module: VCC to 5 V, GND to GND, IN to D10.
- Solenoid: 12 V supply + to the relay COM, relay NO to the solenoid +, solenoid – to the 12 V GND. Put the 1N4007 across the coil, cathode to +.
- Terminal RX on the UNO TX (9600 baud). The UNO’s own L LED (D13) lights while the lock is open.
- In the Arduino IDE, install the Keypad library by Mark Stanley and Alexander Brevig (Tools → Manage Libraries, search
keypad).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
// 4x4 membrane keypad test for the ElectronicsTree Proteus model (ETKEYPAD.DLL)
//
// Circuit (Arduino UNO), keypad ribbon left to right:
// R1 -> D9, R2 -> D8, R3 -> D7, R4 -> D6 (rows: INPUT_PULLUP, Keypad.h reads them)
// C1 -> D5, C2 -> D4, C3 -> D3, C4 -> D2 (columns: pulled LOW one at a time)
// No resistors needed on the keypad.
// Lock: SOLENOID DEVICE (ElectronicsTree solenoid library, 12 V coil, 0.4 A) through a relay module
// Relay module: VCC -> 5 V, GND -> GND, IN -> D10
// 12 V supply + -> relay COM, relay NO -> solenoid +, solenoid - -> 12 V GND
// 1N4007 across the solenoid coil, cathode to +
// The UNO's own L LED (D13) lights while the lock is open.
// Virtual Terminal on TX (9600 baud).
//
#include <Keypad.h>
const byte ROWS = 4;
const byte COLS = 4;
char keys[ROWS][COLS] = {
{ '1', '2', '3', 'A' },
{ '4', '5', '6', 'B' },
{ '7', '8', '9', 'C' },
{ '*', '0', '#', 'D' }
};
byte rowPins[ROWS] = { 9, 8, 7, 6 };
byte colPins[COLS] = { 5, 4, 3, 2 };
Keypad keypad = Keypad(
makeKeymap(keys), rowPins, colPins, ROWS, COLS
);
const int LOCK = 10;
const int LED = 13;
const int RELAY_ON = HIGH;
const int RELAY_OFF = LOW;
const char SECRET[] = "1234";
char code[9];
byte len = 0;
unsigned long lockOff = 0;
void enterKey(char k) {
if (k == '*') {
if (len > 0) Serial.println(); // end the star line
len = 0;
Serial.println(F("Password cleared"));
return;
}
if (k == '#') {
code[len] = '\0';
Serial.println();
if (len > 0 && strcmp(code, SECRET) == 0) {
Serial.println(F("ACCESS GRANTED"));
Serial.println(F("Lock: UNLOCKED (3 seconds)"));
digitalWrite(LOCK, RELAY_ON);
digitalWrite(LED, HIGH);
lockOff = millis() + 3000;
}
else {
Serial.println(F("ACCESS DENIED"));
Serial.println(F("Lock: LOCKED"));
}
Serial.println();
len = 0;
return;
}
if (len >= sizeof(code) - 1) return; // code full: ignore extra keys
if (len == 0) Serial.print(F("Password: "));
code[len++] = k;
Serial.print('*'); // one star per key, same line
}
void setup() {
Serial.begin(9600);
digitalWrite(LOCK, RELAY_OFF);
pinMode(LOCK, OUTPUT);
pinMode(LED, OUTPUT);
keypad.setHoldTime(1000);
Serial.println();
Serial.println(F("================================"));
Serial.println(F(" KEYPAD DOOR LOCK"));
Serial.println(F("================================"));
Serial.println(F("Enter password and press #"));
Serial.println(F("Press * to clear password"));
Serial.println(F("Lock: LOCKED"));
Serial.println();
}
void loop() {
if (lockOff && millis() > lockOff) {
digitalWrite(LOCK, RELAY_OFF);
digitalWrite(LED, LOW);
lockOff = 0;
Serial.println();
Serial.println(F("Lock: LOCKED"));
Serial.println();
}
if (!keypad.getKeys()) return;
for (int i = 0; i < LIST_MAX; i++) {
if (!keypad.key[i].stateChanged) continue;
if (keypad.key[i].kstate == PRESSED) {
enterKey(keypad.key[i].kchar);
}
}
}Export the .hex file (Sketch → Export Compiled Binary), load it into the UNO and press Play. As you type the code, the terminal shows one star per key on a single line (Password: ****), so the code itself is never shown. Press * to clear what you typed. Type 1234#: the terminal shows ACCESS GRANTED, the relay clicks on, the solenoid pulls in and the L LED lights. After 3 seconds the lock closes again and the terminal shows Lock: LOCKED. A wrong code shows ACCESS DENIED and the lock stays shut. Many real relay boards switch on when their input is LOW. For those, set RELAY_ON to LOW.
New to simulating an Arduino? Our Arduino UNO R3 library for Proteus shows how to load a sketch, and the virtual serial terminal shows the messages.
While the simulation runs, Ctrl + click the keys 1, 2 and 4 so they stay down. The terminal shows four stars, not three: the fourth is 5, a key nobody pressed. 1, 2 and 4 sit on three corners of a rectangle in the matrix, and together they connect row 2 to column 2 as if 5 were pressed. Real membrane keypads have no diodes, so they do the same. Click the keys again to let them go.
Keypad Library for Proteus: Properties
Double-click the keypad to change it:
| Property | What it does | Default |
|---|---|---|
| Contact Bounce (ms) | Each press and release bounces for this time, like a real contact. 5 is realistic, and the Keypad library debounces 10 ms. 0 = clean edges | 0 |
| Shortest Press Seen (ms) | A quick click is held at least this long in the simulation, so the sketch never misses it. 0 = exactly as clicked | 50 |
Under Advanced Properties: the resistance of a pressed key (100 ohm) and of an open key (100 Mohm).
4x4 Keypad Proteus Troubleshooting
If the Arduino reads nothing or the wrong key, check these first. The keypad library for Proteus also writes a warning in the simulation log for wiring mistakes.
| What you see | Cause and fix |
|---|---|
| The key goes down, the sketch reads nothing | The row and column pins in the sketch do not match the wiring. Rows go in rowPins, columns in colPins |
| Wrong key, e.g. 4 instead of 2 | Rows and columns swapped, or the pin order reversed. Compare with the pin table above |
| Clicking a key does nothing | The simulation is not running (keys only work while it runs), or the click is not on a key |
| An extra key that you did not press | A ghost key: three held keys on the corners of a rectangle. Normal for a keypad without diodes |
| One click gives several presses | Contact bounce is on and the sketch does not debounce. Use the Keypad library (it debounces), or set Contact Bounce to 0 |
| “shorted through the key” warning | Two pins drive opposite levels through a pressed key. Rows must be inputs with pull-ups, and only one column LOW at a time |
Download the Keypad Library for Proteus
The zip file of the keypad library for Proteus holds the model ETKEYPAD.DLL and the library ElectronicsTree[KEYPAD].LIB with the part 4X4 MEMBRANE KEYPAD.
Installing it takes two minutes (see the steps right below). Looking for more parts? Browse all our free Proteus libraries.
We’re always looking to expand our library collection based on what our community needs. If you’re looking for a specific Arduino module, sensor, or component that we don’t currently offer, we’d love to hear from you!
Reach out to us at help@electronicstree.com with your requests. We prioritize new library development based on community demand, so your suggestion could be our next addition.
Join the official WhatsApp channel of ElectronicsTree to stay updated with the latest electronics tutorials, Proteus libraries, Arduino projects, and simulation resources.
How to Install the Keypad Library for Proteus 8
New to adding libraries? Our guide how to install a library in Proteus 8 shows where the Proteus folders are.
- Close Proteus.
- Copy the files into the Proteus data folder, normally
C:\Program Files (x86)\Labcenter Electronics\Proteus 8 Professional\DATAETKEYPAD.DLLgoes intoDATA\MODELSElectronicsTree[KEYPAD].LIBgoes intoDATA\LIBRARY
Program Files: click Continue. - Start Proteus, open Pick Devices (press P) and search for
membrane keypad. The part is in the category Sensor and Modules.
The keypad library for Proteus is a library, not Proteus itself: the software comes from Labcenter Electronics, who also offer a free demo on their website.
Frequently Asked Questions
Is there a 4x4 keypad library for Proteus?
Yes. This free keypad library for Proteus adds the 4×4 membrane keypad with the 8-pin ribbon to Proteus 8, with 16 real contacts and keys you click with the mouse.
How do I connect a 4x4 keypad to an Arduino in Proteus?
Wire the four row pins R1 to R4 and the four column pins C1 to C4 to eight Arduino pins and list them in rowPins and colPins of the Keypad library. No resistors and no power pins are needed.
How do I press a key in the Proteus simulation?
Start the simulation and hold the left mouse button on the key. Ctrl + click keeps a key pressed until you click it again.
Can I press two keys at the same time?
Yes. Ctrl + click the keys you want to hold. The Keypad library reads up to 10 keys at once with getKeys().
Why does my Arduino see a key I did not press?
That is a ghost key. With three keys held on the corners of a rectangle, the fourth corner is connected too. Real membrane keypads do the same, and the 4×4 keypad Proteus model shows it.
Does the keypad work with an ESP32 in Proteus?
Yes. The keypad is only switches, so it works with any board and any logic level, including 3.3 V ESP32 pins.
Is this keypad Proteus library free?
Yes. Download the keypad library for Proteus from this page. The zip holds the model DLL and the library.
More Libraries for Proteus
Like the keypad library for Proteus? Try these next:
- RC522 RFID library for Proteus: add a card reader to the door lock
- Solenoid valve library for Proteus: the solenoid lock in the example, and a 12 V water valve
- Arduino relay module library for Proteus: switch a lock or a lamp
- OLED library for Proteus: show the code on a display
- Arduino Nano library for Proteus: a smaller board for the keypad
Conclusion
This keypad library for Proteus lets you build and test your Arduino keypad project before the hardware is on the desk: a 4×4 membrane keypad with 16 real contacts, keys you press with the mouse, several keys at once with real ghost keys, optional contact bounce and warnings for wiring mistakes.
Questions, or a module you want next? Write them in the comments!