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
*What’s Joshua Domotica

What’s the Joshua bus?

Joshua bus is my home automation project (also called domotica) to control lights, blinds, audio etc.
When i was 15 years old i got the idea to automate my room so that with 1 press on the infrared remote the blinds will shut and all the lights will go on. With another press on the remote there’s music. In the 80’s that was easier said then done. As you can see on the photo the old controller is a 19″ rack with eurocards inside. For example the 96 channel ir-receiver is 1 complete eurocard.

Begin
The 19″ inch rack from the early days

This was a central controller design, so the wiring was a lot work and not flexible at all. If you changed the software the whole room was out of order. The new design is using decentralize system, there are al standalone modules that controlling 1 to 5 functions. All the modules are connected with a halfduplex Rs-485 network, but the software network layer can also be implanted over a wireless link or even Tcp/ip. The software for all the modules can be remote updated via the Rs-485 trough a bootloader, so no need to walk trough the house with a laptop. For all the modules i use one of the Atmel Avr-risc processor’s programmed with Bascom-Avr, and the bootloader is written in C. These Atmel processor’s are available in different size and future’s, fast and reliable. The ir receiver will use now 2 lines code and 1 ir-receiver 5x5mm in size. For more information of the service software read this. The biggest problem automating the house is now the mechanical part. Driving the blinds is not that difficult with a H-bridge, but connecting a motor to the blinds is difficult. You can buy blinds with a motor, but a cabinet with electric slide doors doesn’t exist so you must made it yourself and that will take time.
Why do you call it Joshua Bus? It must have a name and one of my favorite movies is Wargames  (1983) with Matthew Broderick as a computer hacker. He hacks the wargame computer and give him the name Joshua, the sons name of the computer designer. Go rent the movie and see it your self.
Take a look at all the projects related to the Joshua bus and if you have question’s let me know.

Update 2016: The technology goes fast. I’m working now on a new Tcp/ip gateway based on a Arm Stm32F4 processor that can connect all the smartphones in house with the Joshua bus.
Software for the phone is written in B4A, with this it’s easy to quick develop application.

Update 2017: My domotica is extended with a lot of new nodes. Most of this node are now communicating over wifi, 433mHz or Zigbee.
Due the new Esp8266 chips from Espressif Systems there’s an new era for domotica and Iot, it’s now so easy to design. Have a look at the Esp8266 and Esp32 section for the newest nodes with pcb designs and firmware examples.

Joshua
WOPR with Joshua