Trackpad in a Keycap for Corne/CrKbd Keyboard

Hey guys,

I’m happy to share with you my new project.

It’s a Trackpad in a Keycap!

I was thinking for a while about a trackpad solution that could be built into a keyboard. And finally decided to build it for the Corne keyboard based on the BlackBarry 8520 optical sensor.

Check this out! And don’t forget to turn subtitles on! 😉

Source files

Schematics and PCB designs.

Trackpad.c that reads the trackpad data and sends it to QMK.

Schematics and PCBs

This add-on consists of two main parts:

  • an adapter PCB that goes between Elite-C and the main keyboard
  • a connector PCB that links trackpad with the adapter

Schematics and PCB designs are opensourced and could be found on my GitHub in KiCad format.

Also, I would like to thank the Grey Cat Co. for the amazing LoRa Text Dev Kit they have designed! It has the same BB 8520 trackpad. I analyzed their solution before starting my own design. In fact, I bought one LoRa Kit, connected my ProMicro to their SPI bus and did a quick working prototype with QMK! Check out this demo!

Adapter PCB

I had to create the adapter PCB due to several reasons. Firstly, I had to rewire Elite-C because I need hardware SPI pins for the BlackBarry trackpad. In the original Corne schematics, some of the SPI pins were used to perform the matrix scan.

And the second reason – the trackpad operates with 2.85V so I had to find a place for the 2.85V voltage regulator and 5V <-> 2.85V level shifter.

That’s how the adapter PCB looks in KiCad:

trackpad controller

Sockets for Elite-C are soldered on the top side of adapter PCB.

img_4760

All components such as voltage regulator, the level shifter, capacitors, and resistors are mounted on the bottom side.

img_4769

The PCB bottom connector footprint is the same as ProMicro’s. It was designed to be easily connected to the Corne sockets.

Connector PCB:

trackpad connector

Photo from the top:

img_4774

And from the bottom with flex cable and connector soldered:

img_4777

The keycap with the sensor

I used some 2-sided adhesive material to attach the trackpad to the keycap.

img_4710

img_4715

The only concern is the flexible circuit board that goes with the BB sensor. I’m not sure if it was designed to bend that much on every key click. Will figure this out on practice, I’ve been using the keyboard for about a week and it still works 🙂

Reading the trackpad data.

Here is my trackpad.c file that I included in my keymap’s rules.mk file. Pin definitions could be found in the trackpad.h.

I use the QMK Pointing Device feature to translate X and Y offset data into the mouse movements.

The Pointing Device feature should be explicitly enabled in the rules.mk:

POINTING_DEVICE_ENABLE = yes

The BB 8520 trackpad controller protocol is similar to the ADNS-3060 optical mouse sensor. Here is the related discussion on the Arduino forum.

The trackpad uses SPI so it has to be connected to the hardware Elite-C SPI pins. They’re PB1(SCK), PB3(MISO) and PB2(MOSI). These pins don’t have to be configured explicitly (that’s why you won’t find them in the trackpad.h). SPI pins are configured automatically as soon as SPI module is initialized on Elite-C (mega32U4).

The current implementation uses the polling technique. Every pointing_device_task() cycle reads data from 0x02 register. If the most significant bit is set then motion has occurred and we have to read X and Y offsets.

Then the data is sent to QMK core using pointing_device_send();

Future improvements:

I wired the trackpad INT_MOTION line to the PD3 Elite-C pin (AtMega32U4’s INT line). Haven’t a chance to test this feature yet but I hope to avoid polling and use the interrupt line to detect the motion.

Components:

Assembling the module.

img_4709

Firstly, the adapter has to be inserted into the sockets on the Corne board.

img_4784

Then Elite-C connects through the sockets to the adapter PCB.

img_4785

The next step is to attach the second PCB using flex connector.

img_4786

And lastly, the BB Trackpad connects to the small connector on the bottom of the second PCB.

img_4787

Final thoughts

I’ve been using this keyboard for about a week, still adjusting settings for mouse speed/acceleration 🙂

I use Logitech Trackman Marble as a trackball device, and I tried to get similar experience here. I believe now I can use my solution as a complete trackball replacement! It works great for me. Let me use it for another month and I’ll share more feedback:)

img_20190116_130621

Also, I’m not an expert in PCB design. If you see some big issues with it please let me know or make a pull request 🙂

I hope this could be interesting to the keyboard community. Probably it’s possible to make a more generic solution for some other keyboards.

Please let me know what you think about this in the comments!

Thanks!

This entry was posted in Corne, CrKbd, DIY, Keyboard, Trackpad. Bookmark the permalink.

10 Responses to Trackpad in a Keycap for Corne/CrKbd Keyboard

  1. equalunique says:

    Bravo! This is just the kind of thing I have been searching for, thank you for sharing. I for one am interested in a few for my Corne/Crkbd/Helidox keyboards – and perhaps more if another variation of this could be generalized for other keyboard designs.

    Like

  2. Dries says:

    This is really great. I was looking into adding a trackpad to a qmk powered keyboard, but this solution might be even more elegant than what I was looking for. Also, the level of documentation of the project stands out – thanks so much for sharing this in such detail.
    I was mostly inspired and triggered by the ‘holding down to select’ action, that’s such a logical interaction when you see it … and is usually something people struggle with using regular trackpads.

    Like

    • Volodymyr says:

      Thanks!
      I’m happy to hear you liked the trackpad idea! It integrates pretty well with QMK.
      Hope this could help you to integrate a trackpad with your keyboard!

      Like

  3. Polo says:

    Hey ! Thank you for this nice and detailed project !
    Do you still use it regularly ?

    Like

  4. acaban says:

    This is an amazing work. Some time ago I tried to integrate a thinkpad track point in an atomic keyboard , the software part and the track pad worked but was unusable ergonomically ( the trackpoint had too much lever). You solution is really good!

    Like

  5. Plant says:

    Hello, can you mail me please, I have some questions about this great project

    Like

Leave a comment