How a Mechanical Keyboard Works (Matrix and Direct Wiring)

Поділитися
Вставка
  • Опубліковано 6 лют 2025
  • In this video, we will talk about the two methods you can use to wire up a mechanical keyboard, direct wiring and a matrix with diodes. These concepts are the core knowledge you need to start designing your own mechanical keyboards from scratch, both PCB and handwired.
    Find out more about the project: scottokeebs.com
    Donations greatly appreciated: bit.ly/41odBEu
    ~ Handwiring Tools ~
    TS100 Soldering Iron: amzn.to/3LCsrkb
    D24 Chisel Tip: amzn.to/3VFxiES
    63/37 Solder: amzn.to/3uBlMPu
    ~ Handwiring Parts ~
    1N4148 Diodes: amzn.to/3Ccljbb
    16g Copper Wire: amzn.to/3xLDVvJ
    Raspberry Pi Pico: amzn.to/3HglCVb
    Arduino Pro Micro: amzn.to/3HkR9Fn
    Ethernet Cable: amzn.to/3uyaOKr
    M2x6mm Screws: amzn.to/3UI1bDH
    M2x8mm Spacer: amzn.to/3Y4KzJ3
    M2 Heat Set Insert: amzn.to/3WjklB9
    Durock Stabilizers: amzn.to/3FgcLQR
    ~ 3D Printing ~
    Ender-3 Pro: amzn.to/3VIWryL
    PEI Magnetic Bed: amzn.to/3Hi7URx
    Dual Z Upgrade: amzn.to/3h7DTJy
    BLTouch Auto-Leveling: amzn.to/3UGEBv8
    ~ Favorite Cheap Switches ~
    Gateron Milky Yellow: amzn.to/3Bk0Cci
    Akko Lavender Purple: amzn.to/3VJy440
    ~ Social ~
    / joe_scotto
    / joe_scotto
    ko-fi.com/joe_...
    ~ Community ~
    ScottoKeebs Discord: / discord
    Handwired Keyboards Reddit: / handwiredkeyboards
    ~ Disclaimer ~
    Some links may be affiliate links where I will make a small commission. Nothing in this video was sponsored by any outside party and I wasn't paid for the content in this video.
    #mechanicalkeyboard #pcb #kicad

КОМЕНТАРІ • 69

  • @Glarses
    @Glarses Рік тому +106

    Great channel

  • @dgvigil
    @dgvigil Рік тому +4

    I’m currently building the scottogame for my son and learned a lot in the process. I’m super interested in the next PCB video and expanding my knowledge to that next step.

  • @francescodesantis1997
    @francescodesantis1997 Рік тому +7

    Can't wait for the design PCB video. I've just built my first handwired keyboard and I'd like to design its PCB

    • @joe_scotto
      @joe_scotto  Рік тому +1

      It will be out very soon and because you’ve handwired, it will be extremely easy to follow along with!

  • @lucassrossi
    @lucassrossi Рік тому +3

    OMG I was looking for content like this just a month ago, thanks a lot man!

  • @joe_scotto
    @joe_scotto  Рік тому +13

    Here it is... the first video in the PCB series. This information is essential to be successful in designing a PCB but once you know it, you're 90% of the way there. I'm sure some people will have questions, so feel free to ask! I'm currently getting ready to release the second video in the next few days, I just have to finish editing it.

  • @gunjja13
    @gunjja13 Рік тому +1

    So excited for the PCB series from you! Always such great videos coming from you.

  • @TheSast
    @TheSast Рік тому +3

    Can't wait for the PCB video!

  • @ssaffann
    @ssaffann Рік тому

    You cant understand how much this video helpful for me! Thank you!

  • @Tharrinne
    @Tharrinne Рік тому

    I just started watching so I can't comment on the video itself but that necklace is awesome!

  • @evanlane1690
    @evanlane1690 Рік тому

    Not sure if one of my headphone's battery died, but I'm only getting audio out of the left channel. If you recorded in mono, remember to double it to both left and right channels.
    This content is awesome!!! I'm really excited about building my own.

    • @joe_scotto
      @joe_scotto  Рік тому

      Thank you, glad you enjoyed it!
      It's definitely your headphones died lol... I upload in mono to both left/right for my dialogue channels.

  • @justinreddick5876
    @justinreddick5876 5 місяців тому

    Hey just came across this playlist. Can't get enough of it. I did have a question in regards to the pinout on this micro controller and any other micro controller. How do you figure out which pins on the controller go to a certain switch on the pcb ? Like why is S3 -> PD1 and not another pin?

  • @TannerCh
    @TannerCh 6 місяців тому

    Fantastic and straight to the point! Thank you!

  • @BoomerSG
    @BoomerSG 4 місяці тому

    Great explanation! thanks!

  • @AlphabetsFailMe
    @AlphabetsFailMe 7 місяців тому

    Thanks, very clear explanation.

  • @RyanFranklinWilliams
    @RyanFranklinWilliams Місяць тому

    I have a question about the amp -- i have that same amp (as well as most everyhting else you're using, lol) -- as you know the documentation on the amp isn't readily available, and my thought is that i assumed when i messed with the jumpers and got sound all around that i was good with just one of the two connections, but in revisiting the guts of my setup to deal with the android auto issue i discovered that it seems like one input handles left and the other handles right. Im going to redo my connections this week to utilize inputs, but I'm wondering if that tracks, of you can recall.

  • @dmitry_sharikov
    @dmitry_sharikov Рік тому

    Thanks Joe, very informative

  • @Koliiinn
    @Koliiinn Місяць тому

    Just curios, when i want to install led light on the keyboard, do i need to make new circuit for it?

  • @THEMithrandir09
    @THEMithrandir09 Рік тому +2

    If I understand this correctly, a matrix should have issues with multiple keys being pressed at the same time, right? So if you press 0,0+1,0 and then add 0,1 the board wouldn't know if you added 0,1 or 1,1 right? Because row 0 and 1 are already active the board won't know which circuit was closed now since they're on the same column. It won't short because of the diodes, but it cannot really know what happend then right?

    • @karelissomoved1505
      @karelissomoved1505 Рік тому +3

      It will know every key pressed.
      lets call the 3 column A B C. and the 3 row are 1 2 3. In this case you presses the A1 A2 and B2 key. there are pins that can tell wether you activated 1, 2, 3 they are independent of each other. Now the trick is that voltage is only applie at one column at the same time. First you apply voltage to the A column. 1 and 2 will active. then you apply voltage only on the B column 2 is active. last you apply voltage on C column this time nothing has recieved any signal.

    • @THEMithrandir09
      @THEMithrandir09 Рік тому +2

      @@karelissomoved1505 Ohh, so it's basically scanning the matrix regularly? I thought it'd apply power all the time and basically instantly see when a switch is closed. But that makes sense that not all rows and columns always have power.

  • @haf0
    @haf0 Рік тому +1

    ay would you explain Japanese duplex matrix or robin duplex matrix too?

  • @twintwin1005
    @twintwin1005 Рік тому

    Nice video, thanks for sharing!

  • @Krish-StarDestined
    @Krish-StarDestined Рік тому

    Thank you

  • @MrPinkDino
    @MrPinkDino Рік тому

    Do you have something about building a dactyl manuform keyboard?

  • @davidl6354
    @davidl6354 4 місяці тому

    What do i in a matrix if my momentary toggle switch only has one ground pin but 2 pins for up and down

  • @unotoli
    @unotoli 2 місяці тому

    How magnetic keyboard work? What kind of diy controllers?

  • @erykfear2689
    @erykfear2689 2 місяці тому

    I have 4x3 matrix with diodes 1N4148 and in software every key is working, but when i go to control panel and devices, one of the column is not showing that i press a key.

  • @Barbastruzzolo
    @Barbastruzzolo Рік тому +3

    Settings --> Speed --> 0.5

  • @atharvavadeyar5157
    @atharvavadeyar5157 4 місяці тому

    Quick question, for the matrix, where are the VDD and GND connected?

    • @joe_scotto
      @joe_scotto  4 місяці тому

      You don’t need those.

    • @atharvavadeyar5157
      @atharvavadeyar5157 4 місяці тому

      @@joe_scotto wait so then how is a logical 0 or 1 defined? Wouldn’t all the row and column inputs be floating?

    • @oleurgast730
      @oleurgast730 2 місяці тому

      @@atharvavadeyar5157 No. The inputs are pulled up internally in the controller, so they are not floating. If the row-GPIO´s are inputs and the column are outputs, the controller sets only one column at a time to low. If a key is pressed in this column, the coresponding row-input is connected to low (ground) and the keypress is detected this way. Than the column-output is set to high again and the next colums output is set to low. So keypresses in the next coloumn are detected. And so on. Hundreds of times a second all columns are checked one after each other.
      You are of course free if you use row as output and column as input of course.
      Actually for very big keyboards, using one GPIO per output-line is quite wastefull, as only one output-line can be active-low at a time. So using a 4-to-16-demultiplexer can reduce the number of outputs a lot. You need only 4 outputs on the microcontroller to select one of 16 lines to be put to ground.

  • @shaiuwuai
    @shaiuwuai 9 місяців тому

    waittt that necklace is so cute, did you make it yourself?

  • @gouravmehra5007
    @gouravmehra5007 8 місяців тому +2

    What if we will press two keys simultaneously

    • @earxnim
      @earxnim 21 день тому

      Kinda late, but for example lets say we have a 3x3 keyboard with a matrix wiring. If we were to activate the key located at (1, 1), we would read on the board as row 1, column 1, right? Now if we were to activate the key at (2, 2) at the same time, it would read at column 1, row 1 and column 2, row 2. If we were to instead press the key at (1, 2), it would only detect column 1 but row 1 and row 2. So therefore we can detect it software side without a problem

  • @Amy-gt5jw
    @Amy-gt5jw 10 місяців тому

    I have a doubt, with the button matrix you don't need the resistors, it's just buttons and diodes?

    • @joe_scotto
      @joe_scotto  10 місяців тому +1

      No resistors needed, just buttons and diodes. The diodes allow you to create a matrix with more buttons than you have pins but if you only needed 4, you could leave out the diodes and just direct wire it.

    • @Amy-gt5jw
      @Amy-gt5jw 10 місяців тому

      ok, thank you@@joe_scotto

    • @oleurgast730
      @oleurgast730 2 місяці тому

      @Amy-gt5jw To be precise: yes, resistors are needed to avoid floating of the input pin. But all microcontrollers already have pull-up-resistors internaly (they are activated in the software). So an "open" input (no key pressed) always is "high". All outputs also are high, exept for the active output - this is set to low. So if the active-low is connected to an input due to a switch being pressed, the input gets low.
      Theese internal pull-up resistors are the reason for the silly logic - "0" is pressed and "1" is not pressed. "0" is true and "1" is false. If there were pull-down resistors, the logic would be much more straight-forward.
      You are totally right: You need resistors. But you already have them...
      Without diodes you have ghosting. On a 2 by 2 matrix: If you press (row, column) (0,0), (0,1) and (1,0), if row 1 sends ground the electrons from row1 via switch (1,0) to column 0. As (0,1) is also pressed, without diode the electrons would also flow into row 1, and as (0,0) also is pressed from there to column 1. So the controller detects (1,1) as pressed even if it isn´t. This flow is prevented by the diodes.
      So without diodes you only have 2-key rollover. This does not mean you can not press and detect more than two keypresses at the same time. But you get ghosting if pressing two keys in one row and a third in the same column of one of theese keys.
      Ruber-dome keyboards do not have diodes. They have very well thought-through matrixes, to avoid problematic ghosting. You realy do not want any combination of ctrl + alt + something ghosting to "ESC"...
      Unicomp redesigned the matrix of some of their Model M-keyboards jus a few years ago. The improved the matrix to get kind of a 6-key-rollover even without diodes.
      If you build a matrix keyboard f.e. for makros to call scenes in Open Broadcasting Studio (OBS), you do not need diodes - if you only press one key to call a scene at a time anyway (and do not use more than 2 layers). Also if building an external numpad to add to the side of a 60% or TKL keyboard. However, you never knew if you use your diy-keyboard for something else in future. As diodes are cheap, they are recommended.

  • @MasterPritex
    @MasterPritex Рік тому +1

    What about leds?

  • @ronaldsantosluna6148
    @ronaldsantosluna6148 9 місяців тому

    Hello, greetings from Peru, I would like to know which microcontroller to use for a full size keyboard?

  • @isytexen7924
    @isytexen7924 4 місяці тому

    @joe_scotto how many inputs can be recognized at the same time? As an example if I press every key in the first row.

    • @joe_scotto
      @joe_scotto  4 місяці тому

      I think by default QMK is setup for 6 key rollover.

  • @lolyman13
    @lolyman13 Рік тому

    I’m not sure I fully understand how the controller understands which key is pressed on the matrix. Is it sending an impulse one column after the other? Would this mean that theoretically, a key press could be missed if pressed between impulses? Does it consume more energy than a direct wiring?

    • @joe_scotto
      @joe_scotto  Рік тому +1

      Basically that’s why we use diodes. The columns send a signal one after the other and the rows are all listening for them. For building a board it’s not super important to know the specifics but the docs do a really nice job explaining in detail: github.com/qmk/qmk_firmware/blob/master/docs/how_a_matrix_works.md

  • @streetdogarg
    @streetdogarg Рік тому +1

    GREAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAT VIDEO

  • @MrznMkhl
    @MrznMkhl Рік тому

    can shift registers be included too?

    • @joe_scotto
      @joe_scotto  Рік тому

      I haven’t personally used them but many people in my discord have: discord.gg/vN6X3z8eyv

  • @gfhdlsk
    @gfhdlsk 8 місяців тому

    Best diagram

  • @Kuskus62
    @Kuskus62 10 місяців тому

    My mechanical space bar is broken:
    •If I touch the 2 pins its temporary fix it
    •the Switch bark works normal
    •But it will break down again if I not use the space bar for a few secs
    •Try to resoldering it, but its break again in the next day.
    •Try to replace the switch with another switch, its works fine but again same problem, its break down again in the next day.
    •The only solution for me is to touch the 2 pins with my finger while tapping the space button.
    •what is going on?. I dont get it.

  • @loneventhorizon
    @loneventhorizon 9 місяців тому

    awesome

  • @eycksampaio2754
    @eycksampaio2754 Рік тому

    The arduino pico can identify 2 different switches on the same row?

    • @eycksampaio2754
      @eycksampaio2754 Рік тому

      If so, he can identify 2 switches on the same row, even when more than 1 column was "used"?

    • @rivalyralt6759
      @rivalyralt6759 Рік тому

      Arduino pico? arduino micro or pi pico?

    • @eycksampaio2754
      @eycksampaio2754 Рік тому

      @@rivalyralt6759 Arduino Pro Micro, the microcontroler used on the video, sorry for the typo

    • @rivalyralt6759
      @rivalyralt6759 Рік тому

      if i get it right. Normally it can check 2ways, rows and columns. so maybe it could @@eycksampaio2754

    • @twintwin1005
      @twintwin1005 Рік тому +3

      I do not know how the author of the video will do it. But if the algorithm (code) of sequential "polling" of each matrix cell is applied, then you can hold down any combination of buttons at any time and it will work correctly.
      I recently started learning how button matrices work and this is a very optimized way to create keyboards. Before that, I used a multiplexer to get more inputs.
      But now you can connect everything together and the multiplexer can work as "columns" and arduino inputs as "rows". This will give a matrix with more buttons.

  • @icedwatr
    @icedwatr 15 днів тому

    nice chain

  • @RennanMendesSerenzaRennan
    @RennanMendesSerenzaRennan 10 місяців тому

    How are RGB LEDs connected to a printed circuit board?

  • @Heron69
    @Heron69 Рік тому

    Jovirone?