1Wire Keypad

Before there where touch-panels etc. to control my Joshua domotica I designed an 1-wire keypad with 16 buttons.
As the title suggest it uses only 1wire to communicate with the micro controller instead of 8 pins for a 4×4 matrix.
Quickly after I build this it was replaced with an 5″ touchscreen. Key pads are not that flexible if you often add devices to the Joshua bus.
The hart of the electronics is the Dallas (Now these days Maxim) 1-wire DS2408 8-channel addressable switch.
The concept of the keypad is same as most of the keypads, keys are arranged in a 4×4 matrix.
Also the reading of the keypad is the same as most of the matrix keypads.
You make 1 column at the time high and scan the rows to see if one of the inputs becomes high. From this combination of row & column you can determine what key is pressed.

Design is simple one layer pcb, home made. The switches are cheap tact switches. They are behind a Coreldraw design front panel that’s printed on front panel folie and sealed with transparent protective folie. To make it easier to press the button you need to drill the holes in the aluminum plate bigger the then the tact switches, 10mm is enough.
If you need to press to hard to activate the tact switch you can add some tape or leftover front panel folie between the front panel folie and the tact switch.

Keypad
Back
Tact switch mount overview
PlayPause
previous arrow
next arrow
 
Keypad
Back
Tact switch mount overview
previous arrow
next arrow

Update 29-04-2016:
There’s no schematic anymore because the used cad program won’t run under windows 8, but with the help of the source code it’s easy to redraw.

Here’s the code to control the DS2408 with Bascom.

'==========================================
' 1 Wire Keypad with ds2408 ver 1.0
'==========================================

Readkeypad:
 Row(1) = &B01111111                                        'Define rows,
 Row(2) = &B10111111                                        'Looks strange, but needed for
 Row(3) = &B11011111                                        'for simple pcb design
 Row(4) = &B11111110

 For Rowlus = 1 To 4                                        '4 rows to scan
 Gosub Setupds2408                                          'setup the pio
 1wreset                                                    'reset 1 wire
 Ar(1) = &HCC                                               'Skip read rom command
 Ar(2) = &H5A                                               'channel access write
 Ar(3) = Row(rowlus)                                        'scan row
 Ar(4) = &HFF - Ar(3)                                       'inverted byte
 1wwrite Ar(1) , 4                                          'write 4 bytes to ds2408
 Ar(1) = 1wread(2)                                          'read 2 bytes, ar(1) is "verification" but not used in this sample
 A = Ar(2) And &B00011110                                   'Mask ar(2) byte for columns
  Select Case A
  Case 30 : Key = 0                                         'no key pressed
  Case 28 : If Rowlus = 1 Then Key = 2                      'key pressed on column 1
            If Rowlus = 2 Then Key = 3                      'easy assign a value to a key
            If Rowlus = 3 Then Key = 4                      'in this sample we use keys 1-16
            If Rowlus = 4 Then Key = 1
  Case 26 : If Rowlus = 1 Then Key = 6                      'key pressed on column 2
            If Rowlus = 2 Then Key = 7
            If Rowlus = 3 Then Key = 8
            If Rowlus = 4 Then Key = 5
  Case 22 : If Rowlus = 1 Then Key = 14                     'key pressed on column 4
            If Rowlus = 2 Then Key = 15
            If Rowlus = 3 Then Key = 16
            If Rowlus = 4 Then Key = 13
  Case 14 : If Rowlus = 1 Then Key = 10                     'key pressed on column 3
            If Rowlus = 2 Then Key = 11
            If Rowlus = 3 Then Key = 12
            If Rowlus = 4 Then Key = 9
  Case Else : Key = 0                                       'occurs when more then 1 key pressed
 End Select
 If Key > 0 Then Exit For
 Next Rowlus
Return

Setupds2408:
1wreset
 Ar(1) = &HCC                                               'skip read rom
 Ar(2) = &H5A                                               'channel access write
 Ar(3) = &B00011110                                         'setup pio
 Ar(4) = &HFF - Ar(3)                                       'inverted byte
 1wwrite Ar(1) , 4                                          'write 4 bytes ds2408
 Ar(1) = 1wread(2)
Return