Shop OBEX P1 Docs P2 Docs Learn Events
IR Keyboard Driver — Parallax Forums

IR Keyboard Driver

localrogerlocalroger Posts: 3,452
edited 2011-04-14 19:53 in Propeller 1
While putting the finishing touches on the Ativa photo frame it occurred to me that it would be a lot more useful with a keyboard, and I hadn't bothered installing a jack for one. Not to worry, though; I'd hooked the original stock IR receiver. So I ordered a RCA "UltimateTV Universal Wireless Keyboard" p/n WKB10WB1. This keyboard lists for USD$49.99 and Amazon's default price is $24.99 plus shipping, but I found an Amazon affiliate willing to send me one for USD$16 including shipping. At that price it's well worth it; the construction is equal to a normal PC keyboard; it's not huge but it's full-travel and normal fingers work with it.

The default IR format proved incomprehensible; I suspect it might be two-way requiring a response from the receiver, but the timing varied wildly and I couldn't see how to determine character identities. Fortunately, there's a switch on the inside that puts it into "Classic WebTV mode." This disables a few keys and puts some others in an incompatible IR-remote emulating mode, but it proved straightforward to hack.

The WebTV packet starts with a 3.25 baud start bit followed by 19 bits of data, a 10-bit preamble which is either $292 for key down or $2BE for key up, followed by an 8-bit scan code and a parity bit. I did not re-invert the input bit to get these values, they assume the start bit is pin value 0 and MSB first. Those are both arbitrary assumptions as long as the keys return unique values. You can get the values from the attached driver, which is mostly compatible with keyboard.spin. It's written entirely in spin but it wouldn't be too hard to convert the logic to PASM, and it should fit in a cog. Speed is not an issue because...

The baud rate interval is 59800 clocks at 80 MHz and it's fairly picky; changing it by more than 100 in either direction causes keys to start misreading. I am thinking of building a bit parser that locks on each new bit edge to make sync less picky over the relatively long packet. Since it's not a mark/space format like a normal IR this might be a bit tricky especially to keep it from hanging on a final WAITPEQ. I'll add the mod to this post if I do anything like that.

When a key is pressed the keyboard begins repeating the down code at 10 Hz, until you release the key when it sends the up code for the key and then universal up code 0. There's a bit of trickiness with key rollover, though, since it might send the down code for a new key before it sends the up code for a previously pressed key; this can cause doubles and missed keys. The implementation I've made here isn't perfect but should be adequate for casual service. I don't expect Neal Stephenson to write his next novel with this.

Anyway, I thought someone might find it useful. It's a pretty specialized application and there aren't a lot of solutions; I'm already seeing potential uses for it in my work projects, where you frequently need a full keyboard for very occasional use only and the wireless feature is quite convenient.

I would expect this to be compatible with any IR keyboard promising WebTV compatibility, but the picky baud rate might indicate a need for individual device profiling. The RCA part is currently available new from multiple Amazon affiliates, very cheap from a couple of them.

webtv_keyboard.spin

Comments

  • MicrocontrolledMicrocontrolled Posts: 2,461
    edited 2011-04-14 16:49
    Nice work localroger! This will be very useful for wireless projects!
  • jazzedjazzed Posts: 11,803
    edited 2011-04-14 16:55
    localroger wrote: »
    While putting the finishing touches on the Ativa photo frame it occurred to me that it would be a lot more useful with a keyboard, and I hadn't bothered installing a jack for one. Not to worry, though; I'd hooked the original stock IR receiver. So I ordered a RCA "UltimateTV Universal Wireless Keyboard" p/n WKB10WB1.
    Cool :) So, do you think the keyboard might work with some of Parallax's IR receivers?
  • localrogerlocalroger Posts: 3,452
    edited 2011-04-14 17:36
    jazzed -- yes, this should work with any IR receiver that works with standard 40 KHz IR remotes. I built this using the receiver built into the photo frame which is normal in every way; all my other remotes trigger it and its remote triggers the other two receivers I've been playing with.
  • PerryPerry Posts: 253
    edited 2011-04-14 19:53
    This project is much like what I was working on when http://forums.parallax.com/showthread.php?130282-I-think-I-burnt-my-Dongle!

    but it uses a standard PC keyboard.
Sign In or Register to comment.