Author Topic: Some questions on keyboard circuit board design  (Read 1568 times)

0 Members and 1 Guest are viewing this topic.

Offline trauring

  • Thread Starter
  • Posts: 94
    • off on a tangent
Some questions on keyboard circuit board design
« on: Fri, 27 February 2015, 04:43:40 »
I appreciate any insight people can share into these issues. I’m trying to figure out what is possible and what is not possible. I know I’ve mentioned the ErgoDox a lot, but it’s really just a common reference point to discuss some of these issues (how to connect multiple circuit boards to a single controller, how many keys can be connected via I2C, how to configure complex matrix layouts, etc.).

1) In the ErgoDox, how is the thumb cluster connected to the matrix? Are the thumb cluster rows and columns considered extensions of existing rows and columns, or does it have its own? Is there a good discussion of the design decisions made when creating the ErgoDox that would explain why the specific matrix configuration was made?

2) My understanding is that the 4 wires in the cable that connects the two halves of the ErgoDox are for I2C (SDA and SCL) and power (PWR and GND). What are the limitations of what gets passed through the I2C bus? How many keys, rows and columns? i.e. How many keys could you have in the left hand half? How does the matrix get converted into something easily passed through the I2C bus, and how does the Teensy interpret it? Is it essentially that the left hand keys are connected to the Teensy through I2C while the right-hand matrix is connected directly to Teensy connectors? What’s the best resource for understanding what is happening with the connections?

3) Microsoft says (on http://www.microsoft.com/appliedsciences/content/projects/AntiGhostingExplained.aspx) that their ‘advanced anti-ghosting technology leverages multi-touch technology to prevent key ghosting’ and that ‘by using standard manufacturing techniques and avoiding diodes and large printed circuit boards, this technology remains inexpensive to produce’. What are they doing that avoids the use of diodes? Is there something that DIYers can do that similarly would avoid the need for diodes? or are they likely using more than two wires per switch, something we using standard switches would not be able to do? Has anyone taken apart a Microsoft keyboard to see what they’re doing?

4) Let’s say I wanted to connect 3 or more devices together to the same controller? For example, let’s say you have the ErgoDox, which is two devices, and you wanted to add a keypad. Presumably you’d want to connect it to the right side and connect somehow to the I2C bus. But what if you also wanted to connect something through the left side? Would you need a dedicated i/o expander for the new device, and then somehow merge it into the I2C bus? Would that left-connected device then connect via a cable that was similarly 4 wires (2 for I2C and 2 for power)?

5) Let’s say I had an ErgoDox and wanted to add USB connections to either side. This would necessitate the need to create a USB hub inside the keyboard. The USB output from the Teensy would be directly connected to the hub, and the other ports would be connected, with the hub outputting to an external mini USB port. If I wanted some of the USB ports to be on the left, however, I’d need to send extra connections via the cable though - 4 for USB if I’m not mistaken. However, since two of the wires are also PWR and GND, in theory could I just have 6 wires in the cable? PWR, GND, I2C SDA, I2C SCL, USB Data+, and USB Data-? or if I wanted to keep the 4 wires, I guess I could rig some kind of I2C over USB configuration? If I wanted to allow connection of USB devices to the Teensy, such as for a mouse-like device, then this could be done using LUFA? Has anyone done this?

Thanks,

Philip

Offline dorkvader

  • Posts: 6288
  • Location: Boston area
  • all about the "hack" in "geekhack"
Re: Some questions on keyboard circuit board design
« Reply #1 on: Fri, 27 February 2015, 10:02:53 »
Great post! I'll try to respond as best I can.

1. They are a part of the matrix. If you look at the PCB, you will see what rows / columns the keys are connected to. You can think of them as an extension of the rest of the matrix.
1a. The ergodox project was started by DOX (no longer active) But I believe bpiphany designed the PCB. It makes the most sense to include the thumb section in with the rest of the matrix, as it uses less pins than having a separate matrix for the thumbs. You can download the PCB files from the ergodox website and look at them in a gerber viewer to see the silkscreen and copper layers which show the trace routing and the switch labels for their location in the matrix. Looking at it, you should be able to see how the specific matrix was chosen. It's roughly the same as a matrix keyboard: with rows and columns just going across.

2. My knowledge of communications protocols is very limited, but I am given to understand that I2C is mainly limited by being slow. I think the left hand is only scanned at 125Hz or something like that, whereas if we used a different protocol this wouldn't be an issue. As far as I know the chip we used has roughly the same amount of I/O pins as a teensy, and therefore can be used to make a similar number of rows and columns. Bpiphany uses shift registers (I think) to extend the IO capabilities of the smaller ships that are on the replacement controllers. There are other ways as well but I'm not really the expert on such things.

3. I believe the sidewinder keyboard uses resistance tracking (measures the difference in resistance as well as continuity) to see more keys being pressed. Such a method would remain cheap to produce but figuring out what key combinations you can accept and block out in the controller would be time consuming indeed.

4. most people use a USB hub. Look at kurplop's keyboard as an example https://geekhack.org/index.php?topic=43709.0 Connecting devices to the same microcontroller might prove difficult. You would need a good understanding on how things communicate, a huge database of datasheets for the devices and chips and a good logic analyzer. USB hub is much easier.

5. Yes you would need to run a USB cable to the other half. Fortunately you would only need one USB cable if you use another controller.

Imagine this: teensy on the right hand plugged into USB hub. Teensy  on left hand plugged into USB hub. USB cable is 4 wires between the two. Use 4p4c jacks to transmit the signal to prevent issues if cable is unplugged. To get a seperate USB port on the LH, have a USB hub there as well, then you can have the LH teensy plugged into the LH hub and the LH hub plugged into the RH hub and have 3 spare USB ports on the LH and 2 on the right. it would be a little harder to program, depending on how the LH teensy is mounted, but altogether not too bad I think. Downside is that it is more expensive but the upside is that you have a much easier connection between the halves.

Ok hope this helps! As with most problems there is only one solution. I wanted to provide a starting point and at least example as to how you'd get it to work. There are other answers as well that vary with price, time, and difficulty.

Offline trauring

  • Thread Starter
  • Posts: 94
    • off on a tangent
Re: Some questions on keyboard circuit board design
« Reply #2 on: Sat, 28 February 2015, 18:35:59 »
Thanks. One more question. I don't know much about io expanders, but if you have one with enough connections, couldn't you get rid of the matrix altogether (and remove the need for diodes)? or am I missing something?

Offline suicidal_orange

  • * Global Moderator
  • Posts: 4771
  • Location: England
Re: Some questions on keyboard circuit board design
« Reply #3 on: Sat, 28 February 2015, 18:49:54 »
Thanks. One more question. I don't know much about io expanders, but if you have one with enough connections, couldn't you get rid of the matrix altogether (and remove the need for diodes)? or am I missing something?
Yes if you have one pin (whether on a Teensy or expander) for each switch you could skip the diodes and not worry about designing a matrix, but that would be a lot of pins and a lot of wire as each switch would need one wire to the Teensy/expander (the other could connect to all the switches)
120/100g linear Zealio R1  
GMK Hyperfuse
'Split everything' perfection  
MX Clear
SA Hack'd by Geeks     
EasyAVR mod