Shop OBEX P1 Docs P2 Docs Learn Events
Piano Keyboard Game Controller — Parallax Forums

Piano Keyboard Game Controller

jerrisjerris Posts: 6
edited 2009-07-30 15:26 in Propeller 1
I'm starting a project to create a piano keyboard game controller to interface with Nick Sabalausky's sound demo (the one that has the piano keyboard displayed on the screen). The end result idea is to create an educational game for my daughter to learn how to play the piano. I'm pretty good at assembly, so I don't think I'll have a problem with the driver, but I'm no pro at circuit design.·The key layout would contain·a little more than two octaves, starting at a·middle·C and going to a high·F (30 keys) and probably add a select and a start button. (32 keys total). I was thinking about just using a simple parrallel to serial IC to transmit which notes were being pressed, but again, I'm no pro at circuit design, so I'm looking for advice. It'd be nice to be able to be able to read if more than one key is being pressed at the same time. This post is mostly just to keep track of my own thought processes, but I'm more than open to whatever suggestions anybody might have.

Thanks,

Jerris

Comments

  • ericballericball Posts: 774
    edited 2009-06-15 18:50
    MIDI interface?
    Rip apart a keyboard and use the keyboard matrix.
    An Ultimarc I-PAC or other keyboard interface used by the MAME crowd to connect arcade joysticks & buttons to a PC.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Composite NTSC sprite driver: http://forums.parallax.com/showthread.php?p=800114
    NTSC color bars (template): http://forums.parallax.com/showthread.php?p=803904
  • Chris MerckChris Merck Posts: 55
    edited 2009-06-15 18:55
    Jerris,
    Not that my design skills are that great either, but if I were you, I would have a dedicated keyboard controller chip. For microcontroller I would recommend a PIC16F877 (36 I/O pins) or the ATMEL equivalent if you prefer, or something bigger if you decide on a larger keyboard. (Keep in mind that larger chips will most likely not come in PDIP packages.) The dedicated controller scans 32 input pins and rapidly reports their state to the Propeller (or a PC) via a 4-byte RS232 packet (you can use 9-bit bytes, setting the parity bit on the first byte of each packet to delimit them). Alternatively you could use a 1-byte protocol. 2 bits to flag packets and 6 bytes to designate a key number.

    Or, you could use a MIDI interface to the Prop, and then you can use it with any number of keyboards. There is a MIDI In object available: http://obex.parallax.com/objects/229/

    Let us know how it goes,
    Chris
  • jerrisjerris Posts: 6
    edited 2009-06-15 20:28
    I've got a PIC16F877 already handy, so I think I'll go that route to start. I originally had the idea·of trying to embed the propeller chip into the piano keyboard itself and make it all a self enclosed system with video and audio out.·Going the midi route is·a good idea but·I'm trying to keep it as simple as possible to start, plus I like the idea of actually designing a piano keyboard. I'll probably add·MIDI functionality down the road.
  • Spork FrogSpork Frog Posts: 212
    edited 2009-06-18 15:07
    Jerris,

    Personally, I would disagree; I think that a MIDI interface would be much easier to add and a LOT easier to manage than reading individual keys. You could then make use of a pre-made and guarunteed working MIDI keyboard and the whole design would probably be much easier at least in terms of hardware.

    -Phil
  • CounterRotatingPropsCounterRotatingProps Posts: 1,132
    edited 2009-06-18 16:51
    Jerris,

    having done both the rip the keyboard apart for scan code AND the midi decoding approaches, I'd say either way is actually about the same level of difficulty, just in different ways. There's code around here for MIDI already, but the brute-force scan code reading might be easier.

    It depends on what Nick Sabalausky's stuff requires for input. Without having looked at it, I'd still say the requirements of its interface should guide your design.

    - Howard

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "This device contains recyclable materials, which can be re-decomposed

    and re-integrated into brand new marvels... We strongly encourage you
    to contact the provided information and recycle yourself always. "
  • Spork FrogSpork Frog Posts: 212
    edited 2009-06-19 19:15
    @Howard: MIDI is a serial interface; all the hardware for interfacing consists of is an optical isolator, a diode, and a few resistors, plus 1 I/O line on the Prop.
  • CounterRotatingPropsCounterRotatingProps Posts: 1,132
    edited 2009-06-20 01:08
    @Spork Frog: (great handle, BTW [noparse]:)[/noparse] Right ... I should have been clearer - was thinking more of the software layer... MIDI could be more difficult to parse compaired to just a simple 32 bit consistently repeating block - although the scan-code-like way would need some kind of simple sync. Might even be able to just hook a hacked up piano keyboard to the AT-keyboard scan input. There's a fair amount of code for that too - at least on the Propeller side of things. MIDI is great, but it seems like overkill for what Jerris initially describes. What do you think?

    cheers
    - Howard

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • jerrisjerris Posts: 6
    edited 2009-07-30 15:26
    Just an update. I'm still working on this project. I've decided to build a custom circuit using a microcontroller to take the key presses and send the info into the prop via a serial stream. When I've got something presentable, I'll post it on here.
Sign In or Register to comment.