Author Topic: Wiring for 5 key keyboard w/ Trinket  (Read 2433 times)

0 Members and 1 Guest are viewing this topic.

Offline adventurepoop

  • Thread Starter
  • Posts: 109
  • Location: IL
  • I make keyboards, I guess.
Wiring for 5 key keyboard w/ Trinket
« on: Sun, 18 May 2014, 00:58:55 »
I'm making a 5 key keyboard using cherry mx reds, and an Adafruit Trinket. How will the wiring look for this? I was going to wire all the switches to the 5v on the Trinket and then have each switch on its own io. Would this work?

Offline OverKill

  • Posts: 109
  • Location: Arizona, USA
Re: Wiring for 5 key keyboard w/ Trinket
« Reply #1 on: Sun, 18 May 2014, 21:31:36 »
Yes that would work. You would have 2 IO's for each switch though if you did that. the other way would be to have one row and 5 columns (one for each switch). Don't forget your diodes.

Offline hanya

  • Posts: 132
  • Location: Japan
Re: Wiring for 5 key keyboard w/ Trinket
« Reply #2 on: Mon, 19 May 2014, 01:35:34 »
Trinket uses PB3 and PB4 (#3, 4) for USB connection by V-USB, if you make USB HID. You have only 3 pins remained, PB0-PB2. If you use resistance voltage-dividing to detect which button is pushed, you can add more buttons. But I'm not sure they can push at the same time with the way.
PFU HHKB JP, Sanwa MA-TB38 trackball

Offline adventurepoop

  • Thread Starter
  • Posts: 109
  • Location: IL
  • I make keyboards, I guess.
Re: Wiring for 5 key keyboard w/ Trinket
« Reply #3 on: Mon, 19 May 2014, 09:43:32 »
Hanya that's what I'm worried about, but I'm a bit of a beginner with electronics :o Could I possibly wire it so that each button gives a different combination of io, as in switches are a through e and ios are 1-3
a ->1
b ->2
c ->3
d ->13
e ->123

Would this prevent all ghosting on switches a and b?

Offline OverKill

  • Posts: 109
  • Location: Arizona, USA
Re: Wiring for 5 key keyboard w/ Trinket
« Reply #4 on: Mon, 19 May 2014, 16:47:39 »
Hanya that's what I'm worried about, but I'm a bit of a beginner with electronics :o Could I possibly wire it so that each button gives a different combination of io, as in switches are a through e and ios are 1-3
a ->1
b ->2
c ->3
d ->13
e ->123

Would this prevent all ghosting on switches a and b?

Just to clarify, You want to use A = PB0, B = PB1 and C = PB3. then you want to D to be detected on PB1 and PB2 (at the same time) and E = PB0, PB1, PB2?

Offline adventurepoop

  • Thread Starter
  • Posts: 109
  • Location: IL
  • I make keyboards, I guess.
Re: Wiring for 5 key keyboard w/ Trinket
« Reply #5 on: Mon, 19 May 2014, 16:50:55 »
yup!

Offline Smasher816

  • HHKB Master
  • Posts: 538
  • Location: return STATE_MISSOURI;
Re: Wiring for 5 key keyboard w/ Trinket
« Reply #6 on: Mon, 19 May 2014, 23:39:52 »
Hanya that's what I'm worried about, but I'm a bit of a beginner with electronics :o Could I possibly wire it so that each button gives a different combination of io, as in switches are a through e and ios are 1-3
a ->1
b ->2
c ->3
d ->13
e ->123

Would this prevent all ghosting on switches a and b?

Just to clarify, You want to use A = PB0, B = PB1 and C = PB3. then you want to D to be detected on PB1 and PB2 (at the same time) and E = PB0, PB1, PB2?

yup!

If that is the case then there would be no way to determine if D is pressed of if both A and B are both pressed - the signals will be the exact same.

Maybe just get a teensy (or some other controller with more IO ports)? They are fairly cheap and are used for many DIY type keyboard projects (Ex: the ErgoDox). Another nice thing about the teensy (or other atmega32u4 based boards) is that people have already written various firmware for it.
« Last Edit: Mon, 19 May 2014, 23:41:53 by Smasher816 »

Offline adventurepoop

  • Thread Starter
  • Posts: 109
  • Location: IL
  • I make keyboards, I guess.
Re: Wiring for 5 key keyboard w/ Trinket
« Reply #7 on: Mon, 19 May 2014, 23:55:25 »
The problem is that the teensy is larger than the trinket by a decent amount. I'm just going to deal with the ghosting in this version, and if I do a second one I'll figure out something better, maybe using a pcb. I dunno.

Offline Smasher816

  • HHKB Master
  • Posts: 538
  • Location: return STATE_MISSOURI;
Re: Wiring for 5 key keyboard w/ Trinket
« Reply #8 on: Mon, 19 May 2014, 23:56:48 »
Good luck :)

Offline bcg

  • Posts: 112
Re: Wiring for 5 key keyboard w/ Trinket
« Reply #9 on: Thu, 22 May 2014, 21:32:22 »
Some fairly simple logic would make this a bit more usable...

for example when scanning the matrix, if 1 and 3 are on, check and see if a or c was pressed previously... if not they probably just pressed d.  Otherwise you can deduce that the other 2 keys were pressed individually.  Also, depending on what the keys are meant to do, you could contrive the wiring such that it is unlikely that you would have ghosting conditions.  I'm kind of tired so I'm sure I'm not explaining it very well, but hopefully you get the point.
:wq!