Close

New Boards Are in, Working on Firmware

A project log for Switchable Macro Keyboard

Multiple macro keyboards in one with a rotary encoder to switch between them

kevin-arneKevin Arne 05/01/2020 at 20:580 Comments

Assembled the Boards

I soldered all of the components on one of the boards, taking particular care to orient all of the 10k resistors in the same direction (because why not?). The holes for the housing of the rotary encoder were too big in one dimension, but just right in the other. The datasheet called for slits instead of circles, but I'm not sure how to specify that in Eagle yet.

Instead of my usual approach of just plugging it in immediately and hoping for the best, I did a couple of continuity checks, mostly on the tact switches. Seemed very possible that I'd bridge a few by getting solder on the housings, but they all read ok.

Changing Approach to Firmware

In the past I've also just thrown a ton of code together, compiled it, and then hoped it would work out on the microcontroller, which usually results in me banging my head against the computer for a while before I have anything working. This time, I wrote some test scripts for individual parts, starting with the enable pin.

In my previous iteration, I had no switch or pin that I could pull to keep the Keyboard library from sending commands to my laptop. This led to hilarity/crying as I tried to flash new code without sending errant letters into my code. On this spin of the board, I added an enable pin. When a jumper is connected, the device will send Keyboard commands, but it won't when that jumper is removed. I tested this functionality first with the code.

I've since written new keypad scanning functions and logic that keeps track of when a key was last pressed for debouncing purposes. It appears to be working smoothly.

I have to say, writing test scripts really makes it feel like I'm getting in some good wins. It seems to be a lot more motivating to me than the way I previously did things.

Next Steps

The rotary encoder isn't set up, so I intend to write a test script to get that part working followed by integrating it with the rest of the code. I may take a break from coding to work on some CAD models for an initial enclosure and rotary knob.

Discussions