• New Label Method

    David Boucher08/11/2019 at 08:56 1 comment

    I'm working on a new method for producing the labels. The existing system (mis)uses a spreadsheet, but I would like something better.

    The new method uses a Python program with the Python Image Library (PIL) to create a bitmap image of the labels. The required layout will be defined in a separate file that the program will process. The resulting bitmap can then be

    So far I've hit a couple of snags. The first one is that despite the resulting bitmap having a DPI setting to indicate what size it should be printed at, many programs that print bitmaps "helpfully" scale it to fit the page, even when I think I've turned off all the "scale to fit page" options. I've found that GIMP will print at the correct size as long as I don't print preview first.

    I can't control what software will be used to print the bitmap, so I've added a couple of scales, one in centimetres and one in inches, so at least you can check if it's printed correctly.

    The second snag is that fonts in PIL are not anti-aliased, reducing the print quality. Producing the bitmap at a higher resolution should work around this.

    This is not finished yet but when it is I'll compare it with the old method to see if it's worth switching.

  • Library Maintenance

    David Boucher07/13/2019 at 13:28 0 comments

    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 and move the key label and 3D printed part files into the "extras" directory of the base library to finish tidying things up.

    EDIT: All done.

  • Raw Key Numbers

    David Boucher06/22/2019 at 18:47 0 comments

    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/.

  • Main Download Updated

    David Boucher06/11/2019 at 20:43 0 comments

    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.

  • Arduino Libraries (Finally)

    David Boucher06/05/2019 at 16:13 0 comments

    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!

  • Libraries

    David Boucher05/03/2019 at 19:11 0 comments

    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:

    1. 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.
    2. 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.
    3. Call the initialisation function, passing your configuration, to set everything up.
    4. 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.

  • Label Fine Tuning

    David Boucher04/18/2019 at 21:56 0 comments

    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.

  • Key Label Spreadsheet

    David Boucher04/11/2019 at 19:39 0 comments

    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.

  • ESP8266 software

    David Boucher04/04/2019 at 21:21 0 comments

    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.

  • IO Expander

    David Boucher03/30/2019 at 20:31 0 comments

    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.