Input Devices
Atoms → bits
Hardware transducers that convert physical actions into electrical signals. Each has its own protocol for reporting state to the computer.
How It Works
Input devices are transducers — they convert one form of energy into another. A keyboard converts mechanical force into electrical signals through a switch matrix. A mouse converts physical movement into displacement values through an optical sensor. A microphone converts air pressure waves into voltage variations through a diaphragm and analog-to-digital converter.
Despite their physical diversity, virtually all modern input devices communicate with the computer using the USB Human Interface Device (HID) protocol. HID defines a universal report descriptor format — keypresses, button states, movement deltas, touch coordinates — so operating systems can handle them without device-specific drivers. Wireless devices use Bluetooth HID Profile (HID-over-GATT for BLE), which wraps the same report format over a radio link.
The Signal Flow
Key Concepts
A grid of rows and columns on a PCB. The keyboard controller scans each intersection at 1–8 kHz to detect closed circuits (pressed keys). N-key rollover requires diodes at each intersection.
A hardware-level key identifier — just a number like 0x04 for 'A'. The OS maps scan codes to keycodes, then to characters based on the active keyboard layout.
The universal Human Interface Device protocol. A report descriptor tells the OS what each byte means — key states, axis values, button bits. Works for keyboards, mice, gamepads, and touchscreens.
How often the device reports its state. Standard USB keyboards: 125 Hz (8 ms). Gaming mice: 1000–8000 Hz (1–0.125 ms). Higher rates reduce input latency.
Deep Dive
How keyboards actually work
A keyboard's PCB has a matrix of row and column traces. The controller activates one row at a time and reads which columns are connected — each intersection is a key. Mechanical keyboards use individual metal-contact switches; membrane keyboards use pressure pads over conductive traces. The controller debounces the signal (filtering out the ~5 ms of contact bounce) and generates a scan code for each key-down and key-up event. These scan codes are packed into 8-byte USB HID reports sent at the polling rate.
The camera pipeline
A camera's CMOS sensor captures photons as analog voltages in a Bayer-pattern grid (RGGB). An Image Signal Processor (ISP) demosaics the raw data into full RGB pixels, applies white balance, exposure correction, noise reduction, and then compresses frames into H.264 or MJPEG. The compressed stream is delivered to the computer via USB Video Class (UVC) — a standard that lets any camera work without custom drivers. At 1080p 30fps, the raw sensor data exceeds 1.5 Gbps before compression.