![]()
Plug a "10-Key Serial Keypad" into your next BASIC Stamp application for less than the price of lunch.
![]()
Take a handful of ordinary push-button switches and turn them into a "Custom Serial Keypad". You can use only 1, or up to 10 individual push-button switches, or a common buss keypad and interface it with your BASIC Stamp projects using a single I/O-pin.
Why tie-up all your I/O-pins just trying to implement a simple keypad interface in your BASIC Stamp projects/products...? Here's the answer...! Hookup a 10-key serial keypad using our new Ser-Key encoder/controllers.
Our new 10-key keypad encoder takes input directly from a 10-key common-buss keypad, or 10 simple push-button switches and outputs ASCII key values from 1 to 10 in asynchronous serial format. Ser-Key was designed primarily for users of the BASIC Stamp, but will work with any microcontroller capable of accepting asynchronous serial data.
Below is the schematic showing how simple it is to interface a 10-key common-buss keypad, or 10 ordinary push-button switches to the Ser-Key serial keypad encoder.
"Ser-Key" 10-Key Serial Keypad Encoder

Click picture for larger view
"Ser-Key" 10-key keypad/Push-Button Switch
interface
VALID:
The VALID pin goes LOW for 100mS to signal that a key-press has occurred. When the
BASIC Stamp samples this pin, a logic high indicates that no keys have been pressed, and
your program can proceed to process other variables. When the user presses a key,
the VALID pin will remain low until the key is released. The ASCII value for the key
will be sent serially, [after] the key has been released, and the VALID pin will return to
a logic high level.
RS-232:
The RS-232 pin is the serial data line that sends the ASCII value corresponding to
individual key-presses to the BASIC Stamp via asynchronous serial transmissions.
BAUD:
The BAUD pin lets you select N2400, or N9600 by simply applying the appropriate logic
level to the baud rate selection pin as shown above.
Note: You can change the baud rate on-the-fly by changing the logic
state of the baud-pin during normal operation without a full reset. Simply place
the baud selection jumper at the appropriate logic level during operation to
change the baud rate.
Keys #1 through #10:
Keys #1 through #10 are connected to simple [normally-open] push-button switches, or
an inexpensive common-buss keypad. When a key is pressed, it's ASCII value, 1 to 10
is sent to the BASIC Stamp.
Super Quiet Operation:
Since Ser-Key doesn't operate in the same manner as normal keypad scanning
devices, there isn't excessive noise in the circuit. Ser-Key silently monitors the
logic levels of each of the input pins for a transition from high to low. This high
to low transition causes Ser-key to transmit the ASCII value of the key pressed, [after
the key has been released].
It's obvious that most efficient way to add any new piece of hardware to a new design is to attach it using a single I/O-pin. Keypads are a simple way to implement a user interface, but in the past they were considered to be real I/O-hogs and often meant that you had to give up more I/O-pins than you could afford to. Ser-Key makes the addition of a 10-key user interface extremely simple, and even the most limited microcontrollers with asynchronous serial capabilities can now enjoy the addition of a [single-pin], 10-key, keypad interface.
Using the PIC16C620A microcontroller as a secondary processor to intercept/encode key-presses also eliminates the normal scanning routines necessary for a direct keypad interface. BASIC Stamp designs can benefit greatly with Ser-Key and integrate a simple & effective user interface with an absolute minimum of code requirements. Below is the second part of the schematic to build your own serial keypad interface with the Ser-Key serial keypad encoder kit.

Click picture for larger view
Ser-Key Push-Button Switch Hookup Diagram
Ser-Key is simple, fast and efficient. You can build Ser-Key on the bread board or design your own circuit boards. Take a handful of ordinary push-button switches and turn them into a custom serial keypad. No more need to buy those expensive matrix keypads with decoder ICs that only complicate the design and take you way over budget for a simple keypad interface.
Simple BASIC Stamp II code to recognize incoming key-data.
start:
if in2 = 0 then keypress ' If VALID has pulsed "LOW" on input pin
#2, a key has been pressed.
goto start
keypress:
serin 0,16780,[b0] '
Grab incoming key-data at [N2400 Baud] and place data in B0.
debug "Key #", dec b0,"
was just pressed..",cr
goto start
The first part of the routine start, waits for the I/O-pin in2 to be brought to a logic 0 level. Once this pin is pulled low by the data valid pin from Ser-Key, program execution falls through to keypress, which then processes the serial data received from Ser-Key and uses debug to display each keys value received on the debug screen. The dec prefix used with debug displays the decimal value for the key that has been pressed.
This is a very simple example, but it's sufficient to show how simple Ser-Key is to implement.
![]()
The BASIC Stamp I can really benefit from Ser-Key due to the limited I/O capacity of a meager 8-pins. Using only a single I/O-pin to interface to a 10-key keypad makes Ser-Key a must for people still using the BASIC Stamp I, and anyone not willing to give up from 4 to 7 I/O-pins for a simple keypad interface.
NOTE: Even with extremely fast key-presses, the VALID pin remains at a logic low for approximately 100mS. This is pre-programmed into Ser-Key to maintain the data valid pin low for a period of approximately 100mS. This makes it a simple task for the BASIC Stamp to intercept the incoming data by occasionally sampling the data valid pin and vector to the serial data handling routine.

Ser-Key in operation
The dual scope trace above shows how Ser-Key operates. Trace A is the valid-pin output. Trace B is the serial data being sent on the rising edge of the valid-pin. This is an example of what happens during a normal key-press much the same as someone pressing the keypad on a simple remote control transmitter unit. The valid data output-pin stays at a logic low until the key is released.
Since Ser-Key holds the data valid pin low until each key has been released, your applications will normally have plenty of time to recognize each key-press.
Here's a dual scope trace showing how Ser-Key reacts to fast key entry:

Fast Key-Strokes
As shown above, even extremely fast key-strokes aren't missed by Ser-key. Scope trace A shows the time between each key-press. The high time is the time the key remained in the up position [after the 100mS valid delay time]. The low time indicates the logic low time for the valid pin. Notice how valid is held low for 100mS even during fast key-presses.
Note: It's doubtful that anyone can press keys faster than 100mS, so this delay time is beneficial to help ensure that the BASIC Stamp, or other microcontroller doesn't miss incoming key data.
Converting a Standard Keypad to a "Serial Keypad":
Ser-Key will let you easily transform a standard 10-key common bussed keypad or simple push-button switches into a "serial keypad". Integrate Ser-Key into your existing designs and free up some I/O-pins, or create your own serial keypads. You're only limited by your imagination......;o]
The Ser-Key kit consists of the following components:
(1) 4MHz ceramic oscillator (with internal capacitors). | |
(1) Pre-programmed "Ser-Key" PIC16F627A microcontroller. |
Turn simple push-button switches into a powerful "Serial User Interface" with Ser-Key. Connect as many switches as you need. 1, 2, 3, 4, etc... Up to Ten keys total for less than the price of a single generic matrix keypad. Ser-Key doesn't care how few, or how many [up to 10] keys you connect to it. Just hookup as many as you like, and away you go.
The Old Way:
Expensive Matrix keypads requiring additional, and often expensive encoder ICs. Hard to integrate into your designs, and even harder to design your own custom keypads using matrix layouts. Matrix keypads rarely have the exact numbers in the correct order unless you purchase custom designed keypads costing you a fortune. With matrix keypad interfaces you often give up as many as 4, 5, or even more valuable I/O-pins for a simple user interface.
The Easy Way:
Ser-Key with a handful of inexpensive push-button switches, and 1 to 2 I/O-pins.......
![]()
NOTE: Ser-Key was developed using the PicBasic Pro Compiler. If you currently own the PicBasic Compiler, we have the RAW BASIC code for Ser-Key with full schematics and details on how to build your own serial keypad encoders using PicBasic. Click HERE for the project.
Get PicBasic:
|
Click HERE to purchase PicBasic Compilers - and hardware. | |
|
Click HERE to learn more about the PicBasic compiler. | |
|
Click HERE to return to the PicBasic projects page. |
![]()
![]()