Skip to main content

Command Palette

Search for a command to run...

Working Of Keyboard

Published
•3 min read•View as Markdown
Working Of Keyboard
S
Teaching myself how to code

The keyboard is an essential input device that allows us to communicate with computers and other electronic devices by typing characters. The process of the keyboard's operation involves a series of steps that are triggered when a key is pressed. Here is a simple breakdown of how a keyboard works:-

Key Press:-

When you press a key on the keyboard, you initiate the process. Underneath each key is a small rubber dome with two layers of conductive material. When you press a key, the dome collapses, and the two conductive layers come into contact.

Circuit Completion:-

The contact between the two conductive layers creates an electrical circuit. This circuit completion is detected by the keyboard's controller.

Controller Recognition:-

The keyboard's controller is a small microprocessor responsible for managing the communication between the keyboard and the computer. It scans the keyboard matrix (arrangement of keys in rows and columns) to determine which key was pressed.

Scan Code Generation:-

Each key on the keyboard corresponds to a unique scan code – a numerical value that identifies the key's position. When a key is pressed, the controller generates the scan code associated with that key.

Buffering:-

The generated scan code is temporarily stored in a buffer within the keyboard's controller. This buffer holds the scan code until the computer is ready to process it.

Transmission to Computer:-

The keyboard controller sends the scan code to the computer through a connection, usually a USB or PS/2 port. This transmission can be done through a wired or wireless connection, depending on the type of keyboard.

Computer Processing:-

The computer's operating system receives the scan code from the keyboard. It then translates the scan code into a corresponding character using keyboard drivers and mapping tables. This is how the computer understands which character you intended to type.

Character Display:-

Once the computer translates the scan code into a character, it processes the character as input for the active application or text field. The character might appear on the screen or trigger a specific action, depending on the context.

Release Detection:-

When you release the key, the rubber dome underneath it returns to its original shape. This action breaks the contact between the conductive layers, which interrupts the electrical circuit.

Key Release Signal:-

The keyboard's controller detects the interruption of the circuit and generates a key release signal.

Transmission and Processing:-

Similar to the key press process, the key release signal is sent to the computer, processed by the operating system, and translated into the appropriate action or character release.

In essence, a keyboard works by converting physical key presses into electrical signals, which are then translated into characters by the computer. This interaction is nearly allows us to communicate, type documents, send emails, play games, and perform a multitude of tasks. It's a remarkable example of how hardware and software seamlessly collaborate to make our digital interactions possible.

More from this blog

Sunil Kumar

14 posts

I'm Sunil, a full-stack dev learning networking and systems from the ground up. I write about what I learn as I go - protocols, projects, and things that took me way too long to understand. If you're learning too, you'll feel right at home.