Close
0%
0%

Dichotomy - Keyboard and Mouse

The keyboard. The mouse. Tragically separated since birth. Finally rejoined in "Dichotomy."

Similar projects worth following
I have a desk job. Even when I'm not at my job, I find that I spend a lot of time at my desk, because I'm hopelessly addicted to my electronic overlords. I'm OK with that. What I'm not OK with - but I've put up with for far too long - is constantly moving my hand between my keyboard and my mouse: Type a little, switch to the mouse, move, click, switch to the keyboard. Type a little... repeat. Forever. It's annoying. Sometimes when I move to my mouse, I accidentally bump it and lose my cursor. Sometimes when I go back to my keyboard, I don't home properly and start typing gibberish.

I'll be honest: This is a pretty first-world problem. But am I some regular guy who just puts up with problems or complains about them on the internet? NO! I'm an ENGINEER! So I decided to do something about it. Then I did something about it - I call it "Dichotomy," and I want to share it! Take a keyboard, split it half, make it wireless, and shove a

I was inspired by a similar project called "Mitosis," but opted to try to shove an optical sensor into my split keyboard - which has turned out quite well, all things considered!

I originally did a write-up on Imgur, but decided to move stuff over to here to enter the Human Interface challenge!  If you want to read the original write-up on Imgur, see here:

https://imgur.com/a/GWvwg

Here's the low-down, and I'll get into more details as I have time:

Dichotomy is based around the nrf51822 Nordic Wireless Transceiver chip (bluetooth-capable, but I'm not using it).  It has 24 mechanical switches, 1 optical encoder, and a switched rotary encoder on each keyboard half.  These are all wired directly, since the uC had enough pins.  The firmware mostly waits for a hardware interrupt from one of the switches, does some debouncing, then sends the keystates (on or off) in a compact, 3-byte blob (plus 4 more bytes for optical encoder status, rotary encoder status, and the switch on the rotary encoder) to a receiver module.

The receiver consists of an arduino pro micro with an NRF hat.  The arduino runs QMK, a (fantastic, open-source) keyboard firmware derivative of TMK.  The NRF receives the signals, concatenates them, and sends them via UART to the arduino, where QMK picks up the rest.

The circuit boards are many-function: first, you can break off the part to which the switch actually solders, and use it as a "plate" to hold all the switches mechanically.  Second, it's mirrorable - so it's used for the left and the right halves.  Finally, it contains a break-away receiver PCB underneath the battery holder: so it's all combined into a single PCB order.

The batteries should (haven't actually got there yet with active use) last 6+ months, so we'll see how that goes.  The whole assembly is hot glued to a laser-cut acrylic base that slides pretty well on a standard neoprene deskmat (or just a desk).  The base also holds a silicone wrist-rest to get a little bit of tactility when moving Dichotomy around.

Version 2 is currently in the works with some minor PCB updates and some software clean-up.

dichotomy.png

In the wild!

Portable Network Graphics (PNG) - 3.84 MB - 03/18/2019 at 18:01

Preview
Download

DichotomyWorking.mp4

A brief video demonstrating the functional mouse/keys.

MPEG-4 Video - 634.95 kB - 08/24/2018 at 23:17

Download

IMG_0907.JPG

Assembly Process

JPEG Image - 2.27 MB - 08/24/2018 at 23:11

Preview
Download

IMG_0723.JPG

Assembly Process

JPEG Image - 2.54 MB - 08/24/2018 at 23:11

Preview
Download

IMG_0718.JPG

Assembly Process

JPEG Image - 2.58 MB - 08/24/2018 at 23:10

Preview
Download

View all 27 files

  • Debugging the Receiver

    Joshua Broekhuijsen12/28/2018 at 05:15 0 comments

    I've had a few people struggle with the receiver, so I wanted to write a guide to clarify how it works and how to test it.

    The NRF on the receiver is constantly waiting to receive packets from the 2 transmitters on the Dichotomy boards.  When it gets a packet, it updates it's internal memory (storing the matrix info, mouse movement, etc), and continues waiting.  As often as it's able, the arduino (running QMK) requests that info from the NRF, which is sends over UART.

    Because the arduino is at 5v and the NRF is at 3.3, there is a level shifter chip in between so nothing gets fried.  This is the small, difficult-to-solder 8-pin IC underneath the NRF.  Most of the time when there's an issue with the receiver, it can be traced to this.

    That said, try the below steps to debug things:

    1) Ensure all solder joints are good (none of the 8 pins on the small IC should have continuity with each other when everything is off/unpowered, but they SHOULD all have a continuity with another part on the board.  Follow the traces to see where.  Here's a picture:

    2) Ensure you've flashed the receiver with QMK.  If you need more details on this one, I suggest going to the QMK Discord Channel.

    3) Make sure your USB cable is working - some cables work for charging (powering) things, but don't have the necessary data lines to actually facilitate communication.  If your cable works for another keyboard, it should work for this.

    4) If QMK is running, try using the hid_listen tool available here:

    https://www.pjrc.com/teensy/hid_listen.html

    If the arduino and NRF are having trouble communicating, you should get a lot of "Time out in keyboard" messages.  If you don't see that, either (1) your arduino isn't running QMK, or (2), the NRF and arduino are communicating fine, but the NRF isn't receiving any packets from the transmitters.

    5) Loopback test:

    If you're seeing a lot of "time out in keyboard" in the previous step, we need to see if the 8-pin IC is soldered correctly or not.  We can do this by looping any data we send back through.  First, remove the NRF and insert a jumper into your receiver like so:

    In case the picture is hard to make out, that's the 3rd-from-last hole in each of those rows, and that is 1 jumper, so we're bridging those two ports.  Also ignore the LED, it's oriented incorrectly in this picture (this was an old version of the board, but most of it's still the same).

    Once that's inserted, upload the following arduino sketch (I used the arduino IDE and the "Leonardo" board definition - I had to press the reset button twice before uploading):

    void setup() {
      Serial.begin(9600);
      Serial1.begin(1000000);
      //Serial.write((uint8_t)(F_CPU>>8));
      //int received;
      //int sent;
    }
    
    void loop() {
      while (!(Serial.available())){
        //wait.
      }
      int received = Serial.read();
      uint8_t uart_data = 0;
      Serial1.write(received);
      uint32_t timeout = 0;
      while (!(Serial1.available())){
        timeout++;
        if (timeout > 10000){
          Serial.write("\r\nTime out in keyboard.");
          break;
        }
      }
      if (Serial1.available()){
        uart_data = Serial1.read();
      }
      Serial.write("\r\n UART is ");
      Serial.write(uart_data);
      Serial.write("\r\n");
    }

     Once it's running, open up the serial monitor and try sending anything.  I sent "test," and got back this:

     UART is t
    
     UART is e
    
     UART is s
    
     UART is t

    If that works, then your IC is soldered correctly, and the problem is apparently the NRF.  It's either fried, or running the wrong program.  A guide to reprogram the NRF will be up soon.

    If instead, you get something back like:

    Time out in keyboard.
     UART is 
    
    Time out in keyboard.
     UART is 
    
    Time out in keyboard.
     UART is 
    
    Time out in keyboard.
     UART is 
    

    Then it's likely that your 8-pin IC (bi-directional level-shifter) is either (1) fried, or (2) not soldered properly, or (3) both of the above.

     Hopefully this was helpful - let me...

    Read more »

  • Receiver Assembly!

    Joshua Broekhuijsen12/11/2018 at 05:18 0 comments

    I'm shipping out the GB kits, and I thought I should PROBABLY upload the instructions for assembly.  I've got a video (currently rendering) for the board, but the receiver was simple enough that I decided to do it with pictures.

    Note: The receiver PCB pictured is an older version, but it's VERY similar to the one I shipped.  The main differences are: (1) on the 8-pin package (the very first thing soldered), the pictured version has a single dot to indicate orientation.  The new version of the board, which shipped, has a line across the top (like the IC does).  (2) The LED orientation was slightly wrong (I was using an old footprint on this one).  For the PCBs that were shipped, there is a small triangle on the silkscreen of the PCB by the LED footprint.  Align that triangle with the triangle mark on the top of the LED.

    Let's go!

    This first picture is the bare receiver board.  Please note the changes between the version pictured and the version that actually shipped.  We'll be soldering on the 8-pin package near the center-ish of the board.  It's got a white stripe along the top that will help you identify how to orient it (hint: match it with the white line on your PCB).

    There we go, all soldered.  Try not to clog the capacitor holes (you can see I ignore my own advice if you look at the hole to the bottom-right of the IC we just soldered).  Next, we'll be soldering on the LED.  Again, my board (the one in the picture) and the boards I shipped have slight differences.  The board YOU have should have a small triangle in one corner of the LED footprint.  Align the triangle on your LED with the triangle on the board.  Don't do what I did.

    Great!  Assuming you did it right.  If you didn't do it right, not great.  Next we'll get on the linear regulator - there's only one place/orientation it could possibly go:

    Now we'll get on the resistors and capacitors.  Another deviation (WHY AM I EVEN POSTING THESE INSTRUCTIONS?) from the picture to your board: I put my resistors (the three that are right next to each other) in the "wrong" places.  The brown-green-black-black should go in the MIDDLE of the three, and should be flanked by brown-black-black-blacks.  The brown-black-black-red is the 10k, and should go by the 8-pin IC we soldered earlier.  Neither the resistors nor the capacitors are directional, so you can flip them around however you want.

    Perfect.  Now the 4-pin header:

    Aaaand the two 18-pin headers for the NRF:

    The two 12-pin headers for the Pro Micro:

    And the tactile switch:

    If your pro micro isn't already inserted, I recommend inserting it into the headers to solder it, to ensure it's got the right alignment.

    Insert everything, and you're all done!

    Yay, being all done.  Video for the board assembly coming soon!

View all 2 project logs

Enjoy this project?

Share

Discussions

Martin wrote 12/11/2018 at 11:49 point

At least a computer with this input device is highly protected from the danger of being used by somebody else. A keyboard with unlabeled keys is already like some medium encryption. :-)

  Are you sure? yes | no

megazoid wrote 09/07/2018 at 11:37 point

Hmm, it looks wonderfully geeky, but probably highly impractical to use. It must weight a lot with that slab of acrylic, and has a massive base surface area causing friction with the work surface (unless you have PTFE feet?). Nothing to grip, so you have to somehow guide the device with your palm rest only. The design really doesn't work (as a mouse anyway).... you must know this right?

  Are you sure? yes | no

Joshua Broekhuijsen wrote 09/07/2018 at 13:19 point

I’ll agree it’s winderfully geeky. I’ll also admit that using it took some adjustment - each half weighs about 400grams, which is more than your average mouse. Fortunately, the acrylic actually slides quite nicely along an oversized mouse mat (desk mat), though you certainly wouldn’t go amiss with some Teflon feet.

The silicon wrist rest was added specifically to counter the lack of things to grip - it gives some tack for movement, and the whole keyboard is small enough that you can wrap your hand around the edges to get further grip.

The device really DOES work as a mouse and as a keyboard, as I’ve used it for the past few months as my daily driver at work... I reckon that yes, I must know this.

  Are you sure? yes | no

megazoid wrote 09/07/2018 at 15:55 point

Thanks for the reply. I'm glad it works for you, and has solved your multi tasking issue. I guess that's what it's all about at the end of the day. I do like the look of it.

  Are you sure? yes | no

Joshua Broekhuijsen wrote 09/07/2018 at 15:59 point

Thank you for the comment!  I think there's still room for improvement, and I've considered trying a lighter design by using a flat lithium battery and switching out the slab of acrylic for a couple small pieces of PTFE or something similar... could probably shave a significant amount of weight if I tried - and that could well make it more usable.  Also considering a 3d-printed insert that would be more of something for the palm to grip...

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates