Main Content

This optical keyboard/keypad is a low-cost optical user input device capable of deployment underwater, explosive gas areas, or in other locations where hermetic sealing is desirable. It does not use capacitive, magnetic, mechanical, acoustic, or visible-light coupling. The reflection of an infrared beam is used at each keysite to determine finger presence. No part of this device need be in actual contact with the outside medium; a transparent window (possibly of variable thickness) may optionally be used. Emphasis is on ease of construction, low component count and cost, and low software processing cost. A current tradeoff is lack of operation capability in direct sunlight, which can be improved by inverting the present phototransitor biasing and additional software work.


Refer to the HardwareOverview (cross-sectional) diagram. Layer 1 is the outside environment; this can be the outside medium directly, or it can be a pressure hull (e.g. plastic or glass). Layer 2 is a transparent acrylic lightpipe layer; item 7 is key-cap legend etchings that will emit light due to white LEDs at items 9. Layer 3 is an infrared-passing but visually black filter; this provides the black background for layer 2. In this way, layer 2’s key-cap legend markings are visible in full sunlight as well as in full darkness. Additionally, layer 3 hides the underlying holes and components. Layer 4 is a translucent (“frosted”) filter which increases reliability by decreasing false finger-over events because it diffuses the outgoing and incoming beams unless a finger is in close proximity. Layer 5 is a hard plastic 4mm shadow-mask layer that guides the beams of light up and down only, preventing lateral crosstalk between LED and photosensor at each keysite at measurement time. Layer 6 is the PC board; items 8 are the fast high-power infrared LEDs and photosensors.


Each keysite has an infrared LED and an infrared phototransistor (PT). Both LED and PT are capable of switching on/off in the dozens of nanosecond range. The LED is a high intensity type with 940nm output and a 15-degree beam angle (Vishay VSMB294008G) and the PT is closely matched to the LED and has a 24-degree sense angle (ON Semiconductor QSB363GR). The PT is connected via a low-loss MUX switch (Texas Instruments TMUX1108) to an op amp used as a voltage follower buffer (Texas Instruments OPA350) and then on to a 10-bit A/D converter inside the MCU (Microchip PIC16F18855).

The keyboard matrix is organized as 48 (LED, PT) pairs, physically arranged in a 12x4 array, but electrically arranged as a 6x8 matrix. Regarding the 6x8, the 6 represents 6 “voltage +” channels, switched P-channel MOSFETs, and the 8 represents 8 “ground return” bits, switched by N-channel MOSFETs. The voltage channels power their bank of 8 LEDs. The ground return bits select LEDs by connecting cathode(s) to ground as well as provide (and thus enable) the PTs voltage-divider ground. A separate 1-of-6 MUX is used to select a single bank’s PT for measurement.


The LEDs are capable of some 60mA continuous current, however, they are also capable of being driving harder for a shorter period of time. Here, we drive them at about 230mA for just under 70uS at 1/48 duty cycle. The datasheet gives a hard deadline of 100uS; the software is critical in this regard: a bug could cause hardware damage if it were to leave LED(s) on continuously. I justify that this is OK for this project because the microcontroller is dedicated to only this and is not running any interrupts nor watchdog timers. A single integrated software loop with an emergency exit controls the LED on/off while polling for A/D conversion completion.”

Link to article