1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Scratch Build – In Progress Open Source Keyboard: ErgoDox GG

Discussion in 'Project Logs' started by ifohancroft, 30 Jan 2020.

  1. ifohancroft

    ifohancroft Minimodder

    Joined:
    11 Jul 2018
    Posts:
    83
    Likes Received:
    51
    Hi everyone! It's finally time for my first project log. I hope you find it interesting.

    I have started with mechanical keyboards couple of years ago, moving from keyboard to keyboard, layout to layout until I started wanting an ErgoDox.

    Example ErgoDox:
    [​IMG]
    Picture from https://ergodox-ez.com/products/ergodox-ez-original-standalone?variant=40172496259

    I looked at what's available but I didn't like any of the existing options, so the solution was only one - make my own from scratch.

    I started by writing down what I wanted from an ErgoDox.
    - The switches must be soldered to the PCB as opposed to being hot-swapable.
    - The PCB must support only Cherry MX compatible switches and only the regular ErgoDox layout as I don't like PCBs that support multiple layouts and switch types (I can see how they can be useful in the mass market but I am making a custom keyboard for myself and I know what I like)
    - It must use QMK as its firmware as it gives you tons of options and it's the most popular and widely used open source keyboard firmware.
    - There must be per key RGB backlight for all the keys, not just under some
    - The switch plate mount style must be sandwitch mount, top mount, bottom mount, gasket mount or integrated plate, but I am definitely not going plateless or using a tray mount (You can find out more about that, here: https://thomasbaart.nl/2019/04/07/cheat-sheet-custom-keyboard-mounting-styles/)

    With that knowledge in mind, I had to choose the electronics components. I knew I wanted to use an ARM microcontroller for the higher clock speeds and generally more space available as I wanted to be able to enable all QMK features I want without having to worry about filling up all the space.

    I had to also take into consideration what features QMK supports on which architecture and which components, so I went to QMK's website (https://qmk.fm/) and started digging.

    Ok, so now I knew what my limitations were and my chosen components were as follows:
    - STM32F303xC for the microcontroller
    - IS31FL3737 for the LED driver
    - SMD5050 for the LEDs (might change them later) I decided to go for a package that has separate pins for the red, green and blue as to be able to easily connect them according to the LED driver datasheet example schematic (although I am not sure if I can in-fact connect LEDs in a different package to this LED Driver)
    - the switches didn't really matter as all Cherry MX compatible switches use the same pinout and relatively the same footprint.
    - I knew I definitely wanted USB Type C for both connecting the keyboard to the PC and for connecting the two halves together

    I will post full parts list/bill of materials when the schematic is finish enough and I am about to order it to get printed.

    So I fired up KiCAD and started designing the PCB. Being unable to find all the schematic symbols I needed in a single place, with the schematic symbols not being designed the way I want them and being a bit of a control freak, I started by designing the important things myself, while consulting their datasheets:

    [​IMG] [​IMG]

    The simple symbols such as a 5V or a capacitor, I have reused from the libraries that come with KiCAD.

    So, I started slowly designing the schematic.

    First, I started with the switch matrix:

    [​IMG]

    Then the LED matrix:

    [​IMG]

    Then I slowly, (because I have no idea what I am doing :D and while I went to school for electronics, I am pretty much reteaching myself now and we never did work with microcontrollers and datasheets in school :D) started building the rest of the schematic:

    [​IMG]

    It isn't fully finished yet. I still have to connect the I2C on the microcontroller for the two halves to communicate with one another and also connect the USB receptacle, also fix the wiring of the BOOT0 pin.

    While getting frustrated with the schematic and wanting a break from it, I still wanted to work on the keyboard but I needed a distraction, so I fired up FreeCAD and started working on the case, which unfortunately, I will have to show you, next time.

    Everything was created with Free & Open Source Software:
    - Created on Linux
    - Schematic done in KiCAD
    - Notes taken in the Termite terminal with VIM
    - Screenshots taken with scrot
    - Images cropped with GIMP
    - Case done in FreeCAD
    - Project log written and posted from Firefox.

    I hope you enjoy it.
    Let me know what you think!
     
    Last edited: 7 Mar 2020
  2. ifohancroft

    ifohancroft Minimodder

    Joined:
    11 Jul 2018
    Posts:
    83
    Likes Received:
    51
    Starting with the case, I used the ErgoDox preset on http://www.keyboard-layout-editor.com/ as a reference and my notes on switches sizes and spacing calculations.
    I had to go through a couple of revisions of the design process to figure out the best way to do this, but at the end, this is what I ended up doing:

    I started with a rough sketch of the outline of the switch plate and then padded it out to 1.5mm thickness.
    Then I started making the outlines of the holes for the switches, that will later be cutout from the plate, making each switch column on a different sketch, so to not end up with a sketch with too much geometry and constraints that will later takes ages to load, then reusing some columns' geometry in others, to constraints the switch columns' relative position to one another.
    Now, the stabilized keys were a bit of a difficulty at first.
    I know the sizes the regular switch holes need to be, but for the stabilized keys, I went the route of getting the json from http://www.keyboard-layout-editor.com and pasting it into http://builder.swillkb.com/ and using the chosen parameters for my switch type and stabilizer, I generated an SVG that I later started measuring in InkScape. I have then recreated the stabilized keys switch cutouts and made them into a macro so I can easily reproduce them. The problem then was what exactly is their position and how to translate it from http://www.keyboard-layout-editor.com to my CAD design. Playing around I figured that the stabilized keys closer to the middle of the keyboard is sitting right below the right most column when not rotated, and rotated 30 degrees from the corner of the next column going inwards, and I use this information to calculate the distance and angle to constraints my stabilized keys.
    Then the holes were cut from the plate and using the switch columns, the plate was adjusted to match them and leave X extra millimeters to the side for mounting it later to the case:

    [​IMG]

    [​IMG]

    [​IMG]

    [​IMG]

    [​IMG]

    [​IMG]

    [​IMG]
     
  3. Cheapskate

    Cheapskate Insane? or just stupid?

    Joined:
    13 May 2007
    Posts:
    12,426
    Likes Received:
    1,989
    Awesome. I'm at the point in my life that I shouldn't even look at making a circuit board. I could make a keyboard that bursts into flames.
     
    ifohancroft likes this.
  4. ifohancroft

    ifohancroft Minimodder

    Joined:
    11 Jul 2018
    Posts:
    83
    Likes Received:
    51
    Thanks! Haha! That shouldn't stop you. I clearly have no idea what I'm doing and I'm still making one. Mine will probably burst into flames too, in-fact I am taking bets not on whether it will burst into flames but what color will the flames be :D
    Hopefully with help and a couple of revisions, I will have a working one that ideally also doesn't introduce interference and stuff.
     
  5. ifohancroft

    ifohancroft Minimodder

    Joined:
    11 Jul 2018
    Posts:
    83
    Likes Received:
    51
    I finally got the time to create an update.

    After a lot of fiddling around and debating different case and plate mounting types I think I finally came up with a case that I like.
    I decided to go with a brushed aluminum in gunmetal with the plate using bottom mount. (The prototype will first be made in plastic).

    I fired up FreeCAD and started going at it.
    Made a separate body and used a shape binder to be able to linked to the plate.
    Created the general shape of the case using the shape of the plate, making it 1mm larger so I can have a lip around it.

    [​IMG]
    [​IMG]
    [​IMG]

    Cut a hole in the case for the plate.

    [​IMG]

    Hollowed it out.

    [​IMG]

    Chamfered the top.

    [​IMG]

    Added a fillet at the bottom.

    [​IMG]

    And the whole thing is pretty much done.

    [​IMG]

    Now I need to finish the PCB, then I will know where the USB ports will be so I can add holes in the case and screw holes as well and I can order the PCBs to be printed, the case to be cut and I can start building.
    There are some surprises/some things I've left out but you will find out about them in either a future update or when the keyboard is done and I am building it.

    Next update would be finishing the PCB schematic and layout.
     
  6. Defyant Mods

    Defyant Mods Multimodder

    Joined:
    14 Sep 2004
    Posts:
    1,305
    Likes Received:
    780
    WoW! just wow this is freaking amazing :thumb: the schematic work is really impressive :rock: It's nice to pop back in and see a project like this :grin:
     
    ifohancroft likes this.
  7. ifohancroft

    ifohancroft Minimodder

    Joined:
    11 Jul 2018
    Posts:
    83
    Likes Received:
    51
    Thanks so much!
    I am learning as I go to be honest and finding and filling some holes in my electronics knowledge. I have recently learned more things that by my calculations will help me have the schematic finished in the next couple of days. I have a couple more ideas, but they may get implemented in a future revision.

    Btw even though only two people have commented on here, besides me, to have those two people be you and @Cheapskate is seriously motivating and encouraging. I am seriously fan-girling right now :D
    It was about time I started working on something and posted a project of mine on here after getting so much help in the form of information, tips and what not from you two.

    P.S. Welcome back!
     
    Defyant Mods likes this.
  8. Jangalit

    Jangalit What's a Dremel?

    Joined:
    28 Feb 2020
    Posts:
    47
    Likes Received:
    13
    nice! I'd like to be able to create these things!
     
    ifohancroft likes this.
  9. ifohancroft

    ifohancroft Minimodder

    Joined:
    11 Jul 2018
    Posts:
    83
    Likes Received:
    51
    Thank you! Why not start and learn along the way? It will be frustrating at first but at a certain point everything will just click.
     
  10. Dot_Kappa

    Dot_Kappa 100% Puppet

    Joined:
    23 Mar 2006
    Posts:
    367
    Likes Received:
    123
    Scratchbuild keyboard is quite like to see an Unicorn over here :grin: !

    Thanks for sharing :clap:
     
    ifohancroft likes this.
  11. ifohancroft

    ifohancroft Minimodder

    Joined:
    11 Jul 2018
    Posts:
    83
    Likes Received:
    51
    I am very happy to be that unicorn!
    Thank you! :clap:
     
    Last edited: 8 Mar 2020
  12. ifohancroft

    ifohancroft Minimodder

    Joined:
    11 Jul 2018
    Posts:
    83
    Likes Received:
    51
    I am sorry for the long delay.

    I have redone the MCU and the LED driver schematic symbols to make connecting them in the schematic easier. Re-started the schematic from scratch as it felt easier than cleaning everything up. I have opted for putting labels on the ICs' pins and connecting everything as separate circuits to make things easier. Recalculated the capacitors for the USB crystal again as I had a feeling that I got them wrong the first time and I was right. They turned out to be 16pF each as opposed to 22pF. Did some more research and decided to do the connection between the two keyboard halves using UART as opposed to SPI. Did a diagram using Gliffy to give me a general idea of what I need to do, to make sure I am not forgetting anything (although I did forget to add the ESD and other protections in the diagram).

    What's left is to connect the USB C receptacle for PC connection, connect the USB C receptacle for UART connection between the two halves, connect the 5V from the USB to a MOSFET and split it to 5V for the LED driver and 3.3V for the MCU. Connect the various decoupling capacitors for the LED driver, redo the LED and Switch matrices and connect the various ESD and overvoltage protections. I believe that's about it on the schematics side.

    [​IMG]
    [​IMG]
    [​IMG]
    [​IMG]
     
  13. Defyant Mods

    Defyant Mods Multimodder

    Joined:
    14 Sep 2004
    Posts:
    1,305
    Likes Received:
    780
    Very Clean :rock::rock::rock:
     
    ifohancroft likes this.
  14. ifohancroft

    ifohancroft Minimodder

    Joined:
    11 Jul 2018
    Posts:
    83
    Likes Received:
    51
    Thank you! I am trying to clean up my schematic a bit and follow some organization patterns I see in other people's PCBs such as separating the different logical parts of the PCB into their own blocks and naming them, as well as keeping the voltage symbols pointing up and the ground ones pointing down.
     
    Defyant Mods likes this.
  15. MADPC

    MADPC Minimodder

    Joined:
    10 May 2020
    Posts:
    90
    Likes Received:
    33
    interesting project
     
    ifohancroft likes this.
  16. ifohancroft

    ifohancroft Minimodder

    Joined:
    11 Jul 2018
    Posts:
    83
    Likes Received:
    51
    Thank you! I can't wait to finish it and get some prototype PCBs made.
     
  17. Cheapskate

    Cheapskate Insane? or just stupid?

    Joined:
    13 May 2007
    Posts:
    12,426
    Likes Received:
    1,989
    I'm gonna come back when I'm awake and re-read that. Right now it kinda went 'woosh' over my head.
     
    ifohancroft likes this.
  18. ifohancroft

    ifohancroft Minimodder

    Joined:
    11 Jul 2018
    Posts:
    83
    Likes Received:
    51
    I know that feeling :D
    Good morning btw
     
  19. ifohancroft

    ifohancroft Minimodder

    Joined:
    11 Jul 2018
    Posts:
    83
    Likes Received:
    51
    I am sorry that this update is mostly lateral instead of showing progression but I've got a lot done and learned a lot and I'm closer to finishing the schematic more than I've ever been.

    (I need to finally set up the Imgur upload script so I finally won't have to keep taking screenshots, uploading them, changing the sizes, copying the urls and inserting them here and instead I can just press a key combo and have the urls ready and formated in my paste buffers. My problem is I'm lazy and after uploading a screenshot to Imgur, I have to select the huge thumbnail size, copy the original url, hit the img button here, paste the link, hit ok/apply/i forgot what the button says, then click the image, close the image settings that open, hit the url button, go back to Imgur, change the size to Original, copy the url, come back here, paste the url in the link settings and hit ok, and I have to do this for every image).

    So, I posted the image as it is on Reddit and various other places for feedback and to make sure my schematic is correct so far and I got a ton of criticism on Reddit about everything being connected with labels instead using wires, making it hard to follow. To be fair, that's correct, even I hard trouble following easily what's connected to what.

    I decided if I'm going to connect everything with wires, making it harder for myself to connect things as I'll have to find how to position the elements to make it easier to connect, not make a mess and either try to not overlap wires (which I guess is impossible in almost every circuit that's a bit more complex than a light bulb, switch and a battery), I may as well change the schematic symbols for the MCU and LED driver to resemble the actual package I'm going to use so when connecting, I'm getting an idea what will go where when I reach the point of creating the PCB layout and also decided to follow some general good practices like using an actual GND symbol for ground instead of a label, have GND always pointing down and +3.3V and +5V pointing up.

    So now the schematic symbols for the MCU and the LED driver look like they do in the second and third pictures in the first post.

    I have changed everything to be connect with wires but I've made a mess (which I forgot to take a picture of) so I copied and pasted everything in the same document to the side to clean up, keeping the original for reference, until I'm done.

    This is the result:

    [​IMG]

    It still doesn't look as good as I'd like and as some commercial PCBs I've seen but when done connecting everything, I'll do my best to make it look better. Although it would probably never look as neat and pretty as connecting everything separately with labels.

    I have reconnected the decoupling capacitors between the power and ground pairs and the decoupling capacitor between the supply pins (marked in red), reconnected the reset circuit (marked in green) and reconnected the crystal for the USB (marked in blue):

    [​IMG]

    Now that the schematic is back to where it was, I have added the USB-C connector for connecting the keyboard half to the PC (J1), along with ESD protection (U2) and the voltage divider (as the MCU requires 3.3V, not 5) and protection circuit (U3):

    [​IMG]

    I have added the second USB-C port, that will be used for connecting the two keyboard halves together (J2) along with ESD protection for it as well (U4) but I totally forgot that the keyboard half that's not plugged to the PC, still needs to powered somehow, so thanks to HaaTa from Input.Club for reminding me about that so I've connected VBUS and added a voltage divider and protection circuit (U5) for that USB port as well:

    [​IMG]

    I have had an SWD connector for serial programming and debugging, but HaaTa gave me an awesome idea. To save space, don't put a header on the PCB, but just the necessary holes and use tag-connect (maybe it's also called J-Link?) https://www.segger.com/products/debug-probes/j-link/accessories/adapters/10-pin-needle-adapter/ so I have removed the SWD connector and need to yet create the schematic symbol for the necessary PCB holes for the J-Link/Tag-Connect but I love the idea. It's a ten needle pin connector you attach to the PCB when you want to debug and because of the holes orientation you can't connect it the wrong way.

    I have left the ESD inrush protection as it is/was? from the previous version of the schematic for now (it's not worth a picture of its own but you can see it in the bottom left, of the first picture in this post/update) and I have just started connecting to power/ground pairs of the LED Driver.

    P.S. I don't think I've ever explained how the keyboard will work/why it's in two halves or what's the idea, so here it is:

    The keyboard has two halves (1 and 2), each half, has two USB-C ports (A and B).
    It can be used in one of two ways:
    1. You can connect either one of the keyboard halves using its port A to the PC and use it as it is, as either a left or right handed gamepad/keypad, depending which side you connect.
    2. You can connect both sides together via a USB-C to USB-C cable, using their ports B and connect either one of the two sides (but just one of them) to the computer, using that side's port A and you have the input of both sides being sent to the PC.
     
    Last edited: 7 Jun 2020
    Cheapskate and Jean R built like this.
  20. Cheapskate

    Cheapskate Insane? or just stupid?

    Joined:
    13 May 2007
    Posts:
    12,426
    Likes Received:
    1,989
    This is fantastic. I just hope nu-windows lets you do it. :worried:
    -guy that uses a win 2000 laptop because anything newer insists my DAC is a headphone. The maker couldn't pay the windows trusted driver 'protection' money.
     

Share This Page