Differences

This shows you the differences between two versions of the page.

Link to this comparison view

pm:prj2024:ccontasel:matei.ionescu0703 [2024/05/04 19:58]
matei.ionescu0703 Milestone 1 Documentation
pm:prj2024:ccontasel:matei.ionescu0703 [2024/05/27 15:21] (current)
matei.ionescu0703 add journal
Line 1: Line 1:
 ====== RootKB ====== ====== RootKB ======
 +<note tip>
 +Name: Matei-Ștefan Ionescu\\
 +Group: 333CA
 +</​note>​
 ===== Introduction ===== ===== Introduction =====
  
Line 8: Line 12:
 Firstly, we are using the same layout designed in the early 1870s for typewriters. At that time, having staggered rows allowed the typebars to align more efficiently,​ reducing the likelihood of jams. Now, since computer keyboards don't suffer from the same issue, having staggered rows is just inefficient since it requires your fingers to travel in an unnatural and uneven way. In order to fix this, I am using a column staggered design for my keyboard. This way the fingers will rest in a more natural position and travel less, while keeping an even travel distance between the fingers of my left hand and right hand. Firstly, we are using the same layout designed in the early 1870s for typewriters. At that time, having staggered rows allowed the typebars to align more efficiently,​ reducing the likelihood of jams. Now, since computer keyboards don't suffer from the same issue, having staggered rows is just inefficient since it requires your fingers to travel in an unnatural and uneven way. In order to fix this, I am using a column staggered design for my keyboard. This way the fingers will rest in a more natural position and travel less, while keeping an even travel distance between the fingers of my left hand and right hand.
  
-{{:​pm:​prj2024:​ccontasel:​matei.ionescu0703:​remington_2_typewriter_keyboard-1878.jpg?​300 |Remington 2 Typewriter, 1878}} +{{ :​pm:​prj2024:​ccontasel:​matei.ionescu0703:​remington_2_typewriter_keyboard-1878.jpg?​300 |Remington 2 Typewriter, 1878}} 
-{{ :​pm:​prj2024:​ccontasel:​matei.ionescu0703:​stagger.jpg?​500 |}}+{{ :​pm:​prj2024:​ccontasel:​matei.ionescu0703:​stagger.jpg?​500 |}}\\
  
  
 A second problem with standard keyboards is the fact that your hands are placed too close together on the keyboard. This puts your wrists in an unnatural position, potentially leading to discomfort or repetitive strain injuries like carpal tunnel syndrome. This issue is fixed by splitting the keyboard, allowing each half to be placed in a more natural position for your hands. A second problem with standard keyboards is the fact that your hands are placed too close together on the keyboard. This puts your wrists in an unnatural position, potentially leading to discomfort or repetitive strain injuries like carpal tunnel syndrome. This issue is fixed by splitting the keyboard, allowing each half to be placed in a more natural position for your hands.
  
-{{ :​pm:​prj2024:​ccontasel:​matei.ionescu0703:​split.jpg?​500 |}}+{{ :​pm:​prj2024:​ccontasel:​matei.ionescu0703:​split.jpg?​500 |}}\\
  
 The third problem is that your strongest fingers, the thumbs are only used to press one key, the space bar. To make my keyboard more efficient and comfortable I will be using a 4 key thumb cluster for each side. So, the thumbs will be pressing 8 keys instead of 1. The third problem is that your strongest fingers, the thumbs are only used to press one key, the space bar. To make my keyboard more efficient and comfortable I will be using a 4 key thumb cluster for each side. So, the thumbs will be pressing 8 keys instead of 1.
  
-{{ :​pm:​prj2024:​ccontasel:​matei.ionescu0703:​thumb-cluster.jpg?​400 | Thumb cluster on the ZSA Moonlander keyboard}}+{{ :​pm:​prj2024:​ccontasel:​matei.ionescu0703:​thumb-cluster.jpg?​400 | Thumb cluster on the ZSA Moonlander keyboard}}\\
  
 A fourth inefficiency that arises from the regular keyboard design is stretching our fingers a long way in order to press certain keys. To fix this, we will use 6 columns and 3 rows aside from the thumb cluster, so our fingers will easily reach each key. At this point you might be wondering where the functions and numbers rows will go, and how you will be able to access special characters. The answer is layers. You might not know it, but you are already familiar with layers. Every time you use the Shift key you are changing the layer of your keyboard to access different symbols, like uppercase characters. There will be buttons in the thumb clusters that when held down will change the layer of the keyboard. So, you will be able to access all the characters you need by holding down one of these buttons. A fourth inefficiency that arises from the regular keyboard design is stretching our fingers a long way in order to press certain keys. To fix this, we will use 6 columns and 3 rows aside from the thumb cluster, so our fingers will easily reach each key. At this point you might be wondering where the functions and numbers rows will go, and how you will be able to access special characters. The answer is layers. You might not know it, but you are already familiar with layers. Every time you use the Shift key you are changing the layer of your keyboard to access different symbols, like uppercase characters. There will be buttons in the thumb clusters that when held down will change the layer of the keyboard. So, you will be able to access all the characters you need by holding down one of these buttons.
Line 30: Line 34:
 Each half of the board will have its own Arduino ProMicro. One of them will be the master communicating with the PC using the USB standard. The firmware for communication will be implemented using the LUFA library. The two Arduino microcontrollers will communicate with each other using UART, through a TRRS cable, sharing a common VCC and GND. Each microcontroller will connect to its own display module through an I2C connection. A switch matrix with 6 columns and 4 rows will be created. Each switch will have its own diode in order to prevent ghosting and allow NKRO (N-Key Rollover). Each column and each row will be connected to the microcontroller. The matrix will be scanned by sending a signal through one column at a time and checking the signal on the rows. If we got the signal on a row that means that the key where that row and column intersects was pressed. Each half of the board will have its own Arduino ProMicro. One of them will be the master communicating with the PC using the USB standard. The firmware for communication will be implemented using the LUFA library. The two Arduino microcontrollers will communicate with each other using UART, through a TRRS cable, sharing a common VCC and GND. Each microcontroller will connect to its own display module through an I2C connection. A switch matrix with 6 columns and 4 rows will be created. Each switch will have its own diode in order to prevent ghosting and allow NKRO (N-Key Rollover). Each column and each row will be connected to the microcontroller. The matrix will be scanned by sending a signal through one column at a time and checking the signal on the rows. If we got the signal on a row that means that the key where that row and column intersects was pressed.
  
-{{ :​pm:​prj2024:​ccontasel:​matei.ionescu0703:​block-diagram.png?​900 |}}+{{ :​pm:​prj2024:​ccontasel:​matei.ionescu0703:​block-diagram.png?​800 |}}\\
  
 ===== Hardware Design ===== ===== Hardware Design =====
 +
 +==== Components ====
  
 The following components are required to build the keyboard: The following components are required to build the keyboard:
Line 51: Line 57:
   * 1x Keycaps Set   * 1x Keycaps Set
   * 1x TRRS Cable   * 1x TRRS Cable
-  * 1x USB Type-C Cable+  * 1x USB Type-C Cable \\ 
 + 
 + 
 +==== Layout Design ====
  
 I started designing the layout by removing keycaps from some of my keyboards and placing them in the positions I wanted. Early versions looked like this: I started designing the layout by removing keycaps from some of my keyboards and placing them in the positions I wanted. Early versions looked like this:
  
 {{ :​pm:​prj2024:​ccontasel:​matei.ionescu0703:​layout-trail-1.jpeg?​300 |}} {{ :​pm:​prj2024:​ccontasel:​matei.ionescu0703:​layout-trail-1.jpeg?​300 |}}
-{{ :​pm:​prj2024:​ccontasel:​matei.ionescu0703:​layout-trail-2.jpeg?​300 |}}+{{ :​pm:​prj2024:​ccontasel:​matei.ionescu0703:​layout-trail-2.jpeg?​300 |}}\\
  
 After some trial-and-error arranging the keys, I settled with the following layout that I found very comfortable:​ After some trial-and-error arranging the keys, I settled with the following layout that I found very comfortable:​
-{{ :​pm:​prj2024:​ccontasel:​matei.ionescu0703:​final-keys-layout.jpeg?​300 |}}+{{ :​pm:​prj2024:​ccontasel:​matei.ionescu0703:​final-keys-layout.jpeg?​300 |}}\\ 
 + 
 +The next step was to recreate it on the computer to have a reference for creating the PCB and case. I chose to use [[https://​ergogen.cache.works/​|Ergogen]] for this task. Ergogen is an open-source project aiming to provide a common configuration format to describe ergonomic 2D layouts. First I measured the dimensions of my keycaps and the angle of my thumb cluster and started learning how to write a config file using Ergogen by following tutorials and the [[https://​docs.ergogen.xyz/​|Ergogen documentation]]. 
 + 
 +{{ :​pm:​prj2024:​ccontasel:​matei.ionescu0703:​measuring-layout.jpeg?​300 |}} \\ 
 + 
 +The config file that I have written is this: 
 +<file text ergogen_config.txt>​ 
 +units: 
 +  spacing: U 
 +  key_size: 18.2 
 +  big_key_height:​ 23 
 + 
 + 
 +points: 
 +  key.height: key_size 
 +  key.width: key_size 
 +  key.spread: spacing 
 +  key.padding:​ spacing 
 +  zones: 
 +    matrix: 
 +      key: 
 +      columns: 
 +        outer: 
 +        pinky: 
 +        ring: 
 +          key.stagger:​ spacing/4 
 +        middle: 
 +          key.stagger:​ spacing/4 
 +        index: 
 +          key.stagger:​ -spacing/​4 
 +        inner: 
 +          key.stagger:​ -spacing/​4 
 +      rows: 
 +        bottom: 
 +        top: 
 +        home: 
 +    thumbfan: 
 +      anchor: 
 +        ref: matrix_index_bottom 
 +        shift: [-spacing/​2.5,​ -spacing*1.2] 
 +        rotate: -29 
 +      columns: 
 +        near: 
 +          rows.thumb_extra.skip:​ true 
 +        home: 
 +          key.height: big_key_height 
 +          key.stagger:​ (big_key_height - key_size) / 2 
 +          rows.thumb_extra.skip:​ true 
 +        far: 
 +          rows.thumb.height:​ big_key_height 
 +          key.padding:​ big_key_height / 2 + key_size / 2 + 0.8 
 +      rows: 
 +        thumb: 
 +        thumb_extra:​ 
 + 
 + 
 +outlines: 
 +  keys: 
 +    - what: rectangle 
 +      where: true 
 +      operation: stack 
 +      size: [U, U] 
 + 
 +  plate: 
 +    - what: rectangle 
 +      where: true 
 +      operation: stack 
 +      size: [14, 14] 
 +     
 + 
 +</​file>​ 
 + 
 +The config file generates this layout: 
 + 
 +{{ :​pm:​prj2024:​ccontasel:​matei.ionescu0703:​ergogen-layout.png?​300 |}}\\ 
 + 
 + 
 +==== PCB Design ==== 
 + 
 +The next step was to design the PCBs for my project. After studying which CAD software would fit my needs better, I chose to use KiCAD because it is the most popular software for keyboard PCB design and there are libraries you can find on Github containing the footprints of the parts I chose to use. 
 + 
 +I started learning about how keyboards work, what components are needed and how are they connected to each other. After spending a lot of time reading documentation,​ researching other projects and watching tutorial I created my PCB schematic for the left side of the keyboard. 
 + 
 +{{ :​pm:​prj2024:​ccontasel:​matei.ionescu0703:​schematic-left.png?​600 |}}\\ 
 + 
 +Using the Ergogen layout and the schematic, I began working on the PCB itself. After carefully placing all of the components in their position and creating mounting holes I started routing the PCB. The first problem occurred when I received my components from the store. The initial project featured a reset button, but because the dimensions of the Arduino ProMicro were bigger than the ones written on the store page, I had to remove it and readjust the PCB, and the footprint of the microcontroller. After a lot of work all that was left to be done was branding my PCB with the RootKB logo on the silkscreen. The final result looks like this: 
 + 
 +{{ :​pm:​prj2024:​ccontasel:​matei.ionescu0703:​pcb-left.png?​400 |}} 
 +{{ :​pm:​prj2024:​ccontasel:​matei.ionescu0703:​pcb-left-front.png?​400 |}} 
 +{{ :​pm:​prj2024:​ccontasel:​matei.ionescu0703:​pcb-left-back.png?​400 |}}\\ 
 + 
 + 
 +Then I had to repeat the whole process for the right half. 
 + 
 +{{ :​pm:​prj2024:​ccontasel:​matei.ionescu0703:​schematic-right.png?​600 |}}\\ 
 +{{ :​pm:​prj2024:​ccontasel:​matei.ionescu0703:​pcb-right.png?​400 |}} 
 +{{ :​pm:​prj2024:​ccontasel:​matei.ionescu0703:​pcb-right-front.png?​400 |}} 
 +{{ :​pm:​prj2024:​ccontasel:​matei.ionescu0703:​pcb-right-back.png?​400 |}}\\ 
 + 
 +Next, I ordered the PCBs and prayed that they work as envisioned. \\ 
 + 
 + 
 +==== Plate Design ==== 
 + 
 +With the PCB ready, I imported the .dxf files to Fusion360 in order to create the plate. After researching the required dimensions that will allow the switches to click it, I created my first design meant to be made out of FR-4 or aluminum with a 1.5mm thickness. I also created annotated 2D drawings in AutoCAD for production. This ended up too expensive and would take too long to be made. So I redesigned the plate to be 3D printed with a 3mm thickness for more strength. 
 + 
 +{{ :​pm:​prj2024:​ccontasel:​matei.ionescu0703:​plate-left.png?​400 |}} 
 +{{ :​pm:​prj2024:​ccontasel:​matei.ionescu0703:​plate-right.png?​400 |}} \\ 
 + 
 +==== Case Design ==== 
 + 
 +In order to create the case I had to carefully calculate the dimensions. At this point I found out that the sockets I originally planned to use were to tall and the microcontroller would rise above the case (which would be an unacceptable design flow in my opinion), so I switched the socketing option: 
 + 
 +{{ :​pm:​prj2024:​ccontasel:​matei.ionescu0703:​case-calculations.jpg?​400 |}}\\ 
 + 
 +The designed cases: 
 +{{ :​pm:​prj2024:​ccontasel:​matei.ionescu0703:​case-left.png?​400 |}} 
 +{{ :​pm:​prj2024:​ccontasel:​matei.ionescu0703:​case-right.png?​400 |}} \\ 
 + 
 +And putting it all together: 
 +{{ :​pm:​prj2024:​ccontasel:​matei.ionescu0703:​build-left.png?​400 |}} 
 + 
 + 
 +==== Building The Keyboard ==== 
 + 
 +I finally got all the components. 
 + 
 +{{ :​pm:​prj2024:​ccontasel:​matei.ionescu0703:​physical-pcbs.jpeg?​400 |}} 
 +{{ :​pm:​prj2024:​ccontasel:​matei.ionescu0703:​physical-case_3d_printed.jpeg?​400 |}} \\ 
 + 
 + 
 +It was time to build the keyboard. I soldered all the 44 diodes, 44 switch sockets and 44 LEDs. For socketing the microcontrollers I used resistor legs as pins in order to fit the case as mentioned above. 
 + 
 +{{ :​pm:​prj2024:​ccontasel:​matei.ionescu0703:​solder-setup.jpeg?​400 |}} 
 +{{ :​pm:​prj2024:​ccontasel:​matei.ionescu0703:​solder-pcb.jpeg?​400 |}} \\ 
 + 
 +After I bulit the first half, I wrote some quick scripts to test that everything works fine. 
 + 
 +{{ :​pm:​prj2024:​ccontasel:​matei.ionescu0703:​half-build.jpeg?​400 |}} \\ 
 + 
 +And after another day of soldering I had two working keyboard halfs. 
 + 
 +{{ :​pm:​prj2024:​ccontasel:​matei.ionescu0703:​final-result.jpeg?​400 |}} \\ 
 + 
 + 
 +===== Software ===== 
 +The original plan was to use the LUFA library, but due to lack of time I ended us using the Arduino Framework. 
 + 
 +==== Matrix Scanning ==== 
 +Scanning the matrix is the task that runs most of the time on the microcotroller. To store the state of the matrix I am using bit operations. Each half of the matrix is represented as a uint64_t number. Each half of the keyboard reads the state of the matrix representing the keys that are pressed. Then the right half of the matrix sends using UART its matrix state uint64_t number to the left half. The state of all keys on the keyboard is then obtained by using the bitwise OR operation. 
 + 
 + 
 +==== Sending Keys to PC ==== 
 +The layers of the keyboard are represented in the keys.h file. According to which keys are pressed in the matrix state, the according key will be sent to the PC. When a layer changes all keys from that layer will be released. 
 + 
 +The layouts of the keyboard look like this: 
 +{{ :​pm:​prj2024:​ccontasel:​matei.ionescu0703:​keyboard-layout.png?​400 |}} \\ 
 + 
 + 
 + 
 +==== RGB & OLED ==== 
 +I have also implemented brightness and color control of the RGB lights on the keyboard. When the the brightness is modified the change can be seen on the display, and after a short period of time it goes back to displaying the logo. When changes happen, the Left half will send the new color to the right half over UART. 
 + 
 + 
 + 
 +===== Conclusion ===== 
 +This was a challenging project, that took me a couple of months to design, build and program, but the result is awesome and I am happy I'm writing this part of the article on the keyboard I built from scratch. 
 + 
 +===== GitHub ===== 
 +All the files for this project are available at [[https://​github.com/​Matei77/​RootKB]],​ including the case design, PCB and software. 
 + 
 +===== Journal ===== 
 +{{ :​pm:​prj2024:​ccontasel:​matei.ionescu0703:​gantt.png?​400 |}} \\ 
 + 
  
-The next step was to recreate it on the computer to have a reference for creating the PCB and case. I chose to use Ergogen for this task. Ergogen is an open-source project aiming to provide a common configuration format to describe ergonomic 2D layouts. I measured the dimensions of my keycaps and the angle of my thumb cluster and ended up with the following design: 
  
-{{ :​pm:​prj2024:​ccontasel:​matei.ionescu0703:​measuring-layout.jpeg?​300 |}} 
-{{ :​pm:​prj2024:​ccontasel:​matei.ionescu0703:​ergogen-layout.png?​300 |}} 
  
pm/prj2024/ccontasel/matei.ionescu0703.1714841892.txt.gz · Last modified: 2024/05/04 19:58 by matei.ionescu0703
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0