geekhack

geekhack Projects => Making Stuff Together! => Topic started by: variab1e on Thu, 16 March 2017, 09:45:26

Title: hand-wire keyboard if pins < cols+rows
Post by: variab1e on Thu, 16 March 2017, 09:45:26
I am looking to handwire a keyboard (almost a full keyboard) where the columns + rows will be greater than the 17 pins I have available on my Feather BluFruit 32u4. To my understanding I must have the same (or greater) number of pins on the controller as there are columns + rows. So what solution is there?

A i/o expander?
Or to make 2 columns on a single wire?

Any ideas? I'm sure this has been encountered and solved before. Any help is very much appreciated! Thanks!
-Eric
Title: Re: hand-wire keyboard if pins < cols+rows
Post by: ishtob on Thu, 16 March 2017, 11:59:20
2 columns on a single wire will increase the number of rows, so that would not really work either. i/o expander is probably the way to go with the feather
Title: Re: hand-wire keyboard if pins < cols+rows
Post by: joey on Thu, 16 March 2017, 12:05:56
It depends on the layout.

A 60% is 15 columns 5 rows. 15 * 5 = 75. But that's quite a few more keys than you need.

So a 60% can be 8 columns 8 rows. 8 * 8 = 64. That's just enough keys for a 60%
Title: Re: hand-wire keyboard if pins < cols+rows
Post by: vvp on Thu, 16 March 2017, 13:06:21
If your keyboard has more than 8*9=72 keys then read read this:
http://www.openmusiclabs.com/learning/digital/input-matrix-scanning/
... and select the method you like most.
Title: Re: hand-wire keyboard if pins < cols+rows
Post by: cribbit on Thu, 16 March 2017, 14:09:40
Why does a 32u4 board only have 17 pins?

As others have pointed out, for a standard grid matrix the most pins you can have is to get as close to a square as possible aka FLOOR($pins / 2) * CEIL($pins / 2) - for 17, that can be 8 * 9. This can require some funky wire routing but is functional.

The issue with more advanced input scanning methods is that they require additional hardware - resistors, chips.

I would just spend $5 to buy an Arduino Pro Micro from Aliexpress. That'll have enough pins.
Title: Re: hand-wire keyboard if pins < cols+rows
Post by: a-c on Thu, 16 March 2017, 14:53:01
Why does a 32u4 board only have 17 pins?

As others have pointed out, for a standard grid matrix the most pins you can have is to get as close to a square as possible aka FLOOR($pins / 2) * CEIL($pins / 2) - for 17, that can be 8 * 9. This can require some funky wire routing but is functional.

The issue with more advanced input scanning methods is that they require additional hardware - resistors, chips.

I would just spend $5 to buy an Arduino Pro Micro from Aliexpress. That'll have enough pins.

The board he is using has BLE built in and some of the pins are dedicated to that.
Title: Re: hand-wire keyboard if pins < cols+rows
Post by: cribbit on Thu, 16 March 2017, 15:26:57
Why does a 32u4 board only have 17 pins?

As others have pointed out, for a standard grid matrix the most pins you can have is to get as close to a square as possible aka FLOOR($pins / 2) * CEIL($pins / 2) - for 17, that can be 8 * 9. This can require some funky wire routing but is functional.

The issue with more advanced input scanning methods is that they require additional hardware - resistors, chips.

I would just spend $5 to buy an Arduino Pro Micro from Aliexpress. That'll have enough pins.

The board he is using has BLE built in and some of the pins are dedicated to that.

Ah, interesting.

OP you may find it easiest to look into using TRRS (check out the Let's Split) and having one controller for BT and one controller for actually reading the matrix. This would give you plenty of pins.
Title: Re: hand-wire keyboard if pins < cols+rows
Post by: variab1e on Thu, 16 March 2017, 15:31:34
Why does a 32u4 board only have 17 pins?

As others have pointed out, for a standard grid matrix the most pins you can have is to get as close to a square as possible aka FLOOR($pins / 2) * CEIL($pins / 2) - for 17, that can be 8 * 9. This can require some funky wire routing but is functional.

The issue with more advanced input scanning methods is that they require additional hardware - resistors, chips.

I would just spend $5 to buy an Arduino Pro Micro from Aliexpress. That'll have enough pins.

The board he is using has BLE built in and some of the pins are dedicated to that.

Correct - I'm using this board for the Bluetooth capability.
Would you happen to know of a GPIO expansion option for the greater?
Title: variab1e
Post by: variab1e on Thu, 16 March 2017, 18:29:54
Why does a 32u4 board only have 17 pins?

As others have pointed out, for a standard grid matrix the most pins you can have is to get as close to a square as possible aka FLOOR($pins / 2) * CEIL($pins / 2) - for 17, that can be 8 * 9. This can require some funky wire routing but is functional.

The issue with more advanced input scanning methods is that they require additional hardware - resistors, chips.

I would just spend $5 to buy an Arduino Pro Micro from Aliexpress. That'll have enough pins.

The board he is using has BLE built in and some of the pins are dedicated to that.

Ah, interesting.

OP you may find it easiest to look into using TRRS (check out the Let's Split) and having one controller for BT and one controller for actually reading the matrix. This would give you plenty of pins.

Ah, maybe using the Teensy2.0++ with an SPI bluetooth module? Would something like the Adafruit SPI bluetooth work (https://www.adafruit.com/products/2633)?
Title: Re: variab1e
Post by: a-c on Thu, 16 March 2017, 18:56:55

Ah, maybe using the Teensy2.0++ with an SPI bluetooth module? Would something like the Adafruit SPI bluetooth work (https://www.adafruit.com/products/2633)?

That board is the same module that is on the feather. It should work the same connected to the SPI bus. The feather is nice though since it also incorporates the lipo charger. If you can fit your matrix in 17 pins or add an io expander you could still use the feather.
Title: variab1e
Post by: variab1e on Fri, 17 March 2017, 09:00:17

Ah, maybe using the Teensy2.0++ with an SPI bluetooth module? Would something like the Adafruit SPI bluetooth work (https://www.adafruit.com/products/2633)?

That board is the same module that is on the feather. It should work the same connected to the SPI bus. The feather is nice though since it also incorporates the lipo charger. If you can fit your matrix in 17 pins or add an io expander you could still use the feather.

a-c have you used the feather? Any recommendations for an i/o expander?
Right now I'm at 18 rows and 6 columns. So I need a few more...

Maybe something like this (http://www.mouser.com/ProductDetail/Cypress-Semiconductor/CY8C9540A-24PVXI/?qs=sGAEpiMZZMuFG5L82ZqpsiCt2WeF4X3ZE%252bhO4GSQCSI%3d), 40 I/O over I2C
Title: Re: hand-wire keyboard if pins < cols+rows
Post by: a-c on Fri, 17 March 2017, 15:10:51
Take a look at https://deskthority.net/wiki/Costar_replacement_controllers (https://deskthority.net/wiki/Costar_replacement_controllers)

He uses binary to decimal decoders. Very simple and requires little code.
Title: Re: hand-wire keyboard if pins < cols+rows
Post by: vvp on Fri, 17 March 2017, 15:21:20
The link I posted contains many ways how to do it. I prefer shift registers myself. Cheap chips and easy to handle in firmware.