Project Status

Here is where all the latest project updates will be placed. The project is split up into different tasks that each have a due date and start date. As each task is completed, there will be new updates here about what was accomplished or how the current task is going.

Task 1: Component block diagram (Finished)

The first task was to create a basic component diagram blocking in all the major components of the system.

The device is to have at least 12 push inputs and 6 rotational inputs. The rotary encoders also include a push button within them and those can be used for additional input if desired. A teensy development board was chosen due to its size and ease of programmability. From this parts can be determined at its basic level.

Task 2: Create a schematic (Finished)

After the block diagram, a set of schematics were created using the basic hardware components I wanted to use. The diagrams are technically simple and are mostly RC filters connected to the input components. I decided to make a matrix of pull-up switches and include diodes to prevent keypad ghosting. This is a standard design across multiple keypad input devices. The encoders include bounce filters as they can be quite noisy with their signal.

Teensy pin IO
Encoder circuit
Switch circuit

Because this design is a prototype, the design may change. The biggest issue is the kinds of inputs I used. I only included encoders for ease of use and the wide variety of ways they can be used. There could have perhaps been a slider input for very specific cases.

Task 3: Build the prototype (Finished)

After all the parts were determined and ordered, next was to put it all together on a breadboard. I used a prototyping board for this to first layout the parts and check whether it was viable or not. Then, all the components were soldered up and wired to each other.

This was probably the most monotonous part so far. There were around 100+ components that had to be soldered up because of all the resistors and capacitors. Wiring everything up quickly became a mess and organization was no longer an option. Double encoders could be used for XY functions.

Task 4: Develop Firmware (In progress)

Developing the firmware was next and ideally this was done along side building the prototype. It’s important to actually make sure your device works every step of the way instead of finishing the device and testing it all at once. This allowed me to quickly debug wiring errors and such.

The firmware was developed with pure C (but C++ could be used with a little modifications) using TMK as the USB HID interfacing protocol. TMK is an open source firmware specifically for custom keyboards so it could easily be adapted to this project. The device does contain a keyboard matrix but modifications have to be done to get the encoders working.

The encoders are tricky to get working because of how they output signals to determine the direction. Each “tick” of the encoder have four different states that represent gray code. So, if the encoder was rotated clockwise one tick, it would output a four state gray code pulse starting with pin A going low, and pin B first if rotated counter clockwise. This is obviously different from a switch which is either 0 or 1.

The first method I used to solve this quickly was to poll for either pin A or B and check if it the encoder output had a successful state match. This method did block the main thread so if an encoder were to somehow get stuck in the first state (The pin brushing right up against the terminal), the device will appear to freeze. In future iterations I will solve this by adapting it to a nonblocking state machine, but for now it works for testing purposes.

The switch matrix was straightforward to solve. Each row gets set to high one by one and the software polls each column. When a match is found it refers to an array to determine which key to register. De-bouncing and settling was considered as well and interestingly the device needed an 8ms settle on setting a row high or low for 16ms total. This eliminates any bouncing issue but the side effect is that it cant poll the encoders fast enough to read. I solved this by using a timer and waiting for it to fire before changing which row was set and reading each column. This allowed for encoder polling every cycle while still allowing for de-bounce and settling to happen properly.

Task 5: Software Development (Not Started)

Next is to create software that allows a user to customize the device. This can be made in any language but ideally in a cross-platform one. A GUI will be utilized as well. How the software will work is it will create a custom firmware with the desired keymapping.