Extension board · Controls and displays

16-key keypad

Sixteen push buttons marked like a telephone keypad plus A to D, read through two I2C wires. Each key has its own diode, so several keys can be told apart when held together. Reading it needs your own driver.

Top view of the keypad board: sockets at the upper left and right, a Qwiic connector on top and a four by four grid of push buttons.
Top view, drawn from the board’s design files. This is a drawing, not a photograph.
16 keys4 × 4 with a diode each
0x20 to 0x27I2C address
PCF8574expander, 100 kHz
Interruptcontact 3
I2C + Qwiic3.3 V
90 × 120millimetres, four M3 holes

Tech specs

PurposeA numeric or macro keypad on a machine. Never an emergency stop or safety control; not sealed against coolant or chips
Keys16 through-hole 12 mm switches at 17 × 19 mm spacing, legends on the board
InterfaceTI PCF8574 I2C expander, 100 kHz maximum, address 0x20 plus links
InterruptLow when a column changes, with a 10 kΩ pull-up
Supply3.3 V
ConnectorsTwo Gadgeteer type I sockets (Samtec SHF-105, 1.27 mm) and one Qwiic
Size90 × 120 mm, four M3 holes on an 80 × 110 mm pattern
Works withSmoothieboard V2 Prime header GG electrically; no firmware driver
LicenceOpen hardware, CERN-OHL-S-2.0

Every figure with its basis is in the electrical specifications appendix; hole positions are in the mounting dimensions appendix.

Board tour

The numbers on the drawing match the list below it. The board is shown from the component side.

  1. 1
    Input socket I IN (J1) — SDA on contact 8, SCL on 9, interrupt on 3.
  2. 2
    Chain socket CHAIN (J2) — Continues the bus.
  3. 3
    Qwiic connector (J3) — The same bus on a four-way cable.
  4. 4
    I/O expander (U1) — PCF8574: four lines drive rows, four read columns.
  5. 5
    Keys (SW1 to SW16) — Read by row and column.
  6. 6
    Key diodes (D1 to D16) — One per key, preventing false readings with several keys held.
  7. 7
    Address links (JP10 to JP12) — Add 1, 2 and 4 to the base address when closed.
  8. 8
    Pull-up links (JP1, JP2) — Closed as delivered.
  9. 9
    Chain links (JP3, JP8, JP9) — Interrupt open; bus closed.
  10. 10
    Mounting hole — One of four M3 holes.
Point at a number, or tap it, to read what the part is; the same text is in the list. On a small screen, scroll the drawing sideways.

Pinout

Check contact numbering with the power removed before wiring by hand.

J1: input socket (I IN)

ContactSignalUsePrime header GG
13.3 VBoard supply3.3 V
25 VPassed to the chain only5 V
3INTKey change interruptPH2
4 to 7Passed throughNot usedPH4, PC0, PF15, PH3
8SDAI2C dataPF0 (I2C2_SDA)
9SCLI2C clockPF1 (I2C2_SCL)
10GNDGroundGND

Key matrix on the expander

A pressed key connects its row to its column.

Row lineP4P5P6P7
P0123A
P1456B
P2789C
P3*0#D

What you need

An I2C portPrime header GG or a Qwiic host.
A cableGadgeteer ten-way or Qwiic.
A free addressOther PCF8574 devices, such as an LCD backpack, share the 0x20 to 0x27 range.
Your own driverNone is supplied.

Get started

Minimum wiring: contact 1 to contact 1, 3.3 V; PH2, contact 3 to contact 3, interrupt (optional); PF0, contact 8 to contact 8, SDA; PF1, contact 9 to contact 9, SCL; contact 10 to contact 10, ground. Prime header GG (J38) Keypad J1 contact 1contact 13.3 V PH2, contact 3contact 3interrupt (optional) PF0, contact 8contact 8SDA PF1, contact 9contact 9SCL contact 10contact 10ground
Four wires, plus the optional interrupt.
  1. Mount the board

    Use all four holes: pressing keys loads the board.

  2. Connect with the power off

    Use J1 or Qwiic.

  3. Scan the keys

    Write ones to P4 to P7, drive one row low at a time (write 0xFE, 0xFD, 0xFB, 0xF7) and read the byte.

    A pressed key in the driven row reads as a zero in its column bit.

Configuration

You wantModuleExample
Read key pressesNoneNo SmoothieV2 driver for this expander

There is nothing to add to config.ini.

How it works

The expander drives rows and reads columns; diodes isolate the keys. Rows P0 to P3driven low Diodeone way Keycloses Columns P4 to P7read low
One key position of the matrix.

The columns are held high by weak current sources inside the expander. The driver pulls one row low; a pressed key in that row pulls its column down through its diode to about 0.63 V, which reads as zero. To use the interrupt, hold all rows low while idle so that any key changes a column, then scan row by row.

Solder links

With all address links open the address is 0x20. Open JP1 and JP2 when the bus already has pull-ups.

Solder links as delivered: JP1 closed; JP2 closed; JP3 open; JP8 closed; JP9 closed; JP10 open; JP11 open; JP12 open. JP1 · closedSDA pull-up JP2 · closedSCL pull-up JP3 · openchain interrupt JP8 · closedchain SDA JP9 · closedchain SCL JP10 · openaddress +1 JP11 · openaddress +2 JP12 · openaddress +4
The links as delivered. Close one with a small blob of solder across both pads; open it by removing the solder or cutting the copper between the pads.
LinkWhat it doesAs delivered
JP1Connects the SDA pull-upClosed
JP2Connects the SCL pull-upClosed
JP3Joins the interrupt to the chainOpen
JP8Continues SDAClosed
JP9Continues SCLClosed
JP10Adds 1 to the addressOpen
JP11Adds 2 to the addressOpen
JP12Adds 4 to the addressOpen

Chaining

Further I2C devices can follow, each with its own address.

The controller's ribbon cable goes to the connector I IN of the keypad board. Inside the board each of the ten pins runs through a solder link to the connector CHAIN, where a second ribbon cable continues to the next board. A closed link passes its pin on, an open link stops it. Controller one ten-pin port keypad board I IN CHAIN pin 3, interrupt stops here pin 8, SDA passed on pin 9, SCL passed on one solder link per pin Next board sees what is passed on
Chaining: one port of the controller serves two boards. Pin 1 of I IN leads to pin 1 of CHAIN, pin 2 to pin 2, and so on, each through its own solder link. The three lines stand for the ten pins and show the links as delivered. Two boards must never drive the same pin, and a pin that one board uses for a signal is not free for the next. The bus continues; the interrupt stops here.
ContactSignalOn CHAIN
1, 2, 10Power and groundPassed on
3InterruptStopped by open JP3
4 to 7FreePassed on
8, 9I2CPassed on through closed links

Troubleshooting

SymptomLikely causeWhat to check
No answer on the busWiring, address or clock above 100 kHzCheck links JP10 to JP12 and use 100 kHz
All keys read highNo row driven lowDrive one row low before reading
A whole column reads lowColumn bit written as zeroWrite ones to P4 to P7
One key deadSoldering of its switch or diodeInspect that key
No interruptRows not low while idleHold rows low while waiting

The board has no indicator lights; use the test points.

Still stuck? Read how to ask for help or see the general troubleshooting guide.

Downloads

FileWhat it is
Schematic (PDF)The circuit diagram
Parts list (CSV)Every component with its value, footprint and part number where one is chosen
Board drawing (PNG)The top view used on this page
3D view, top (PNG)Rendered from the design files; the switch bodies are approximate models
3D view, angled (PNG)Rendered from the design files; the switch bodies are approximate models

Appendix: mounting dimensions

For drilling a mounting plate or designing an enclosure. Positions are hole centres, in millimetres, measured from the top-left corner with the board seen from the component side.

Mounting drawing of the keypad board, component side: outline 90 by 120 millimetres with 4 mounting holes. Hole positions are listed in the table below. COMPONENT SIDE · millimetres 90 120 0, 0 X Y 1 5.00, 5.00 2 85.00, 5.00 3 5.00, 115.00 4 85.00, 115.00 Numbered rings are mounting holes. Positions are hole centres, X then Y, from the marked corner.
Board outline 90 × 120 mm, corners rounded to a 1 mm radius, board thickness 1.6 mm. Drawn from the design files, component side up, in the same orientation as the board tour.
HoleX (mm)Y (mm)DiameterUse
15.005.003.2 mm, not platedMounting, M3 screw
285.005.003.2 mm, not platedMounting, M3 screw
35.00115.003.2 mm, not platedMounting, M3 screw
485.00115.003.2 mm, not platedMounting, M3 screw

Appendix: electrical specifications

Every figure is a design value, a calculated or simulated value, or a manufacturer’s data sheet value, as the last column says. A dash means no figure is given.

ParameterApplies toLowerNominalUpperBasis
SupplyJ1 contact 1—3.3 V—Design
I2C clockU1——100 kHzTI data sheet
Column pull-up currentP4 to P730 µA—310 µATI data sheet
Pressed-key column levelP4 to P7—0.63 V0.99 VSimulated; limit is the input low level
Bus rise time, 100 pFSDA, SCL—280 ns1000 nsSimulated
Pull-up current, both lines low3.3 V—2.0 mA—Calculated

Component stress limits

PartLimitUse on this board
Any signal3.3 V designDo not connect 5 V logic
Capacitors10 V and 16 V3.3 V

Appendix: simulation

A pressed key with its diode, and the I2C bus loading, were simulated with ngspice.

Each simulated value (yellow mark) against its allowed range (green band). Pressed-key column level (input low limit 0.99 V)631 mV I2C rise time 30 to 70 %280 ns
Simulated value (yellow) against the limit used for it (green). Each bar has its own scale.
ResultSimulated valueLimitOutcome
Pressed-key column level (input low limit 0.99 V)631 mVat most 990 mVWithin
I2C rise time 30 to 70 %280 nsat most 1 µsWithin

Not simulated: key bounce and mechanical life, because no switch part number is fixed.

Appendix: datasheet

The first page of the expander data sheet. Click the page to open the PDF.

First page of the PCF8574 remote 8-bit I/O expander datasheet
PCF8574 remote 8-bit I/O expander — Texas Instruments, 39 pages.

See all boards on the extension boards page.

This is a wiki! If you'd like to improve this page, you can edit it on GitHub.