Author Topic: How to properly create a keyboard matrix schematic?  (Read 12514 times)

0 Members and 1 Guest are viewing this topic.

Offline wolfEXE57

  • Thread Starter
  • Posts: 17
How to properly create a keyboard matrix schematic?
« on: Mon, 19 August 2019, 10:11:02 »
Hello everyone,
Hopefully this is the correct board to post this to! Im looking for some guidance to how to properly make a keyboard matrix within EAGLE. This is my second attempt at making a 4 key pcb that's controlled by a pro micro. I switched to EAGLE as I found it personally easier to work with then KiCAD. This is what I have currently so far. (just in case I also uploaded the whole thing to Github)

I've read a few guides on how to do make one but the EAGLE library for the cherry mx with diode added is throwing me off and all of the guides use KiCAD. How would I properly connect all of the switches and diodes to the pro micro?

Any help is greatly appreciated!
« Last Edit: Mon, 19 August 2019, 10:29:53 by wolfEXE57 »

Offline nevin

  • Posts: 1646
  • Location: US
Re: How to properly create a keyboard matrix schematic?
« Reply #1 on: Mon, 19 August 2019, 12:09:24 »
for a visual of how all the components get wired together look up some of the excellent hand wiring guides/examples. i think it's a lot easier to get the concept by looking at it in it's most basic form. (it's a lot easier to follow a wire than it is a trace on a pcb)

you could also look up other pcb designs & see how they have the traces run (even if it's not in the same program to copy/paste)

Kalerator - Generate EAGLE PCB's from Keyboard-Layout-Editor

convert kicad to eagle?
https://www.element14.com/community/thread/3739/l/converting-from-kicad-to-eagle?displayFullThread=true

with a little google-foo
resources
https://github.com/lbibass/Mechanical-Keyboard-PCB-Design-EAGLE
https://www.keebtalk.com/t/pcb-design-thread/813
https://github.com/ruiqimao/keyboard-pcb-guide
Keeb.io Viterbi, Apple m0110, Apple m0120, Apple m0110a, Apple 658-4081, Apple M1242, Apple AEK II, MK96, GH60/Pure, Cherry g84-4100, Adesso AKP-220B, Magicforce 68

Offline wolfEXE57

  • Thread Starter
  • Posts: 17
Re: How to properly create a keyboard matrix schematic?
« Reply #2 on: Mon, 19 August 2019, 12:21:32 »
for a visual of how all the components get wired together look up some of the excellent hand wiring guides/examples. i think it's a lot easier to get the concept by looking at it in it's most basic form. (it's a lot easier to follow a wire than it is a trace on a pcb)

you could also look up other pcb designs & see how they have the traces run (even if it's not in the same program to copy/paste)

Kalerator - Generate EAGLE PCB's from Keyboard-Layout-Editor

convert kicad to eagle?
https://www.element14.com/community/thread/3739/l/converting-from-kicad-to-eagle?displayFullThread=true

with a little google-foo
resources
https://github.com/lbibass/Mechanical-Keyboard-PCB-Design-EAGLE
https://www.keebtalk.com/t/pcb-design-thread/813
https://github.com/ruiqimao/keyboard-pcb-guide

Unfortunately I already looked through most of those links earlier in the week and they provided no additional help.
The keyboard generator always gives me an internal server error whenever I try it.
I cant convert anything from KiCAD if I cant even use it. so I'll pass on conversion.
The rest of the resources you have listed are even referenced in my github as notes, but they still were unhelpful.

My main issue is recreating this but with these

Offline wolfEXE57

  • Thread Starter
  • Posts: 17
Re: How to properly create a keyboard matrix schematic?
« Reply #3 on: Mon, 19 August 2019, 12:37:43 »
for a visual of how all the components get wired together look up some of the excellent hand wiring guides/examples. i think it's a lot easier to get the concept by looking at it in it's most basic form. (it's a lot easier to follow a wire than it is a trace on a pcb)

you could also look up other pcb designs & see how they have the traces run (even if it's not in the same program to copy/paste)

Kalerator - Generate EAGLE PCB's from Keyboard-Layout-Editor

convert kicad to eagle?
https://www.element14.com/community/thread/3739/l/converting-from-kicad-to-eagle?displayFullThread=true

with a little google-foo
resources
https://github.com/lbibass/Mechanical-Keyboard-PCB-Design-EAGLE
https://www.keebtalk.com/t/pcb-design-thread/813
https://github.com/ruiqimao/keyboard-pcb-guide

Unfortunately I already looked through most of those links earlier in the week and they provided no additional help.
The keyboard generator always gives me an internal server error whenever I try it.
I cant convert anything from KiCAD if I cant even use it. so I'll pass on conversion.
The rest of the resources you have listed are even referenced in my github as notes, but they still were unhelpful.

My main issue is recreating this but with these
For clarification its mainly how to properly attach the diodes to the switches themselves. if I just attach the diode to D1 and D2 its not actually routed to the switch itself.

Offline nevin

  • Posts: 1646
  • Location: US
Re: How to properly create a keyboard matrix schematic?
« Reply #4 on: Mon, 19 August 2019, 13:00:15 »
use cherry-mx, not cherry-mx diode. the switch should only have two contacts. then you should be able to easily recreate the 1st example (with switches labeled K-1 thru K-4) using "cherry-mx" and "diode"s

then it's building the matrix in rows & columns & connecting to pro-micro

what physical layout are you trying to build? i got Kalerator to generate files but don't know what layout you're trying to create
Keeb.io Viterbi, Apple m0110, Apple m0120, Apple m0110a, Apple 658-4081, Apple M1242, Apple AEK II, MK96, GH60/Pure, Cherry g84-4100, Adesso AKP-220B, Magicforce 68

Offline wolfEXE57

  • Thread Starter
  • Posts: 17
Re: How to properly create a keyboard matrix schematic?
« Reply #5 on: Mon, 19 August 2019, 13:03:05 »
use cherry-mx, not cherry-mx diode. the switch should only have two contacts. then you should be able to easily recreate the 1st example (with switches labeled K-1 thru K-4) using "cherry-mx" and "diode"s

then it's building the matrix in rows & columns & connecting to pro-micro

what physical layout are you trying to build? i got Kalerator to generate files but don't know what layout you're trying to create

I will definitely give it a shot after work today. Im just trying to make a simple 4 pad in a square layout.

Offline nevin

  • Posts: 1646
  • Location: US
Re: How to properly create a keyboard matrix schematic?
« Reply #6 on: Mon, 19 August 2019, 13:16:52 »
then they don't even need to be in a matrix. that just makes things more complicated then it needs to be for a simple 4 key pad.

KLE layout
kbfirmware
- paste this code:
Code: [Select]
[{a:7},"",""],
["",""]
- import
- specify controller processor & pins on pins tab, go through & program keys on the keymap tab, etc...

files generated by Kalerator attached
https://kalerator.clueboard.co/view/gists/4415c4a81edbae4188e706daab83d36d?eagle_version=free&switch_footprint=KEYSWITCH-PLAIN-MX&diode_type=tht&smd_led=no
* 4415c4a81edbae4188e706daab83d36d.board.scr (0.44 kB - downloaded 89 times.)
* 4415c4a81edbae4188e706daab83d36d.schematic.scr (0.49 kB - downloaded 91 times.)
Keeb.io Viterbi, Apple m0110, Apple m0120, Apple m0110a, Apple 658-4081, Apple M1242, Apple AEK II, MK96, GH60/Pure, Cherry g84-4100, Adesso AKP-220B, Magicforce 68

Offline nevin

  • Posts: 1646
  • Location: US
Re: How to properly create a keyboard matrix schematic?
« Reply #7 on: Mon, 19 August 2019, 13:52:43 »
Keeb.io Viterbi, Apple m0110, Apple m0120, Apple m0110a, Apple 658-4081, Apple M1242, Apple AEK II, MK96, GH60/Pure, Cherry g84-4100, Adesso AKP-220B, Magicforce 68

Offline wolfEXE57

  • Thread Starter
  • Posts: 17
Re: How to properly create a keyboard matrix schematic?
« Reply #8 on: Mon, 19 August 2019, 14:17:53 »
then they don't even need to be in a matrix. that just makes things more complicated then it needs to be for a simple 4 key pad.

KLE layout
kbfirmware
- paste this code:
Code: [Select]
[{a:7},"",""],
["",""]
- import
- specify controller processor & pins on pins tab, go through & program keys on the keymap tab, etc...

files generated by Kalerator attached
https://kalerator.clueboard.co/view/gists/4415c4a81edbae4188e706daab83d36d?eagle_version=free&switch_footprint=KEYSWITCH-PLAIN-MX&diode_type=tht&smd_led=no
(Attachment Link)
(Attachment Link)

I would like to learn how to properly make a matrix so if I wanted to I could attempt my hand at making a bigger one in the future.

Offline nevin

  • Posts: 1646
  • Location: US
Re: How to properly create a keyboard matrix schematic?
« Reply #9 on: Mon, 19 August 2019, 14:21:56 »
the diodes can really go either way. believe, stripe away from switch is more popular (like in the hand wiring example above), just depends on whether you scan for rows then columns or columns then rows. (think of the diode as a one way valve, current can only flow in one direction)
Keeb.io Viterbi, Apple m0110, Apple m0120, Apple m0110a, Apple 658-4081, Apple M1242, Apple AEK II, MK96, GH60/Pure, Cherry g84-4100, Adesso AKP-220B, Magicforce 68

Offline wolfEXE57

  • Thread Starter
  • Posts: 17
Re: How to properly create a keyboard matrix schematic?
« Reply #10 on: Mon, 19 August 2019, 14:25:03 »
the diodes can really go either way. believe, stripe away from switch is more popular (like in the hand wiring example above), just depends on whether you scan for rows then columns or columns then rows. (think of the diode as a one way valve, current can only flow in one direction)
I understand what a diode is and its function. Just not how to properly make a keyboard matrix. This is what I dont understand, how to recreate the KiCAD one in EAGLE.
for a visual of how all the components get wired together look up some of the excellent hand wiring guides/examples. i think it's a lot easier to get the concept by looking at it in it's most basic form. (it's a lot easier to follow a wire than it is a trace on a pcb)

you could also look up other pcb designs & see how they have the traces run (even if it's not in the same program to copy/paste)

Kalerator - Generate EAGLE PCB's from Keyboard-Layout-Editor

convert kicad to eagle?
https://www.element14.com/community/thread/3739/l/converting-from-kicad-to-eagle?displayFullThread=true

with a little google-foo
resources
https://github.com/lbibass/Mechanical-Keyboard-PCB-Design-EAGLE
https://www.keebtalk.com/t/pcb-design-thread/813
https://github.com/ruiqimao/keyboard-pcb-guide

Unfortunately I already looked through most of those links earlier in the week and they provided no additional help.
The keyboard generator always gives me an internal server error whenever I try it.
I cant convert anything from KiCAD if I cant even use it. so I'll pass on conversion.
The rest of the resources you have listed are even referenced in my github as notes, but they still were unhelpful.

My main issue is recreating this but with these
For clarification its mainly how to properly attach the diodes to the switches themselves. if I just attach the diode to D1 and D2 its not actually routed to the switch itself.


Offline nevin

  • Posts: 1646
  • Location: US
Re: How to properly create a keyboard matrix schematic?
« Reply #11 on: Mon, 19 August 2019, 15:08:17 »
i'll try to mess with it later. i have an old version of eagle (6.2) and i don't have all the components loaded at the moment.
Keeb.io Viterbi, Apple m0110, Apple m0120, Apple m0110a, Apple 658-4081, Apple M1242, Apple AEK II, MK96, GH60/Pure, Cherry g84-4100, Adesso AKP-220B, Magicforce 68

Offline wolfEXE57

  • Thread Starter
  • Posts: 17
Re: How to properly create a keyboard matrix schematic?
« Reply #12 on: Mon, 19 August 2019, 15:11:02 »
i'll try to mess with it later. i have an old version of eagle (6.2) and i don't have all the components loaded at the moment.
If it does help I added the exact libraries I used for this project as submodules in my repo.

Offline ErgoMacros

  • Posts: 313
  • Location: SF Bay Area
Re: How to properly create a keyboard matrix schematic?
« Reply #13 on: Mon, 19 August 2019, 16:16:51 »
Here's a good explanation of the keyboard matrix:
    http://www.openmusiclabs.com/learning/digital/input-scanning-matrix/single-mux/index.html

It's a 3x3 pad, but easy to see what's going on.

You need the switch and diode in series. Something like:
Code: [Select]
                      ___
Column -------|<|----/    *----- Row
           (diode)  (switch)

Hope that helps! Good luck.
Today's quote: '...“but then the customer successfully broke that.”

Offline wolfEXE57

  • Thread Starter
  • Posts: 17
Re: How to properly create a keyboard matrix schematic?
« Reply #14 on: Mon, 19 August 2019, 21:08:17 »
Would anyone be able to check my work to see if everything is set correctly?

Board
Schematic

Offline ErgoMacros

  • Posts: 313
  • Location: SF Bay Area
Re: How to properly create a keyboard matrix schematic?
« Reply #15 on: Mon, 19 August 2019, 23:48:44 »
a. Looks like pins 3, 4 are tied together on the board, I guess that's OK, but you could also fill most of the back side with GND plane. Probably not critical for this project.

b. you could rotate the R1 and SW2 both by 90° and get the traces a little straighter, with more space between them. Probably more aesthetic than functional.

c. you're using the plated through holes of the components as "vias" Take a look at how vias are done in Eagle and see if that makes sense to you.

The rest looks OK, but is hard to match the schematic to the board because the switch positions don't match.

I'd say you're on your way!
« Last Edit: Mon, 19 August 2019, 23:59:54 by ErgoMacros »
Today's quote: '...“but then the customer successfully broke that.”

Offline wolfEXE57

  • Thread Starter
  • Posts: 17
Re: How to properly create a keyboard matrix schematic?
« Reply #16 on: Tue, 20 August 2019, 10:56:19 »
a. Looks like pins 3, 4 are tied together on the board, I guess that's OK, but you could also fill most of the back side with GND plane. Probably not critical for this project.

b. you could rotate the R1 and SW2 both by 90° and get the traces a little straighter, with more space between them. Probably more aesthetic than functional.

c. you're using the plated through holes of the components as "vias" Take a look at how vias are done in Eagle and see if that makes sense to you.

The rest looks OK, but is hard to match the schematic to the board because the switch positions don't match.

I'd say you're on your way!

Thanks for checking!
I deleted the tie between pins 3 & 4, I dont know why autoroute did that lol.
Could you visually point out where the vias are? Im having a bit of trouble identifying them.

Also a side question is it possible to change the colors of the routing? I'm colorblind to red so those traces are a bit difficult for me to see unfortunately :(

Offline nevin

  • Posts: 1646
  • Location: US
Re: How to properly create a keyboard matrix schematic?
« Reply #17 on: Tue, 20 August 2019, 11:20:16 »
i could be wrong, but i'm pretty sure you don't need a pull-up for the reset button.
Keeb.io Viterbi, Apple m0110, Apple m0120, Apple m0110a, Apple 658-4081, Apple M1242, Apple AEK II, MK96, GH60/Pure, Cherry g84-4100, Adesso AKP-220B, Magicforce 68

Offline ErgoMacros

  • Posts: 313
  • Location: SF Bay Area
Re: How to properly create a keyboard matrix schematic?
« Reply #18 on: Tue, 20 August 2019, 12:14:59 »
Quote
Thanks for checking!
I deleted the tie between pins 3 & 4, I dont know why autoroute did that lol.
Could you visually point out where the vias are? Im having a bit of trouble identifying them.

Also a side question is it possible to change the colors of the routing? I'm colorblind to red so those traces are a bit difficult for me to see unfortunately :(

A via is a hole plated with coper that is used to bring a trace from one side of the board to the other. Most often used because 2 traces cannot cross on the same side of a board. On your board it is where the red and blue traces touch. Usually these are smaller diameter holes that holes you cannot put a part lead into. I've marked them on your board with white rectangles. (Google PCB VIA for more info.)

I don't know Eagle (I use KiCAD). But in KiCAD there is a colored rectangle next to the layer name. Clicking, or right-clicking the rectangle may allow you to change the color.

By the way, I think even is right. The RESET pull-up resister is already on the Pro Micro.

'Luck!
« Last Edit: Tue, 20 August 2019, 12:18:59 by ErgoMacros »
Today's quote: '...“but then the customer successfully broke that.”

Offline wolfEXE57

  • Thread Starter
  • Posts: 17
Re: How to properly create a keyboard matrix schematic?
« Reply #19 on: Tue, 20 August 2019, 20:00:32 »
Quote
Thanks for checking!
I deleted the tie between pins 3 & 4, I dont know why autoroute did that lol.
Could you visually point out where the vias are? Im having a bit of trouble identifying them.

Also a side question is it possible to change the colors of the routing? I'm colorblind to red so those traces are a bit difficult for me to see unfortunately :(

A via is a hole plated with coper that is used to bring a trace from one side of the board to the other. Most often used because 2 traces cannot cross on the same side of a board. On your board it is where the red and blue traces touch. Usually these are smaller diameter holes that holes you cannot put a part lead into. I've marked them on your board with white rectangles. (Google PCB VIA for more info.)

I don't know Eagle (I use KiCAD). But in KiCAD there is a colored rectangle next to the layer name. Clicking, or right-clicking the rectangle may allow you to change the color.

By the way, I think even is right. The RESET pull-up resister is already on the Pro Micro.

'Luck!

Ok does this look good?
board

Offline ErgoMacros

  • Posts: 313
  • Location: SF Bay Area
Re: How to properly create a keyboard matrix schematic?
« Reply #20 on: Tue, 20 August 2019, 20:40:53 »
 :) real vias! Looks good.
Didn't check the rest carefully, but looks good.

Random comments:
  The 2 traces at the top are closer to each other than they need to be.
  Looks like the USB connector on the Pro Micro is well inside of the edge of the PCB. (Not at or sticking over the edge.) That's likely a problem if this is going into a case.
     Traditionally they stick out of the PCB a little (like the one on the Pro Micro is doing on it's own board.)
  Depending on the type of SW2 reset switch you're using it could be moved a little further away from the keys, for convience. Your call.
  Boards no larger than 100mm x 100mm tend to be inexpensive. You're well within that.
  Looks like from the Sparkfun docs you do not need a pull-up on reset, so you're OK there.
Today's quote: '...“but then the customer successfully broke that.”

Offline wolfEXE57

  • Thread Starter
  • Posts: 17
Re: How to properly create a keyboard matrix schematic?
« Reply #21 on: Tue, 20 August 2019, 21:11:40 »
:) real vias! Looks good.
Didn't check the rest carefully, but looks good.

Random comments:
  The 2 traces at the top are closer to each other than they need to be.
  Looks like the USB connector on the Pro Micro is well inside of the edge of the PCB. (Not at or sticking over the edge.) That's likely a problem if this is going into a case.
     Traditionally they stick out of the PCB a little (like the one on the Pro Micro is doing on it's own board.)
  Depending on the type of SW2 reset switch you're using it could be moved a little further away from the keys, for convience. Your call.
  Boards no larger than 100mm x 100mm tend to be inexpensive. You're well within that.
  Looks like from the Sparkfun docs you do not need a pull-up on reset, so you're OK there.
Awesome! thanks for all the help!
one last quick question. If I upload the board to OSHpark it says that my project doesn't contain a bottom silk screen. Is this something that's needed and if so how would I apply one?

Offline ErgoMacros

  • Posts: 313
  • Location: SF Bay Area
Re: How to properly create a keyboard matrix schematic?
« Reply #22 on: Tue, 20 August 2019, 21:58:47 »
Hi, Silkscreen is the (typically white) print you see on boards.
There's no requirement that you have anything printed on the bottom.

You might add something like:
  4 key macro pad
  Created by wolfEXE57
  (email, or web address, if you like)
  Version 1.0, August 2019
  Uses Cherry MX switches, or equivalent.

Put as much or as little as you want.
Version # will be especially useful once you've made multiple versions of the "same" board due to fixes and enhancements.

Add it by selecting the "Back silk screen" layer, and adding text with the text tool.

One last comment... you might add a hole at each corner for a bolt to give the thing "legs" to keep the pins and stuff from scraping the table.
Not sure how Eagle does that. Google or youtube for info.
Today's quote: '...“but then the customer successfully broke that.”

Offline wolfEXE57

  • Thread Starter
  • Posts: 17
Re: How to properly create a keyboard matrix schematic?
« Reply #23 on: Wed, 21 August 2019, 11:03:14 »
Hi, Silkscreen is the (typically white) print you see on boards.
There's no requirement that you have anything printed on the bottom.

You might add something like:
  4 key macro pad
  Created by wolfEXE57
  (email, or web address, if you like)
  Version 1.0, August 2019
  Uses Cherry MX switches, or equivalent.

Put as much or as little as you want.
Version # will be especially useful once you've made multiple versions of the "same" board due to fixes and enhancements.

Add it by selecting the "Back silk screen" layer, and adding text with the text tool.

One last comment... you might add a hole at each corner for a bolt to give the thing "legs" to keep the pins and stuff from scraping the table.
Not sure how Eagle does that. Google or youtube for info.

Awsome!
Thanks for all the help! If you and Nevin want a board I will ship you a completed one free of charge as a token of my appreciation for helping me! (just dm me the address so i know where to send it!)