[WIP] OneHand - 20% Keyboard

kile

11 May 2014, 21:20

The keyboard's put to sleep between matrix scans. So, the MCU will scan the matrix, then go to sleep in a loop. At first, the duration of the sleep is 6ms, but it will increase if no keys are pressed for some time. These times are configured in a "sleep schedule" list. Every member of this list contains two numbers: the first is how long the schedule item lasts and the second is how long will the sleep duration be in the item. For instance:

Code: Select all

item sec      sleep ms
300           6
900           8
1800          20
forever       100
For the first 300 seconds the sleep duration will be 6ms. The next 900 seconds the sleep duration will be 8ms, then it will be 20ms for the next half an hour, after which it will stay 100ms forever. If any key is pressed the MCU will go to the top of the list and the process begins again. Of course, these numbers can be changed easily.

This allows the keyboard to be snappy while you're typing, but it will become more and more laggy if you don't touch it, and this way it will save power because it sleeps longer.

Wakeup time is very short (a few microseconds). The delay between scans should only be noticeable if the board is in a long sleep period (more than 50ms) but you will only notice it at the first keypress. After that it will jump to the top of the sleep schedule, and it will be snappy again.

Waking up the board, scanning the matrix and updating the clock takes about 100 microseconds. Of course, this is only if the state of the keyboard matrix hasn't changed and there's nothing to send to the PC.

User avatar
Muirium
µ

11 May 2014, 21:24

Impressive. I'd better put my plans together for a custom keyboard with your controller inside, because when I'm all out of suggestions I know I've found something super!

Now, about those layers…!

User avatar
PJE

13 May 2014, 03:39

Very impressive work kile! I'd love to try a wireless version of the OneHand...

I'm still trying to find a space on my PCB to locate the CPU. I might have to increase the size of the board a little.

kile

13 May 2014, 08:37

PJE wrote:Very impressive work kile! I'd love to try a wireless version of the OneHand...
Thank you. :) I think I'll start putting kits together during the weekend and I'm now taking orders.
Muirium wrote:Now, about those layers…!
Yes, that's certainly the next step.

Btw, I've just had an idea :evilgeek: These nRF24LE1 chips have 15 IO pins which means that the max number of keys they can read is 56 (8x7) in a standard matrix, and that is not enough for a full sized keyboard. But if the keys are wired into a Charlieplexed matrix instead of a standard matrix, it will be possible to read up to a whopping 210 keys ((15^2)-15) :o I still have to test this, but it's very likely doable. The cons are that the matrix wiring gets quite a bit more complicated and almost impossible without a PCB, and the matrix scanning will also be more complicated and take longer so the battery will take a hit. But hey - tit for tat ;)

This is not possible on an AVR because for it to work you need programmable pull-up AND pull-down resistors, and AVRs have only pull-ups. But the nRF have both :D So it's a big yiiiihaaaa :mrgreen:

User avatar
Muirium
µ

13 May 2014, 21:28

Looking up Charlieplexing, I'm none too wiser how it actually works, but it does sound quite crafty!

http://en.wikipedia.org/wiki/Charlieplexing

56 keys is frustratingly close to the 62 of a standard ISO 60%, or the 63 of my HHKB style custom. Do you think maybe multiplexing part of the matrix is better than going whole hog? I'm just guessing here, but the mods are more significant for NKRO and chording in general than alphas. Perhaps compromise a bit on some keys and not others?

I suspect my inability to write about this more clearly accurately suggests my hazy / broken mental model of what's going on!

Anywho: definitely interested in getting me some wireless controller action, whatever cunning it takes!

kile

14 May 2014, 10:05

Here's an example:
Charlieplexed keyboard
Charlieplexed keyboard
charlieplex.png (10.77 KiB) Viewed 8947 times
The scanning goes like this: the MCU drives P0 high and configures P1 and P2 as inputs and with pull-downs. If SW1 is closed (key is pressed) P1 will be read as high by the MCU, and if SW3 is closed P2 will be read as high.

Then P0 is driven low, and P1 and P2 are configured as inputs with pull-ups. If SW2 or SW4 are closed, P1 or P2 will read as low respectively. SW1 and SW3 are ignored.

Then the MCU drives P1 and reads P0 and P2 as inputs. And so on...

If you add another pin (P3) bringing the number of pins to 4, the max number of keys would be 4*(4-1)=12. You would have to wire two keys with diodes between each of these pairs: P3 and P0, P3 and P1, P3 and P2.

Charlieplexing is usually used with LED matrices. I've been playing with a LED driver chip (AS1130) in the last few days and this is how I got the idea.

User avatar
Muirium
µ

14 May 2014, 11:46

Ah, I get it now, thanks. That would be a tall order to wire by hand, all right! And it requires a close attention to detail for a PCB design, too.

The principle goal, as always, is to save power. Is there any difference this way? Refresh rate isn't too profoundly important, I'd like to see anyone notice the difference between 1000 Hz and 100 Hz on a keyswitch matrix! In fact, slow scan rates could be worth experimenting, for the live state as well as the sleep modes.

kile

14 May 2014, 12:18

Muirium wrote:Ah, I get it now, thanks. That would be a tall order to wire by hand, all right! And it requires a close attention to detail for a PCB design, too.
Yes, hand wiring is out of the question. But I don't think designing a PCB would be that difficult. You can draw the schematic in blocks with net labels, making it easier to spot problems. And if the schematic is correct, then the PCB design software will not let you make a mistake on the PCB. KiCad ftw!
Muirium wrote:The principle goal, as always, is to save power. Is there any difference this way?
Yes, there is. Scanning this matrix takes longer that a standard matrix, which means the MCU has less time to sleep. I have no idea how much longer, though. I would have to try it. But as a guesstimate, I would say the difference would be noticeable with a CR2032 lithium coin cell, but a pair of AAs would probably still last 'till kingdom come.
Muirium wrote:I'd like to see anyone notice the difference between 1000 Hz and 100 Hz on a keyswitch matrix!
Yes, totally agree. Those 1ms polling rate boards make about as much sense as gold plated USB connectors.

futaris

27 May 2014, 10:00

Kile,

Wow, your wireless version looks great.

But is there some reason why you're not using the nRF51822 (and Bluetooth LE, HID over GATT) rather than the older NRF24LE1 ???

kile

27 May 2014, 10:48

The biggest reason is that nRF51822 is a mega-overkill for a keyboard. It's a 32bit ARM microcontroller, with 128KB or 256KB of flash and 16KB of RAM. My first two personal computers were less powerful than that MCU.

And with great power comes great responsibility :mrgreen: Writing firmwares for these seems to be more difficult. I haven't really dug into it yet, but it sure looks that way.

The programmer for it is expensive (90 EUR for the Nordic Dev Kit), and as yet there are no cheap, end-user-friendly alternatives. There's McHck, but you have to assemble that one yourself. And I'd rather design and build my own and learn a lot along the way.

As far as I understand the "soft device" S120/S110 bluetooth stack is not open source or redistributable, which means it would be hard to make it into a community based project. If you accidentally overwrite the softdevice stack on the MCU, you're dead in the water without the Nordic Dev kit.

Having said that, I'm very interested in these chips. The best thing about them is that the modules on ebay are dirt cheap ($10 shipped) and I already coughed up the money for the programmer/dev kit. They will be my entry card into the ARM world, and I have started the process of upgrading my nrfburn project with the ability to program these chips as well. But as I said, they are much more complex beasts, and it will take a while.

noesc

28 May 2014, 11:12

PJE - Are you still looking for DSA profile caps?
I have some that I would be happy to part with to help this project along!

I have a couple of colors, atm. they're totally assorted though, so I can't give you a specific number or colors available. I bought a mystery bag a while back and haven't had time to sort through it all.

If you're still interested, then just send a PM and we'll work something out. =)

*EDIT*:
I know that there's a random bunch of keys with legends and without. Maybe I can scavenge enough with legends to make that interesting =)

P.S
If anyone else would be interested in some DSA, let me know. But since PJE and Kile are the ones pushing this, I would give them first pick! Should they be interested ofc. =)

futaris

29 May 2014, 04:42

Ok, good to hear.

Not sure if you've seen this for snooping nRF24 packets off the air:

http://blog.cyberexplorer.me/2014/01/sn ... 1-and.html

And the earlier post about promiscuous wireless / snooping ms keyboard traffic:

http://travisgoodspeed.blogspot.de/2011 ... -duty.html

RFduino is based around the nRF58122:

http://www.rfduino.com/product/rfd22301 ... o-ble-smt/

And the mbed nRF58122 dev board is only around 60 USD:

http://mbed.org/platforms/Nordic-nRF51822/

noesc

29 May 2014, 10:24

This project is great and I believe that my personal preference are somewhere between the OneHand, OneHand-v.Kile and ErgoDOX. When budget / time allows I will take away a lot from these projects. Thank you guys!


OT: DSA Keycaps - First pick: PJE -> Kile -> Anyone else actively participating in this project!

I don't want to hi-jack your great thread PJE, but since it's kind of connected to this, I still wanted to post it here. Mostly hidden behind "Spoilers" :)
Spoiler:
These are the DSA Caps I've got. As mentioned, they are totally random and some are of varying quality. I.e:
- Some have mold marks on them.
- Some have the double-shot legends poking out etc.
- Slight shift in colour.

I would consider most of these as "try before I buy a real set" kind of deal.
But that said, a lot of them, especially the blanks are great!

If anyone got some questions of want to see something specific in more detail, just let me know and I'll see what I can do.

PM with what you would be interested in.
Price / Compensation / Barter / What'ev will be agreed upon.
Shipping within EU seems to be 2€.
Spoiler:
dsa-red.jpg
dsa-red.jpg (87.16 KiB) Viewed 8819 times
dsa-grey-white-blue-green-yellow-orange.jpg
dsa-grey-white-blue-green-yellow-orange.jpg (874.92 KiB) Viewed 8819 times
The light-gray mods in the middle of this photo are NOT DSA. But maybe it would be of interest anyway.
The light-gray mods in the middle of this photo are NOT DSA. But maybe it would be of interest anyway.
dsa-grey-white.jpg (86.13 KiB) Viewed 8819 times
dsa-black-white.jpg
dsa-black-white.jpg (821.35 KiB) Viewed 8819 times
-- noesc

User avatar
GSimon

04 Aug 2014, 08:47

Any more PCBS available for this very cool board?

kile

04 Aug 2014, 09:46

I don't know about PJE's board, but I think I have at least 5 blank PCBs left at home.

User avatar
PJE

04 Aug 2014, 12:37

GSimon wrote:Any more PCBS available for this very cool board?
I'll look when I get back from work. I don't think I have any.

I am looking to order some gen 2 boards soon which use a matrix rather than individual keys. This allows two keyboards to be scanned by a single CPU.

User avatar
GSimon

05 Aug 2014, 06:20

kile wrote: I don't know about PJE's board, but I think I have at least 5 blank PCBs left at home.
Oh cool, how much work would be involved in getting it to this form factor however?
PJE wrote:
GSimon wrote:Any more PCBS available for this very cool board?
I'll look when I get back from work. I don't think I have any.

I am looking to order some gen 2 boards soon which use a matrix rather than individual keys. This allows two keyboards to be scanned by a single CPU.
That would be ideal! Either way Gen 1 or 2 I'd be interested in hearing about availability in the future :)

User avatar
PJE

10 Aug 2014, 19:16

Hi All,

I needed something mindless after another interesting week at work, so I spent some time on the V2 OneHand PCB (Sorry Mu - I was going to learn Kicad, but got distracted!).

Here's the top and bottom of the current V2 design.

Image

Image

Here's the Teensy 2.0 connection schematic.

Image

Finally, here's the keyboard matrix.

Image

The design allows for the following functionality:
  • Reverted to Teensy 2.0, as I've relied on PRJC's website for ideas/code/etc I thought it better to stay with the Teensy - it also provides more I/O allowing the digtal expantion and LEDs.
  • Up to 20 keys in a 5x4 matrix, with the ability to scan another 6x4 matrix.
  • Connection header to allow a second OneHand matrix PCB to be scanned from a single CPU to create a TwoHand keyboard.
  • If double height keys are used for the thumb and lower little finger key there is a connection point for the unused key positions to allow the creation of an additional thumb switch.
  • Cherry PCB mount 2x stabilizer as needed.
  • Option to use 1.5 height keys on the three keys on the bottom row.
  • Three mode indicator LEDs at the bottom edge.
  • Two I2C Grove connectors (sharing the same signals) with optional pull-up for interconnection or expansion.
  • Serial (TTL) or PS/2 Grove connector with optional pull-up for Touchpad or expansion.
  • Digital I/O Grove connector with PWM capability for expansion.
  • Surface mount components for circuit simplicity.
  • Four PEM nut mounting holes, similar to V1.
  • I lost the interesting PCB shape due to the increased capabilities and need for space... :(
The four 90 degree grove connectors are in mounted in pairs back to back on the bottom of the PCB, with the I2C pointing to the outside. This allows quite a selection of off-the-shelf expansion modules from Seeedstudio - http://www.seeedstudio.com/wiki/GROVE_System to be added, as long as they are compatible with the 5V digital only signals. Of particular interest is their color LCD panel...
Image
I'm doing a last sanity check on the design, and then I'm going to pull the trigger on another batch of PCBs. I don't know if the SIL connection for linking the two PCBs on a TwoHand design will work especially well, but I2C could always be used via the Grove connection if each board had a Teensy... Time will tell!

Anyone interested in a OneHand V2 PCB, or two, please let me know so I have an idea how many to order.

User avatar
scottc

10 Aug 2014, 19:20

I might be interested in one or two, depending on price.

User avatar
Muirium
µ

10 Aug 2014, 20:55

I'm always into this project. Keen to see what you manage in software, as well. Speaking of which: got a link to the latest firmware for OneHand v.1?

User avatar
PJE

10 Aug 2014, 21:01

Muirium wrote: I'm always into this project. Keen to see what you manage in software, as well. Speaking of which: got a link to the latest firmware for OneHand v.1?
Hi Mu,

I'm just 'tidying' the PCB - my track OCD kicked in ;)

Once I've stopped messing with the PCB I was going to sort out my OneHand and TwoHand code folder. Hopefully I'll be able to send you working OneHand code later tonight.

User avatar
PJE

10 Aug 2014, 21:14

scottc wrote: I might be interested in one or two, depending on price.
In the past I've just sent PCBs to anyone who's interested... Unless demand becomes too high. Trying to sort out payment has always been an issue, and set expectations too high ;)

It's likely to be a month or so before I get the PCBs back, and I may look at ordering 20, as using them as TwoHand units uses them up faster!

I'd also love to look into a set of DSA key caps for the unit(s). The TwoHand can use a standard DSA set with the modifiers switched to a vertical arrangement as the keys have a primary character, whereas the OneHand would probably work best with blank keys due to the number of functions each key performs.

I'm also investigating whether it may be possible to use Matias swiches, as these seem to be easier to get hold of - although the caps would be an issue.

User avatar
Muirium
µ

10 Aug 2014, 21:32

Thanks Peter. I've had my OneHand sitting idle for a bit, the firmware is its magic, of course. Hope you have a good diagram of your layout!

Alps / Matias switches are nice but the caps situation is very poor, for now. MX is much easier for us to handle until Matias opens up some of his caps for us to buy (something he confirmed recently he's still planning to do). Also bear in mind that Matias switches are plate mount: they have no PCB mounting pins or indeed the nub common to all MX switches. PCBs can support both, with work, but not plates.

Image

Cap compatibility is why I'm so keen on Cherry M84s. They're hard to get hold of, though. MX is by far the easiest choice for custom work in general.

User avatar
PJE

11 Aug 2014, 01:57

Muirium wrote: Thanks Peter. I've had my OneHand sitting idle for a bit, the firmware is its magic, of course. Hope you have a good diagram of your layout!
Check your inbox...
Muirium wrote: Alps / Matias switches are nice but the caps situation is very poor, for now. MX is much easier for us to handle until Matias opens up some of his caps for us to buy (something he confirmed recently he's still planning to do). Also bear in mind that Matias switches are plate mount: they have no PCB mounting pins or indeed the nub common to all MX switches. PCBs can support both, with work, but not plates.
I noticed the lack of PCB retention features as soon as I looked... It would really need a mounting plate which drives up the cost and complexity.

My checking did find that I'd reversed the TX/RX pins on the Grove Serial (PS/2) connector, but other than that I can't see any issues. I'll come back to it in a couple of days to see if I can see any other issues.

User avatar
GSimon

11 Aug 2014, 02:17

Amazing, I'd be interested in picking up 4 OneHand V2 PCBs

User avatar
JotaCe

12 Aug 2014, 12:21

Awesome project, when available, I'd be interested in a couple of OneHand V2 PCBs as well.

Harrowed

17 Aug 2014, 11:22

Nice! I would definitely be interested in one OneHand V2 PCB.

User avatar
PJE

17 Aug 2014, 20:07

I'm running out of things to change...

Image

Other than a couple of corrections, the main things that have changed on this version are:
  • Addition of an extra DIO grove connector.
  • Moving the Red LED to share the Teensy LED pin, to free up a pin for the above.
  • Addition of to connection points (plus associated diodes) for additional thumb keys, to allow an Atreus arrangement to be used in the TwoHand format.
  • Lots of superfluous graphic images.
Thus, each OneHand PCB allows the connection of 22 switches, 18 to 20 mounted on the PCB, and 2 to 4 externally. Using two PCBs together will allow up to 44 switches to be scanned by a single CPU without needing to add anything other than the switches. Additional keys could be scanned if the matrix was expanded, which would require additional diodes.

The additional DIO connector was added to allow the two DIO connections to provide a rotary scroll wheel (Encoder + push button) interface without preventing a PS/2 touch pad to be used.

I'm looking to place an order for 20 PCBs, as this (with a couple of other items) would give me free shipping. I also need to order some additional switches - I'm going to try some Clears as PCB mount Browns are not as easy to locate, and I prefer some tactile feedback.

User avatar
Muirium
µ

17 Aug 2014, 20:14

Cunning optional 2u thumb switches now I see. You good for stabs?

User avatar
PJE

17 Aug 2014, 20:27

Muirium wrote: Cunning optional 2u thumb switches now I see. You good for stabs?
I have PCB mount stabilizers, but not plate mount...

From my rough experiments, I feel 1.5 high keys would be better for the additional thumb keys, and remove the need for a stabilizer as you would be pressing down on the stem location.

Image

I'm going to have to splash out on some new key caps as well. I think the main keys will need to be DSA to allow the main A..Z function to be shown on the key for speed of learning, and also to allow custom arrangements. The standard number pad [Enter] and [+] keys provide a nice slope for the main thumb key when installed upside down. I'm not sure if there are any vertical non 1.5x keys with the correct shape. Only time will tell!

Post Reply

Return to “Workshop”