Every good project deserves its Eureka moment, and it's safe to say I've had mine.
I am not an electrical engineer. I'm not an embedded engineer, and as far as software engineering goes, I have many shortfalls (for example, the fact that I haven't touched python since a program I made for an artist friend of mine a few years ago). But I've gone and whipped up a keyboard mouse device.
I want to type up a more detailed log later, detailing exactly how I did it, and showing you the reader, not just how to make this specific device, but how to make something adjacent, or adapted; so for example, where you'd be looking for potential issues. After all, as someone who's had to learn this from basically scratch, I'm in a fantastic position to be showing people the pitfalls that I've spent so long rolling around in.
However, it's my log, and I'll cry if I want to, but I may as well be somewhat productive about it, so here's how I went about solving my biggest challenge on the project.
To build your average keyboard, you're going to need:
-a whole bunch of buttons
-some pcb
-some wire
-some solder
-a controller of some variety
-an awareness of the ports you're using
-some electrical tape
-some milk (for when you drop your soldering iron and pick it up by the hot end)
-maybe 3-4 tutorials
For this project, the first main problem was mostly trivial. Pull off the keymat, figure out how much wiggle it has, and see if I can press different buttons through it (yes, I can, marvellous). My next problem was software. After all, I have no way (or money) to print custom PCBs, so I'm working fully store bought, this means that anything I make has to both run on whatever I build it on, work properly with the wiring of the keyboard, and be able to talk to the poor device it's plugged into. After much to-ing and fro-ing, I worked off of four main pieces of information:
-https://hackaday.io/project/164232-thumb-keyboard David Boucher's thumb keyboard. It's just about the best tutorial around, and just about the easiest mini keyboard to put together (i.e. still difficult, but easier than some others)
-https://dronebotworkshop.com/pi-pico-circuitpython/ a nice handy guide on getting you started with most of what you'll need to make your device
-this video
-https://www.hackster.io/TomoDesigns/the-super-easy-pico-keyboard-989e7d#toc-step-15--the-code-16 this is where I actually found how to use the above video in circuit python
Through the magical power of all of this guidance, I was able to produce something that works maybe about half as well as any individual of them, and has an eighth the utility (so far)
I will be releasing (and explaining the code) once it's much neater and adds some functionality, but this log is for explaining my process.
Of course, it wouldn't be a me project if I didn't go one further, and another key issue I felt I needed to solve, is the pointer device. Anyone who's anyone knows offhand that since the blackberry passport, blackberry devices have had built in trackpads on their keyboards (disregarding being hamstrung based on region locking, the one I ripped to shreds was stuck as a scrollpad). Now, perhaps there's not quite so much utility in these phones having trackpads. Especially not large ones. However, picture yourself trying to use linux on a 5" touchscreen, and suddenly, at least for me, some sort of manual, non-touchscreen pointing device may be useful, at least for those of us who haven't quite yet transcended gui such as myself.
I had 4 solutions.
1) reverse engineer blackberry's approach
I actually had I think 3 ways I could do this one. Capacitive trackpads are surprisingly intuitive, and come in a range of decades that they look like.
For example, for a 70s looking approach: https://www.hackster.io/gatoninja236/capacitive-touch-sensing-grid-f98144, I would love to see anyone include one of these sandwiched between buttons and a keymat. They seem easy enough to do, requiring some amount of adaptation into a bonafide trackpad, but I think for someone with less shaky hands, who maybe doesn't find coffee so delicious, this might be a good shoestring budget approach.
Then there's capacitive touch foil. I did actually order some, but unfortunately, it was very stuck to some perspex, and I didn't fancy my chances of removing it. I didn't spend too much, but I also didn't have the time. Again, perhaps a good choice for someone else. Much more plug and play
Finally, we've got these: https://bela.io/products/trill/
I actually don't know how well they'd work for this project, I don't know how flexible the trill square is (although it's relatively inexpensive for anyone who wants to try), so I don't know if it would work between the buttons and the keymat, but I thought it was worth putting out there, because they seem to be good quality, and more importantly, they have reams of documentation.
2) the lenovo rocker mouse
Yes I know none of you are used to hearing it called that, but this is a family website(?). The little red dot in the middle of the think pads. Might have been a good solution, and for anyone who can find a decent rocker mouse, again, please do your own variants of this project, I would love to see one reused as a pointing device for this.
3) the galaxy s-pen
My second favourite phone of all time (or model of phone) is the galaxy note. Any of my friends reading this knows I send out diagrams with some regularity, and having a note (a note 4, may its dodgy flash and searing hot battery rest in peace) made that process about as easy as it could be. I love drawing little technical doodles to cement my ideas, or find out if I wasn't checking them hard enough in my head, and as for pointing devices, it's much more precise than a finger.
Sadly, it's not very one hand use, and it's a part that could go missing. I'm actually not ruling out some sort of wacom stylus however (the type of stylus on the s24). I do still think they're very cool devices, and I know I personally would get heaps of use out of one, so I guess watch out for a stylus log.
4) the blackberry trackball.
Finally, this is a blackberry. I did still need a pointer. I was a bit flummoxed at first, because there's not a ton of clearance betwixt screen and keyboard, not to mention, travel distance doesn't really leave enough room without significantly damaging the now 10 year old plastic on the priv's keymat, and after an unfortunate run in with the retainer on an fpc connector on a psp, I think I'm happy to leave that alone.
I'd not had a lot of luck with the trackpad, and with how long I've taken on the keyboard, the touchpad was starting to look like a stretch goal, so I did approximately three seconds of thinking (i.e. mimed holding my phone), and tried to work out where I'd put this trackball, and of course, naturally, on the side where my thumb sits!
Not to mention, there's been somewhat of a blackberry revival of late, which is a massive confidence boost when I see people talking about how much they love some of my favourite devices (see, I'm not crazy), but more importantly, it means that parts aren't just available, they now exist in convenient forms for makers, such as this delightful board from pimoroni:
https://shop.pimoroni.com/products/trackball-breakout?variant=27672765038675
I'm not actually sure how much of their description is tongue in cheek, vs how much they've actually literally been harvesting blackberries for their trackballs, but either way, this solves a few problems at once:
-no difficult layering to dampen keypresses
-no sliding around the screen while I'm trying to type (or more likely, half hacking together a sort of solution)
-RGB
-you only use a single port for pointer and keyboard
It was crazy how easy it was too. After a lot of back and forth about which board to use (I'm currently on to a pi pico, 1 of 2 I bought), all I had to do was see how the device communicates (i2c), check which pins are i2c on the pico (ground, 3v3, 20, and 21, int is optional), then find a way to make it work in the same language I was doing the keyboard (I'm talking a single file for the whole thing).
Now, so far I'd had the most luck getting keypresses out of circuit python, so I figured I'd start there, and immediately:
https://github.com/jspinella/pimoroni-trackball-circuitpy
I did have to make a few changes, but all in all, the code was pretty great. I've added a little of my own functionality, and I need to do some tidying up, but I managed to test both the trackpad being used, and the keyboard pressing keys at the same time, and it works, which I suppose is what I want, but feels downright peculiar after the number of boards I've gotten through.
I do have a few stretch goals for the keyboard, but these are to be done in post.
-RGB LED key lights. It would be extremely helpful to have some lighting under the keyboard for texting in the dark, and it would be fun to choose the colour
-a program for the motherboard that can control the pico's light colours. Probably already exists, but a gui to change what colour is showing would be lovely (gonna use neopixel lights, so I'm 99% sure something exists)
Anyways. I'll type up the technicals sometime this weekend. Expect the logs to come maybe days apart rather than weeks from here on out though.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.