How to NOT Build a Keyboard, or: Time to Stop Doing the Same Thing Harder

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
this video was going to be the first part in an electronics build project to make a small portable computer in a way it still is the first episode of that project because i haven't given up completely the theme of this particular piece though is different from what i thought it would be i thought this would be the fun story of the success of part one but instead this video is actually going to be about deciding to stop doing a thing that isn't working i mean that should be easy right well apparently not because i struggled on with this for weeks so join me if you like as we walk through each rather painful step along the journey [Music] i'm not actually going to build very much of this from scratch in fact i'm going to try to make this something that's built out of off-the-shelf components as far as i can so i'm going to kind of frankenstein a bunch of things together to try to make a portable computer based on bits and pieces i can get from here and there so kind of naturally for this sort of application the computing part is going to come from a raspberry pi zero two which i've got there so i was amazed how small these things are look look at that it's a fully fledged computer that fits in the palm of your hand i knew they were small but i until i held one i kind of wasn't really aware of exactly how small but there we go so the raspberry pi zero two now why not the raspberry pi 4 or the raspberry pi cm4 compute module or something like that well mainly because more power consumption and heat management this is not as powerful computationally as a raspberry pi 4 or compute module or whatever but i don't need all of that power i'm not intending to play games on this thing although that probably will be possible anyway i really want something that consumes a small amount of power that will run for a long time on batteries and possibly can be charged by solar or other things and can be used out in the field for i don't know time lapse photography for example so in addition to that i've got this which is the witty pi 3 mini and this is a device that's intended to be a power supply and a real-time clock module for the raspberry pi zero or in fact any of the raspberry pi's so this will slot on top it gives me a power button which will be a graceful shutdown for the raspberry pi rather than just yanking the power but notably when you press the when you actually shut down using this module it shuts down all the peripherals and things as well so that's necessary for this sort of application so that's the witty pi 3 mini and then for power supply i've got this little module here which is actually designed to go inside of a power bank so you would just attach a bunch of lithium ion batteries to these two tabs here battery put minus and battery plus and it provides a power bank basically with a fast charge socket and a regular usb power socket out and then these are the inputs here it's got usbc micro usb and lightning and which is quite good actually i'll probably try and retain those and we'll have something that can be charged from a bunch of different possible inputs which makes it versatile i may desolder this standard usb port here so that i can actually wire directly into the power input for the witty pi i'll probably keep one socket so my little mini computer can still be used as a power bank even when it's turned off it can power other things or charge other things if necessary that seems like a useful thing to do now the raspberry pi zero has only got one usb port which is one of these usb micros here the other one is just power this one is this one here is power and data so it's only got one actual usb peripheral port which is a bit of a limitation so i'm going to hack this little usb 2 hub which has got four ports and i will take the circuit board out of that and we'll build that into the thing as well and again some of these usb ports here will be used for internal stuff so i'll probably desolder the socket and solder the wires directly in but at least one of them will keep on the outside of the unit so that it can connect to webcams or external storage or whatever i want to plug in there so there's two kind of big components still missing here one is the display which i haven't decided what i'm going to do with yet i have seen some 7-inch lcd display panels on the market where you can turn the back light off and in bright sunlight it acts as a transflective display so you can still use them in bright lighting conditions and you can save power by having the backlight turned off that sounds like a good idea to me it's a bit like that olpc project where it was a very low powered laptop designed for developing countries and you could turn off the backlight and enjoy quite a long run time as a result of that i'm hoping i might be able to do something like that so the screen i haven't decided yet but it might be something along those lines typically those are hdmi screens and this has got hdmi out and it'll use usb probably for touch screen in so the other thing i haven't talked about yet is the keyboard how are we going to do the keyboard well there are a number of different ways people do this sometimes people use a bluetooth keyboard and so they just plug the bluetooth dongle into this thing or maybe use onboard bluetooth on the raspberry pi if it's got it can't remember if this one does and then they have their bluetooth keyboard that communicates via bluetooth inside the casing i don't really like that i don't know why but i don't really like the idea of having something that communicates via radio inside the casing to its motherboard it just something about that seems wrong to me so i'm not doing that another possibility is to get an off the shelf keyboard and there are some off the shelf i squared c keyboards and there are some off-the-shelf small usb keyboards the smallest sort of commercial keyboard you can get is about the size of the raspberry pi 400 keyboard and and then one other kind of broad range of possibilities is to use a microcontroller like a teensy or something like that and build my own keyboard matrix and program the microcontroller to act as a usb keyboard which lots of people do and that's probably the right way to do it if you want a custom keyboard i'm going to do something a little bit like that but also a little bit different and a little bit kind of typically atomic shrimp i'm going to budge it so let's go to that segment right now so what i've got is a standard keyboard a really really cheap one i bought this for three pounds in a charity shop and it's new as far as i can tell and it's it's incredibly poor quality watch this look at that now i'm not very worried that bending it like that will damage the pcb that's in here because i don't think there is a pcb in this part of the keyboard i don't think there's actually any printed circuit board other than perhaps somewhere around here we'll see first thing i'm going to do is take a photo of this keyboard so i've got the keyboard layout captured and then we're going to take it apart and see what's inside so lots of screws to undo let's get cracking with that really don't know why a keyboard that's as flimsy as this one would need this many screws holding it together it's kind of bizarre i'm surprised they didn't just glue it to be honest keyboard brand here is voltec although the box that it came in doesn't have that branding on it and i'm sure this is a i probably should have tested this first i'm sure this is a working keyboard but this is really the kind of keyboard you might buy if you've got no other choices if you just need a replacement keyboard in a hurry and you buy this one at some discount store or something like that i suppose it might also be a quite a good keyboard for an environment where the keyboard is going to get ruined like a workshop pc for a cnc machine or something like that it might be a good choice to buy a really dirt cheap keyboard that nobody's going to cry about if you get sawdust and stuff in it i think what we're going to find in here is a membrane a rubber membrane over a plastic kind of keyboard grid a plastic contact grid so i think we're going to find there's a film of plastic with some printed lines on it some conductive printed lines on it and a rubber sheet with little deforming rubber domes that have conductive pads inside them and press to make contact with the oh that's why it's got some that's why it's got so many screws i think i might have to there's two more to undo that yeah okay fine we'll just keep going okay this is why it's got so many screws is because the plastic is so flimsy that it would warp if it didn't have this many screws sandwiching it together oh well fun times so yeah that many screws feel free to count those and stick a count on the comments if you wish oh yes my expectations are significantly met so what we've got is a oh i thought no okay so slightly different from what i expected lots of little singular deforming rubber caps i expected there to be a single sheet of rubber here with all of these caps built into it but no apparently we've just got lots and lots of individual single caps with a tiny little piece of conductive you can't even really see it actually but i assume oh no it's not actually do you know what this is this is two layers oh wow okay so okay quite quite a little bit different from what i expected so we've got two layers let's get it all out and we'll have a look at it so i think it's all screwed in right okay so there's three layers so there's a layer of contacts there's a clear layer with holes in it and there's a third layer with the other side of the contacts and what's happening here is when you press down on these little rubber domes it's squishing those two sheets of plastic together through the holes in this middle sheet and making contact that doesn't seem like the most reliable mechanism to me but no no matter it's not the mechanism i'm going to use what i'm actually interested in is let's get i'm gonna have to take it out there's a little rubber strip there holding that down let's get rid of the membranes what i'm actually interested in is this little pcb here because essentially what we've got to do now is reverse engineer this matrix so we find out which where the columns and rows go build our own keyboard matrix that resembles that and connects to the grid connects to the headers on this pcb it's got three little leds which shine through holes there and out the window and so that is the actual electronics for this keyboard but what that is is the electronics for driving a keyboard so what i need to do now is take this keyboard matrix so we've got rows and columns so that looks like mostly columns and this looks like mostly rows so i'm just gonna pull these layers apart this is annoying actually i was hoping i was gonna be able to trace this with a multimeter but i have actually destroyed a couple of the traces so that will not work now anyway so we've got mostly rows here and then we've got mostly columns here so what i'm going to do is using these traces figure out which things go to where those first eight tracks there are rows and the remaining tracks are columns there's actually two different ways i could reverse engineer this one is to look at all of the traces that come from these various different things and relate them to the keys on the keyboard and figure out that okay i know that's the escape key there so i can just follow that track back to where it goes and likewise on the other grid i can follow that one back to where that goes or i could take this pcb and just plug it into a computer and short out a lot of these pins because i know these first eight are the rows and i know the rest are the columns and so i could just actually progressively just one at a time short out every combination of these pads and see what keypress that gives me i might actually do both okay so at this point there might be two questions in your mind first one might be why do keyboards even use a matrix simple answer is economy of input lines basically if you have more than a few keys to address if you have separate wiring for every single key that quickly gets very cumbersome and you run out of data inputs for your microprocessor to be able to process them and so a matrix of keys gives you basically the product of the rows multiplied by the columns in terms of buttons you can address using just those input lines and i suppose the second question you might have is okay this keyboard uses a matrix but why is it such a weird layout and that has to do with ghosting so in a keyboard matrix just a standard keyboard matrix if just one button is pressed you can tell that one button is pressed because it just lights up the two coordinates the row versus the column if two buttons are pressed you can still read them because there's no other combination that produces those outputs once you press three buttons if two of them are on the same row or column you get in a situation where you can't tell which buttons have been pressed and actually you might think the wrong button has been pressed more expensive keyboards by which i mean ones that don't cost three pounds in a charity shop overcome this by a variety of different methods including diodes and different ways of scanning the keyboard this keyboard doesn't have those safeguards and so what they appear to have done here is wired the rows and columns in such a way that the keys that you're likely to press in combination like shift or control and alt aren't on any of the same rows or columns it's still only got what they called two key rollover it's just a little bit less likely that you're going to collide with the inherent two rollover of this simple keyboard matrix just because they've separated some of the keys that you will press in combination but i think we've probably sidetracked a little bit too far there okay based on a really cursory analysis of the keyboard matrix layout i have established i think that this trace here which is the leftmost of the rows and this trace here which is the leftmost of the columns should give me the letter q so i'm going to plug that end into my old laptop this is my very very old notebook that i use for sound recording mostly and will test my assumption so off screen i'm just going to short out those two pads with a little jumper here we go so it's that one and that one here we go and i'm right there there's the letter q cool okay so just got to do that with the rest of them and we'll figure out what all of those things are [Music] do [Music] [Music] [Music] so here's the plan using this piece of prototyping board and these little momentary switches and these teeny tiny keycaps i'm gonna make my own keyboard now slight bit of disappointment with these keycaps they do fit onto a square post in the middle of the switch but there's about a few degrees of rotation there which is a nuisance because i thought this i was just going to build this keyboard and leave it bare like this but it looks like i'm gonna have to make a mask to go over this to keep those keys aligned otherwise it's gonna be all wonky because my donor keyboard was a full-sized keyboard i am tempted to make the world's smallest full-size keyboard but i probably will slim it down and lose the numpad i might keep the nav cluster if there's space so now i've just got to populate this with switches i've drawn a layout in powerpoint that i think will work it's possible to put these switches you can put them staggered like that or staggered like that you can't put them well if you if you want to put them staggered half and half you have to have an extra row because of where the little contacts are because of where the pins are i'll show you what that looks like from underneath you can put them with the pins on the same row if you stagger them like that or you have to have them on a separate row okay so there it is and we've got the function row we've got the regular alphanumeric rows spacebar i can't make a spacebar so i'm just going to put two space keys down here so that you can hit one or the other of them i'm not going to try to bother with stabilized wider keys like the space bar or a bigger caps lock or return button they are just going to be single buttons just to keep things simple so over here we've got little nav cluster and then page up page down and then home end delete insert backspace is there enter is there so now i've just got to solder this all in and then start wiring it up of course there is always the possibility that i can make another board to go on here for my numpad depending on the form factor i go for on this device there probably is still space for that because it's got to be about the size so the actual computer itself has got to be about the size of a sheet of a4 paper so there is room for a numpad on there if i choose to build one additionally and i can easily do that and carry the wires across just a little ribbon cable on there or something like that and connect them across so it's a possibility anyway soldering time now so i bought myself a soldering station because i thought it might be i'm going to be doing a lot of soldering here so i thought i might as well get a proper soldering station with temperature control this was fairly cheap on amazon but i got this card in with it you won the price and all i have to do is contact this email address or scan this qr code i only can get the price by contact the seller email address within three days well i did that but the email address bounced and the qr code goes to a dead website so i guess i did not won the prize i imagine this is going to be one of these things where you get the free gift in exchange for writing a gushing five-star review on amazon so probably best i didn't anyway this is going to create some fumes and i don't want to sit in a room full of fumes all day so i've got a little usb fan i've got a tumble dryer hose which just happens to be the right size to fit on there so the plan is there it is i'm gonna secure that in place with a bit of tape and then i can run this hose this hose is three meters long i can run that out of the window and hopefully that will catch most of the fumes obviously it's got to drive them down that tube and this fan was not designed for that but if it gets some kind of airflow going it's gonna be better than me sitting here breathing fumes okay not pretty but we've got a gas tight seal on there the weird thing is this is you just touch the base to activate the thing it hasn't got a switch as such um and i'm using it obviously not as a fan but as an extractor but same difference let's just see if that works oh that works really well look at that yeah that'll do this is just going to be a laborious job of soldering in all these little pins not really actually very sure but i've made those good solder joints very good let's have a look right my soldering i might need to actually just heat those a little bit more to flow them down onto the pads but i've got to be careful it doesn't actually really matter because i'm not using these pads as such i'm going to solder wires to these so as long as they're mechanically held in place they're going to be fine [Music] okay getting a bit sloppy here i noticed i've dabbed solder onto the pads adjacent to the pads just need to get a bit more tidy i think i might have needed to clean that bit sooner than i did still i haven't caught a problem i don't think okay last couple of joints now and then i'm just going to give this a good look over with the magnifying glass just to make sure i haven't bridged anything or any mainly dry joints doing remedial work on the soldering at this point is going to be a lot easier than it will be later in the project so i'm going to check that right over now i'm reasonably happy with that i think my quality of my soldering improved as time went on there it has been a long time since i did this much soldering what's interesting is that these circuit boards are quite flimsy but now that i've soldered all of these switches in they've kind of reinforced it and given it a lot more rigidity anyway that's the keyboard that's going to be the clickiness of the keyboard if there's only one place where that was bridged and it wasn't bridged it was bridged to an empty pad so but i fixed it anyway i'm happy with the rest of the joints i'm just going to slap some keycaps on there now so we can get a feel for what this keyboard will be actually like i've got a plan for putting legends on these keycaps as well i'm going to use i'm going to use my laser engraver to tattoo them which comprises painting them with a pigment and then melting the pigment into the keycap with a laser it's kind of like laser engraving but where i will use an ink on there as well it will kind of tattoo the ink into the plastic i think that's a valid term tattooing laser tattooing obviously there's not a lot of key travel on these but you know this is a portable device this is not going to be having a lot of typing done on it but i did want to have a kind of full function keyboard so that it can potentially be used to type anything without needing weird key combinations to get to standard characters so it is going to be a kind of kind of almost full-size keyboard but yeah as you see that these keycaps are not staying aligned which i think would be really annoying so i'm going to cut a kind of matrix grid to slot over the top of that which will which the keycaps will poke up through and then that'll keep them nice and neat and tidy and it'll keep dust and dirt off of the key switches as well which is good i'm going to populate all of these and then back in a moment and yeah that's what the keyboard is going to look like so i'm quite happy with that there's enough space there for two finger typing which is probably about all we can really expect to do on this device anyway so yeah now i've got to create the matrix on the back of here kind of weird thing about these little switches is i hadn't actually tested to see which way they work so what happens is these two pins are naturally connected to each other so are these two and when the button is depressed all four pins are connected together so these this pair is connected to this pair so the connection is across the switch like that which is fine doesn't really matter as long as i know which way it works but just to confirm that so if i just get my multimeter here we can see that those two pins are already connected together whereas those two pins diagonally opposite are connected when i press the button so to assist me with soldering this i've made a diagram of the keyboard layout and i've flipped it and printed it the other way as well so that when i'm this way up i can know for example that this key in the top right hand corner this time is escape and over there is end home and so on now i've got to refer back to my spreadsheet because that will give me the rows and columns for all of this matrix that i've got to make right this is not pretty and i'm not proud but it is working so i've just put some pieces of wire through these holes here and soldered them in and then i'm just sweating them onto the terminals of this circuit board the traces on this circuit board are so thin that there's hardly any copper there to actually solder to it's obviously it's not designed for this it's designed to have a carbon ribbon attached to it but we're doing okay and what i'm doing actually now is then then just testing for continuity by just poking through the solder mask there i'm just testing the resistance just to see if i've got it alternatively i could have done this the right way you know the way everybody else does it but where's the fun in that so that's the rows now i've got to do all the columns and i have run out of this wire actually i've only got a little bit of this left so i'm going to find some more of that and then we'll do the same with all of these columns okay well that was not a soldering job i'm tremendously proud of but it's done so i've transferred all of these tracks here onto traces on the pcb i've had to offset them a little bit here because i ran out of space and i had to use start using thinner and more flexible wire because the pitch on this board is smaller than it is on this one this cheap perf board is very very easy to lift traces on actually if you put the soldering iron on there for too long so anyway the next thing to do is going to be to test this because it was really really difficult to solder to the these tracers on this pcb because they were only designed really to have pressure contacts on them they would seem to be really really thin copper i might be a bad workman blaming his tools here but i had a heck of a job trying to solder to these traces and i think i might have destroyed a couple of them if i have i've got some wire glue that i can use to repair the tracks so all i would have to do there is just probably scrape back to the copper there and then create a little bridge of glue to the wire okay that was fun there were three or four traces where the solder hadn't made very good contact with the pad so i used some of the wire glue to repair those and that has worked so i've now tested all of these traces by just shorting them out with a piece of wire using examples from my spreadsheet and i've tested that every one of these little pads here works so the next thing to do is now to wire the keyboard matrix and so i sorted my spreadsheet by the columns which is these pins here first rows start at that end so i'm going to take column zero and then find the keys that correspond with it and sort them kind of in the order i want to wire them which is what i've called new index on my spreadsheet and i'm going to use this basically to reference where i need to go so this column zero needs to go to escape one the little uh the little backward single quote then it goes to q tab a and z okay i'm going to use this wire this is magnet wire it's enameled wire and what happens with this is if you do it right the solder the soldering iron just burns the enamel off in the places where you actually heat it so it should be okay to run this across the matrix and it won't short out to anything but where i solder it and melt through the enamel it should make a contact that's the theory i found another use for these little plastic pins which these are sequin pins these will be useful in just guiding where the wire is going to go because i want to keep this layout as neat as i can so i'm going to solder onto there now i'm going to go around there and around there to make a nice straight piece of wire but i think first what i'll do is i'll just give that a stretch so i've got a nice straight wire soldering iron on now i shouldn't need any extra solder here it should be possible to just touch these onto the existing solder connections just going to wait for that to heat up it's good soldering iron it heats up really nice and quick and i'll have the extractor on i don't think this will make much fumes actually because this most of the most of the flux has now actually gone okay so that's connected onto there now i'm just going to run it now around that pin around that pin which takes me to my first contact which is that one for the escape key and this thing about the enamel just burning off of this wire kind of not true it really does take a fair bit of heat which i suppose is a good thing so really i've now just got a plug on and do the same thing so i've done row zero i've now got to go and do row one i'll do all the rows then i'll do all the columns the columns start at this end so i don't think i'll show you all of that i'll probably just plug on and get it done and then we've got to go and do the task of testing to see if key presses actually create key presses okay something's just happened and it's changed everything and i think actually this video is going to change from being a video about a project to a video about how to stop a project how to decide to stop doing a thing so this whole project has been like an exercise in the sunk cost fallacy which i've mentioned before in other contexts but the sunk cost fallacy is where you keep going at a thing because you've put so much effort or cost into it already it seems a shame to stop now even though actually it may be getting harder and harder to make any progress let's have a little recap and then i'll tell you what's actually gone wrong here this pcb i took out of a very cheap keyboard and i reverse engineered the whole keyboard matrix and made i made myself a big spreadsheet so that i could use this pcb to drive my own keyboard matrix nothing wrong with that theory but in practice it turned out to be more difficult than i thought because i had trouble soldering to these little traces for one thing that could just be my soldering skills but i think actually these traces are designed to work with a pressed on carbon film rather than solder onto them so they're probably a little bit thinner than they would be if they've been solder pads maybe not i don't know so i kind of overcame that by using some by getting some of this wire glue and i've wire glued a few of these things on and that works but soldering this keyboard matrix is harder than i thought it would be and what's actually happened here there's two things going on here one is that this enameled copper wire it takes a bit more heat than i thought it would to burn through the enamel on this and so in the process of kind of soldering these things onto there i'm making a real mess of the soldering and i think actually probably melting the solder pads away from the pcb in a lot of cases so it's just got really really messy it made a mess of the joints i bridged a few things which i had to then scratch through and repair and so on so that got a bit difficult and then i got about probably two thirds of the way through wiring the columns and realized i've been doing it wrong or at least i've made several mistakes on this board and it's going to be very difficult to actually backtrack and undo them partly because the damage done by all this soldering if i go and unsolder this now and start again i'm going to have a probably an unusable pcb here because it'll just lift too many solder pads and if i try to use a brand new perf board it means i've got to go through the whole process of trying to get this thing soldered in place again which it was hard enough the first time i'll show you what the problem is or rather i'll show you how i caused the problem these little tactile switches have got two sets of pins which are shorted in pairs so that that pair is connected together that pair is connected together and when you press the button it connects across the four except if you want to pack them really tightly on this perf board what you end up having to do is i've got them there like that i've got that switch there like that so if you want to put them really close together on the circuit board you have to nest the pins like that which is fine but the problem is that when you've got these keys nested like that it can be a bit confusing which of those pins belongs to which switch and so this pair here and this pair here belong to the lower switch and then this pair here and this pair here belong to the upper switch and that's not all that confusing when it's only two switches so when you add further switches into the mix you end up with potentially quite a confusing array of pins and hands up that's what i've done i've gone and got myself confused about which pins are which and i've soldered to this pin here thinking it belongs to the switch that's in this space but in fact the switch that's in this space is using these four pins i could just move that across but i think i've done the same mistake in lots of different places so it would be a case of scrapping this and starting again so unfortunately this is going to be a project that goes no further i've decided the best thing to do here is stop and stop throwing more effort at rescuing this project which is a bit of a non-starter a bit of a shame but there we go so i'm going to have a different approach to making a keyboard i'm going to scrap this and start over with a better plan so sorry i've made you sit through a really long video about something that isn't going to come to fruition for a little while yet but i think it was interesting anyway to see the various steps along the way here that all seemed reasonable at the time but when you look at the sum of all of those steps it's a lot of effort to get to something that just gets harder and harder as you go along so watch this space i'm not going to shelve the idea of making that mobile computer but i am going to rethink this keyboard thing i don't know whether i'll rescue a keyboard matrix from a keyboard that was a heck of a lot of effort uh reverse engineering that whole keyboard matrix it took me days to do that so it would probably take less time for me to just buy a qmk module and design my own keyboard matrix there's a bit of a learning curve there but the amount of time and effort i've kind of invested and poured into this is probably greater than that would have taken anyway so i suppose the lesson i want to take away from this is that uh i mean i love doing things the wrong way sometimes you can discover really interesting stuff if you take a different route to the route that everybody conventionally takes and that's lots of fun this started to not be fun and yeah it's time to call a halt and this is just one of these cases i think where people would describe this as the wrong way for a very good reason it's not a productive way to make a keyboard so got some rethinking to do meanwhile i hope you enjoyed watching this video anyway even though the conclusion is perhaps a bit disappointing thanks for watching and i hope to see you again soon [Music] you
Info
Channel: Atomic Shrimp
Views: 120,312
Rating: undefined out of 5
Keywords:
Id: gIlYJSO7lok
Channel Id: undefined
Length: 39min 56sec (2396 seconds)
Published: Sat Jan 01 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.