07/13/2019 at 13:28 •
I've updated the base library at https://dboucher.org.uk/keyboard/Thumb_Keyboard.zip to the current Arduino and PlatformIO standards, so you can now install it in Arduino using the "Add .ZIP Library" option or in PlatformIO using:
platformio lib install https://dboucher.org.uk/keyboard/Thumb_Keyboard.zip
My next task is to do the same for the 23017 version of the library (EDIT: 23017 is done) and move the key label and 3D printed part files into the "extras" directory of the base library to finish tidying things up.
06/22/2019 at 18:47 •
After I uploaded the last version, I realised that I had forgotten something in the event reporting: raw key numbers. These give the position of the key regardless of what that key is mapped to. For example, key 15 might be a "y" in an English layout or a "z" in a German one. As this can be useful in some applications I have added it to the library.
Keys are numbered left to right, top to bottom, with the top left key being zero. As usual, the downloads can be found at https://dboucher.org.uk/keyboard/.
06/11/2019 at 20:43 •
As promised, I've updated the main download and you can get the new version here. This contains the Arduino libraries from the last update, the improved label spreadsheet and the new keyboard back panel as shown below:
This is the same as the previous version, just with new labels and the back panel. I also removed a row of holes from the bottom and sides of the perfboard as they were surplus to requirements.
The case back slides up and over the sides of the bezel and the end result is a nice tight fit.
06/05/2019 at 16:13 •
This update has been delayed a little due to other commitments, but I've finally finished converting the keyboard scanning software into Arduino libraries. There are currently two versions: the base version is for use when connecting the keyboard via GPIO pins (download link) and there is a second version for connecting via an MCP23017 I/O expander chip (download link).
Both versions come with an example program which will appear in the Arduino IDE's examples menu when the library is installed. The base version has no dependencies but the 23017 version depends on both the base version and the Adafruit 23017 library, which you can install from the library manager.
My next task is to update the main download (the one with the software, labels and 3D models). Hopefully, that won't be delayed as much as this update!
05/03/2019 at 19:11 •
There are currently two versions of the software in the download: one that connects to the keyboard directly via GPIO pins and targets an Arduino Uno, and one that connects via an MCP23017 I/O expander and targets an ESP8622 board. Both versions take the form of a single source code file.
To make things more flexible, I'm in the process of converting the software to a set of Arduino libraries. There will be one library for the hardware independent code and libraries for each interfacing method (direct GPIO, I/O expender, whatever else).
Once I have converted the code, the steps needed to use it will be as follows:
- Add the relevant hardware specific library to your project. Ideally, I would like this to automatically add the hardware independent one too, but if that's not achievable it will need to be manually added.
- Define the keyboard configuration in your code. This is the number of rows and columns, the pins to use for each row and column, and the key mappings and the timings for polling, debouncing and key repeat.
- Call the initialisation function, passing your configuration, to set everything up.
- Call functions to update the keyboard state and read key events as needed.
I've also finished tweaking the layout spreadsheet, at least for now, however I've not uploaded the new version yet. I'll add that update when I've finished the software changes.
04/18/2019 at 21:56 •
Currently working on improving the labels.
Here is what I've found so far:
- Printing on glossy paper - I've found that the print smudges very easily if I use glossy paper, even if I leave it to dry for a while. Maybe I'm using the wrong paper? It's marked for use with inkjet printers but you never know. Using sticky tape (Sellotape or other brand, you probably know what I mean) on the labels gets around the smudging problem but the overall effect doesn't look any better to me, so I've gone back to plain copier paper for now.
- Some of the smaller punctuation symbols like "." and "," didn't come out clearly, changing the colour and font has fixed this one.
- Centring each key label requires a bit of manual tweaking in the label spreadsheet with the "override" column. I'm not sure that is a better way to do this with LibreOffice Calc macros, so I might have to rethink my approach here and use something like PyFPDF to create the labels instead.
- The label border was sometimes visible when the label was fitted into the bezel, so I've replaced the border with crop marks at each corner of the label.
- The labels need to be cut very accurately. Having multiple copies of each label on a page has turned out to be very useful.
- The length of the overhangs at each end of the label needed to be tweaked slightly. The label was slightly too short which was making alignment tricky. I've adjusted this but I think it still needs a bit more fine tuning.
This is never going to be a mass produced product but I would like assembly to be as simple as possible, so I'm going to keep working on this until I have a good system.
04/11/2019 at 19:39 •
I've improved the key label spreadsheet (LibreOffice) so that you can just enter what you want to appear on each label, run a couple of macros, and get a page of labels ready to print.
You set the number of rows and columns that you want, the colours that you want to use and what you would like to see for the unmodified key plus the two modifier states. Press the "Create Key Label" button and a macro will construct each label in the "Key Label" column. If you don't like how any of the have turned out, put what you would like to see in the "Override" column and press "Create Key Label" again and the value from the "Override" column will be used. Finally press "Create Label Page" and a page of labels, repeated as many times as will fit on the page, will be produced in the "Labels" sheet ready for printing.
There is more information in the "Instructions" sheet. I've updated the download and you can get the new version here.
04/04/2019 at 21:21 •
As promised, I've uploaded the ESP8266 version here. You will need an MCP23071 I/O expander chip for this one (see previous log).
Although the version in the archive targets an Adafruit Huzzah ESP8266 board specifically, the target can easily be changed to another ESP8266 board or anything that has an I2C bus and a PlatformIO target.
As some point I'll convert the software to an Arduino library. As there are multiple ways to interface to the hardware (GPIO pins, I/O expander chip), I think I'll need to need to split the code across two libraries in the same way that the Adafruit TFT libraries work: a low level library that accesses the hardware and a high level one for the keyboard handling code that's independent of the hardware access method. This is something for later though.
03/30/2019 at 20:31 •
My keyboard needs one GPIO pin for each row and column, so for a 10x4 layout that's 14 GPIOs. Most Arduino style boards can accommodate this, but it takes up most of the pins. Other types of board, such as ESP8266 and Raspberry PI, don't have nearly enough pins though. What to do? Use an IO expander chip of course! These types of chip provide a number of GPIO pins that the host accesses via a serial protocol, usually I2C or SPI. This means that the host only needs to support the relevant serial protocol which generally only requires 2-5 pins. You could also run other devices off the same serial bus without using any more pins.
Here I am using an MCP23017 IO Expander chip with a Teensy LC. The only other components needed are two 4.7KOhm resistors to pull up the signals on the I2C bus. I'll document this properly another time, but you can see from the picture above I'm only using a small number of pins on the Teensy, leaving most of them free for other things. Only minor changes are needed to the software, Adafruit produce a library for the 23017 which provides equivalents to the standard Arduino digitalRead()/digitalWrite().
The 23017 has 16 GPIOs, which means that I have two spare here which I could you to add more rows or columns. The chip also has three address pins which can be pulled high or low allowing for a up to eight chips on one I2C bus, giving a total of 128 GPIOs, more than enough for any thumb keyboard.
I'll release the software soon, including a version for ESP8266.
03/27/2019 at 21:57 •
Seeing as this has brought some more attention to the project I thought it would be a good time to explain where I want to take this next. I'm fairly happy with the prototype that I've built and I don't think that there are any serious flaws that need to be addressed. There are some minor tweaks though:
- Change the colours for the alternative functions on the keyboard labels. Some characters like the full stop and comma are hard to distinguish and I think darker colours would improve the contrast and help here. I'm also going to try printing the labels on glossy photo paper to see if that helps.
- The bars that hold the keyboard labels in place need to be slightly thicker for a more secure fit. A very minor change.
- Change the software so that it uses the more generic terms "modifier 1" and "modifier 2" instead of "shift" and "symbol".
Those things are just tweaks though and don't really add anything new to the design, so here are the REAL improvements that I plan to make:
- Add a version of the software that works with an IO expander chip so that the keyboard can be used with devices that aren't so well endowed with GPIOs, such as ESP8266 and Raspberry PI. This is actually written and will probably be the subject of the next log.
- A proper event queue callback and functions to poll the keyboard state.
- Allow for character sets other than 7 bit ASCII.
- Turn the software into a library.
- Fully parametrise the key label spreadsheet, include cutting instructions on the sheet itself with a guide to check that it has been printed at the correct size and print each label strip multiple times to make best use of the paper and allow for cutting mistakes.
- Fully parametrise the OpenSCAD code for the bezel, and include options to properly secure the bezel to the circuit board, including a full wrap around case.
- Write proper assembly instructions.
And a few things that are more long term:
- Allow for offset rows on the bezel, so the rows are slightly staggered like you get on most keyboards.
- Add support to allow modifiers to be toggled on or off with a press instead of needing to be held. This would be useful for single handed operation.
- Add support for external control of modifiers through, for example, a three position switch. This could allow for more more than two modifiers.
- Build some sort of central configurator, where you entry your keyboard layout once and it produces all the design files and source code.
I think that should be enough for now.