How to Build an Open Source Bluetooth Mechanical Keyboard

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome back to element 14 presents I'm Clem and I said it before and I say it again there should be an open source variant of everything even of a simple wireless keyboard so let's make one [Music] in this episode we are building a keyboard completely from scratch no pre-made Parts our own PCB our own custom firmware even our own custom keyboard layout because if we make it all custom then we basically can make all other things that are not as custom so let's get started if you think about making your own keyboard you won't bother with stuff like this you would want mechanical switches not membrane switches because you have to be a keyboard Enthusiast or a weirdo like me that rather spends a lot of money and time to build his own Contraptions then go in the shop and buy one there are a ton of different mechanical keyboard switches around and they all feel and sound differently you may be able to hear the clickiness I personally preferred a very clicky ones and so of course I want my keyboard to have those there are a lot of different types of switches by different brands different manufacturers different sizes and I want my keyboard to be very weird I want it to be Bluetooth connected probably a Bluetooth low energy I want it to be a low profile one so these are the normal ones and this is a low profile key like on a laptop very flat so it's super compact I don't want the full 100 and something key layout I want a compact layout I think about 60 keys and it has to be a weird mashup of the English 30 layout and the German quartz layout because I basically need both in my daily driving also for a ble keyboard it has to has the Lipo and charging on board and on top I want it to be modular so I can exchange Parts whenever I get new ideas and also we're doing everything from scratch that's gonna be a big project this project will actually be my second keyboard that I built I've made one before in this previous project that you may have seen this tiny computer has a full karate keyboard This is a Charlie Plex keyboard and you can see little LEDs flashing here that is actually it's scanning the keyboard array this time I don't want to use Charlie plexing but multiplexing it's more suitable and classic for such a keyboard when you have enough IO to use I would like to see if I can translate that concept with the LEDs over to that keyboard because I like the look of this and also LEDs are still cheaper than proper signal diodes so let's just try it out now that I see a normal keyboard and I want to make like a 60 button compact one this is still going to be a huge PCB so let's better get started in kaikat welcome to my computer and Kai CAD this is the complete schematic for all the stuff that is going on directly on the keyboard when we look here this is our main microcontroller and esp32s free this time because that one has Wi-Fi and Bluetooth and I want Bluetooth this time also I need a lot of IO this thing has it so we have four LEDs these are for the state then we have a lot of resistors here all going to the keyboard itself and over here we got a Molex Primo Flex connector which is meant to interface different boards and because I don't know how they will exactly line up and how far they are spaced apart in the vertical Direction I use these Primo flexes because then it doesn't matter I just use a cable in like appropriate size and then I can bury that so that's pretty handy let's look at the keyboard Matrix itself this has 60 buttons they are in a 12 by 5 grid so this is a normal multiplexed uh one these here are LEDs instead of the usual diodes in the schematic it doesn't matter you just match a different part uh then in the layout and you could use whatever tiles on here so I just use LEDs because I think maybe this uh LEDs as a diet concept also works with the big keyboard we'll see here we have the second Port this might be familiar to you I've used this circuit in a few projects before which is a very simple charger and protection circuit for liposals only for single cells and of course it has another of these primoflex connectors and here's the tricky thing you have to really think about how the boards are orientated towards each other you can get these connectors with pins on the bottom or on the top and you can also get the little cables with pins on the same side or on opposite sides so depending on how that board is you have to choose the right parts and then they connect correctly to each other if you messed it up you're in trouble let's look at that as a board you can see it's really wide and it lines up like this empty space here lines up with the LEDs on the board below it and all the stuff is on the other side of the board there are not even traces on this side and this is the main board with all the switches and with all the other electronics on here so the secondary portals cover this upper portion and here concentrated in that corner is all the business stuff hi I'm Derek and this is DC to Daylight where we explore the world of electronics in the realm of DC Audio frequencies RF and into the visible spectrum of light here we take electrical engineering topics out of the boring old textbook and bring them into life through demonstration and test sometimes we even build stuff and if there's a way to test the concept at hand we'll put it on a scope and measure it and in doing so hopefully bring it to daylight so if that sounds like a good time to you come hang out with me every couple weeks here at element 14 presents alright see you there thank you the boards have arrived thanks to Isla for manufacturing them for me this holds all the keyboard switches I deliberately made them so they would accept more than one switch and also they accept hot swap sockets so in case you would like to rebuild this uh you don't have to use the exact switches like I did I can't give you a list of compatible switches because I don't know but you might also make your own switches fit just check the files and see if they line up oh and also I got a second board because this one doesn't only have the keyboard switches the microcontroller USB and a primoflex connector on it it also has the interconnect to the second board which holds all the Lipo charging and that goes over here so we have to have a flexible interconnect between these and that is what I use those Molex connectors for that you've seen on the schematic [Music] foreign [Music] thank you [Music] of course just a bunch of switches on a board isn't a keyboard we need keycaps of course I could use standard keycaps but they wouldn't actually fit the layout that I intended then I could use blank keep caps but then I wouldn't like see what they are doing and I'm not good at memorizing all the functions of a keyboard so I actually looked down on it more often than not so I 3D print my own keycaps and I have to design them of course in freecad welcome to freecad this time we're not making a case we're making keycaps I basically make really weird keycaps they should fit a switches that are not that standard B they are low profile as you can see here and see they have like a completely custom layout and these letters and symbols are actually on the inside so if I turn it around you can see those are raised on the inside and then I can mark them with a sharpie and they will be visible through the outside so no matter how much I touch these this surface here they will never wear off never Oh and before I forget I also designed a shell for the keyboard this was supposed to be milled in aluminum but I couldn't get it made uh in time I 3D printed a proxy and it it's okay but it doesn't look that great so basically I just stuck some feet under the keyboard and use it as this and it already works great but if you want a case there it is and also the files are on the community so knock yourselves out with it the Curious among you may have noticed that all these keys are in lines they are ortholinia as opposed to staggered like on a standard keyboard the Staggering of keys is residual it's like in the old days with typewriters you had to have them staggered because of mechanical reasons now you don't and that is why or for linear keyboards are now a thing I tried one out about a year ago or so and I wanted to have one I couldn't find one to buy it now I have one because I made it myself and you can too so if I switch this on it doesn't do anything because there's no code on it how could it do anything we need to go to the Arduino IDE and look at the code oh it's finally time to talk about the code well we're in Arduino of course and I told you I'm gonna write the firmware completely from scratch I'm actually not doing all the things from scratch because I'm using a library to read the keypads but that's it and also there's a ble Library so you can still say yeah it's done from scratch but yeah libraries so we include the ble keyboard Library this did not work with an esp32 S3 from the get-go I had to modify it a little bit okay we need the Adafruit keypad Library uh just because it's easier to do that than from scratch we have five rows 12 columns these are my pins for the rows these are my pins for the columns here are some really handy modifier key codes then we have the Keyport layout this is basically layer one and I don't have that once I have it four times these are basically the keyboard layers and we have to make instances for all four of these so here are the LEDs then we uh start all our keyboards or our keypad so it's like we have four and one and also a Lee connect the keyboard we have to first make sure we know in which layer we are and when we know that we change to that layer so the code is a bit backwards here because it works faster that way I switch stuff around to speed up the whole thing so that's how it is if you want to change your keyboard layout you just go up here and put in whatever you want and that's it that's how you change keyboard layouts flash that on the controller hooray yeah let's get this thing going so during my experimentation I encountered a problem my concept with using LEDs instead of diodes doesn't work as intended you know why voltage drop it did work on my tiny little handheld that I got here because this is a 5 volt system the voltage drop across these diodes is not too much so it could still register any key presses but this is a 3.3 volt system and that means the voltage drop is too big so I have to replace all the resistors with 0 ohm resistors and I'm also replacing all the LEDs with proper signal diodes so it's going to be expensive again well that's what you get development [Music] finally it is done we have working code we have a botched board now we can turn this on and then we get a little light show and that indicates a proper boot process and now we should be able to find that with our PC and with the phone so let's try out if typing already works I personally like to have some indication if there is like shift or alt or something else pressed so I made this to have a visual indication of whenever I press one of these modifier keys so I know on which layer of the keyboard is at the moment active so I can basically see that in my peripheral region and also I like the light show right a lot [Music] we did it folks we made our completely open source Bluetooth keyboard from scratch nothing pre-made on here 3D printed keycaps with a custom layout or for linear low profile included LiPo battery and my personal favorite the lighting up for switching layers which I personally really really dig if you want to make your own all the files for this are on the element 14 Community they are also extended code and Cat segments so if you're really interested in the details go watch those videos and I'll be happy to answer all your questions in the comments I gotta go there's another project waiting for me [Music]
Info
Channel: element14 presents
Views: 10,090
Rating: undefined out of 5
Keywords: electronics, hardware, hacking, mods, element14, maker, engineering, element14presents, mechanicalkeyboard, mechanicalkeyboards, esp32, esp32project, esp32projects, kicad, pcbdesign, arduino, arduinoprogramming, arduinoproject
Id: -4tss7pzekc
Channel Id: undefined
Length: 16min 3sec (963 seconds)
Published: Fri Sep 08 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.