My Keyboard Interface

4 replies [Last post]
Offline
Joined: Apr 27 2013
Posts: 4

I thought I'd share a little project I did for my Apple 1. When I first built my Mimeo I used Mike Willegal's PS2 keyboard adapter which works great. I later moved to an Apple II keyboard for a more authentic feel but found it was a few steps backwards. The obvious one was no serial keyboard input which meant I was switching back and forth between Mike's adapter and the Apple II keyboard which wasn't very convenient. Additionally CTRL-C,L,R was no longer present necessitating an external clear screen button. Finally there were certain characters supported by the Apple 1 that were un-typeable on an Apple II keyboard: '\' and '['.

So I decided it would be a fun project to stick a micro between an Apple II keyboard and the Mimeo to bring back these features and more.

I used the ATMEGA328 for it's UART and numerous GPIOs. I added a header for easer programming of the AVR. I used a MAX232A for RS-232 to UART voltage translation. ATMEGA328 has enough GPIOs to read the Apple II keyboard and drive the Apple 1 keyboard out, as well as send and receive UART with one GPIO left over. I ran the extra GPIO to a header in case I decide I want an external clear screen at some point or maybe to feed an Apple II shift mod into the adapter. Obviously the Apple 1 can't do lower case but an independently detectable shift key might make for some more convenient key combos.

The AVR is a very nice programming environment. The Harvard architecture is a bit odd but generally doesn't get in the way. Programmers are very inexpensive. I built a usbtiny for about $20 and was able to program the micro in C with some open source tools.

I designed the PCB in Kicad which is an impressive environment for free. It's a little rough in some points but one cannot complain for the price. Kicad can often do exactly what you want, but the exact steps are not always obvious. With a little patience and tutorials you can figure out what to do.

I had OSH Park build the board. These guys are great for a 3 board hobbist board run. Generally I like their purple boards but for an Apple 1 peripheral I would have preferred green. Maybe I'll send off to get a stack of cheap green boards made in China at some point.

The Apple II keyboard is an ASCII keyboard so you can't independently detect any key combo. Without a SHIFT key mod the SHIFT key is only detected for a handful of keys. However the CTRL key is detectable for most keys including while those few shift sensitive keys are being held. This is enough to use the AVR to remap the remaining functionality to convenient combos. Currently I have delete (i.e. '_') mapped to left arrow, '\' to CTRL-B and "Clear Screen" to CTRL-C. I have also mapped '[' to CTRL-SHIFT-M because ']' is mapped to SHIFT-M. With a SHIFT key mod I have tried mapping '[' to SHIFT-J or SHIFT-K but I preferred CRTL-SHIFT-M.

Once I built the adapter I realized I could do a few other things with a micro between the keyboard and Apple 1. For one I could make the key repeat functionality work when holding the Repeat key down. I also have built a few macros into the adapter code like making CTRL-L (i.e. Load) send "Clear, Reset, 9000R, ?" to bring up the CFFA1 main menu.

And having serial without having to swap adapters is awesome!

Some photos :

IMG_0275.jpg
DSC_2588.jpg
DSC_2593.jpg
DSC_2596.jpg
DSC_2597.jpg

AttachmentSize
DSC_2588.jpg74.75 KB
DSC_2593.jpg79.41 KB
DSC_2597.jpg83.52 KB
DSC_2596.jpg86.63 KB
IMG_0275.jpg105.5 KB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
macnoyd's picture
Offline
Joined: Oct 15 2012
Posts: 224
Re: My Keyboard Interface

Good job Collinp! Nice work indeed.
Looks like you've just re-invented the "videx keyboard enhancer" for the Apple 1.
Add a type-ahead buffer and I think you've just about got it. Smile
DO you plan on making a sellable product out of this?

__________________

macnoyd

Offline
Joined: Apr 27 2013
Posts: 4
Re: My Keyboard Interface

I hadn't heard of the Videx. I definitely see some similarities!

Actually there is a type ahead buffer. Bytes are pushed into a queue from UART or the keyboard in a primary interrupt context. The main loop wakes on interrupts and picks bytes off the queue and meters them out at Apple 1 speeds. In other words really slowly.

After building this project I was thinking of taking the next step and replacing the encoder board which would allow things like better use of the shift key and auto repeat, all tricks the Videx apparently did back in the day.

This was really just a fun weekend project for myself. I wasn't planning on selling this though maybe I could look into a one time board run if there's interest.

Offline
Joined: Oct 9 2011
Posts: 1063
Re: My Keyboard Interface

Nice project...

I agree keeping the serial interface and a real keyboard is very useful. It also prevents premature wear on the keyboard socket by not putting extra stress of moving a cable around or disconnecting it constantly.

I use a simple Keyboard buffer so that I can keep both Mike's adapter and an ascii keyboard plugged in so that I can send software over from my laptop or run automated tests, mine is more vintage style since it only uses 74xx chips, yours solution is way more useful if you actually want to do some heavy work on your Mimeo. At one point I had Vince Briel custom code me up one of his PS2 Apple II keyboard encoders just so I can make an underscore since I'm such a bad typist so I really understand how useful your little project is.

Cheers,
Corey

Offline
Joined: Apr 27 2013
Posts: 4
Re: My Keyboard Interface

Thanks Corey.

I did a little digging and found the post about your adapter. Very nice.

http://www.applefritter.com/?q=content/mimeo-1-build-keyboard-input-switch#comment-77876

Yours could have been built in the 70s. That's pretty cool.

In my case there is something a bit silly about using a micro that's vastly more powerful than an Apple 1 just to feed characters into it! Though I guess that's true of Mike's adapter as well.

I tried to keep a vintage "feel" even if this could never have existed in the 70s. For instance I like that the AVR comes in a DIP package so it doesn't look as out of place as a modern SMD based board might. I also chose to use the RS232 connector for serial instead of just putting an FTDI with a USB port on the board because that would have felt too modern. As I mentioned above I would prefer it to be green though. Purple boards are not very 70s.