Shop OBEX P1 Docs P2 Docs Learn Events
Interfacing a prop to an usb keyboard for input — Parallax Forums

Interfacing a prop to an usb keyboard for input

I'm looking to use a hacked usb keyboard to interface a propeller microcontroller to a computer. I have a few extra usb keyboards that I can take apart and remove the ciruit board to input data (key stokes) by shorting accross the leads. It's actual very simple. However, I would like to use the propeller to control the input though the leads. How would I interface the propeller to the usb keyboard ciruit? Would I need to use transistors or a logic 'and' chip? The least extra hardware used would be preferred

Comments

  • ElectrodudeElectrodude Posts: 1,621
    edited 2016-11-21 19:19
    It sounds to me like you'd need a ton of hardware to do it the way you're thinking of. There is surely a better way, and it probably doesn't involve any hardware that originally came from an actual keyboard.

    Does the computer you're using have a PS2 keyboard port? If so, it probably wouldn't be hard to have the Propeller send keys over PS2 to the computer. I don't know of any object that does this, and a quick search on the Object Exchange found nothing, but I imagine it should be fairly simple.

    Otherwise, it might be possible to have the Propeller appear to the computer as a send keys over USB. USB on the Propeller 1 is highly experimental and usually involves all sorts of hacks, but it is sort of possible. Someone with experience in doing USB on the P1 would be a better person to say whether or not this is practical.

    I'm sure people make devices that take serial commands from something (such as a Propeller) on one side and look like a keyboard to a computer on the other side. Or, you could do that in software and have the Propeller just send your keys to the computer over RS-232 and have a program on the computer turn the serial data into keystrokes.

    What are you actually trying to do? Why do you need to send keystrokes to a computer? Why can't you just talk to the computer using a normal RS-232 link?
  • I'm looking to do a SNES USB controller from an old SNES controller. One cog to read the gamepad input. Another cog to send the signals to the USB on the computer. It should be simple and reliable and work 100% of the time. I just need to find a way to interface the propeller and USB circuit.

  • Hello ti85

    A couple years ago I build i device to connect an old NewBrain computer keybord to USB. I connect an propeller to the keybord and write a PS2-driver for it. I connect the propeller to this device to make a USB signal:

    http://www.ebay.com/itm/PS2-Keyboard-Mouse-to-USB-Coverter-Adapter-Splitter-Excellent-YU-/161807278177?hash=item25ac772061:m:mblD3vPghxJgZYvUfUZ7MQQ

    A little picture of the project is here:
    https://sites.google.com/site/bpluswestland/calendar/newbrain-usb-toetsenbord

    It works great. My oldfashion NewBrain keybord works fine as a USB-keybord.

    Greeting's Abraham Vreugdenhil.
  • Cluso99Cluso99 Posts: 18,069
    Many USB keyboards function as a PS2 keyboard as well using the same pins. If your keyboards can do PS2, then just connect to the usual PS2 keyboard interface and driver. See the old dev board circuit (2 serial 100R resistors with 2 10K to 5V pullups).
  • Also there are these old
    usb to ps2 keyboard adapters
  • w8an wrote: »
    Also there are these old
    usb to ps2 keyboard adapters

    Those only work with keyboards like those described by Cluso99.

    The keyboard has to produce the PS2 signal itself. Those adapters don't have any brains. They're only used to change the connector type, not the signal. An USB only keyboard will not be converted to a PS2 keyboard with one of those adapters.

    I think most keyboards capable of using either PS2 or USB come with the little adapters.

    You can still find PS2 keyboards. IMO, it would be lot easier to use a PS2 keyboard than trying to convert a keyboard yourself.

  • I'm thinking using the PS2 driver listed on the Obex exchange and one of those $3-$4 usb to PS2 adapters off of Amazon like everyone has already mentioned.
  • DigitalBob wrote: »
    I'm thinking using the PS2 driver listed on the Obex exchange and one of those $3-$4 usb to PS2 adapters off of Amazon like everyone has already mentioned.

    In case you missed it, those USB to PS2 adapters only work with keyboards intended to be used with both USB and PS2. There are lots of USB keyboards which will not work with the Propeller even if one uses one of those adapters.

  • Duane Degn wrote: »
    DigitalBob wrote: »
    I'm thinking using the PS2 driver listed on the Obex exchange and one of those $3-$4 usb to PS2 adapters off of Amazon like everyone has already mentioned.

    In case you missed it, those USB to PS2 adapters only work with keyboards intended to be used with both USB and PS2. There are lots of USB keyboards which will not work with the Propeller even if one uses one of those adapters.

    Duane.

    The item I used for my project works fine. I wrote a little PS2 driver on the propeller and connect the propeller to this PS2 to USB converter.

    http://www.ebay.com/itm/PS2-Keyboard-Mouse-to-USB-Coverter-Adapter-Splitter-Excellent-YU-/161807278177?hash=item25ac772061:m:mblD3vPghxJgZYvUfUZ7MQQ

    In mine opinion, ti85 want to make a device with a propeller inside and connect this device to a computer and let this works as an keybord.

    Greeting Abraham.

  • Duane DegnDuane Degn Posts: 10,588
    edited 2016-11-26 15:57
    AV_Tech wrote: »
    In mine opinion, ti85 want to make a device with a propeller inside and connect this device to a computer and let this works as an keybord.

    Abraham,

    Thanks for clarifying.

    I hadn't read the OP carefully enough.

    I was concerned some people in this thread thought adapters like this one worked on all USB keyboards.

    I now realize this isn't what the OP wants to do anyway so the point is moot.

    Have you shared your PS2 driver? I've used drivers which will read PS2 signals but I haven't used a PS2 driver which will generate the PS2 signal.
  • Duane Degn wrote: »
    AV_Tech wrote: »
    In mine opinion, ti85 want to make a device with a propeller inside and connect this device to a computer and let this works as an keybord.

    Abraham,

    Have you shared your PS2 driver? I've used drivers which will read PS2 signals but I haven't used a PS2 driver which will generate the PS2 signal.

    Hello Duane.

    I have not share this part of code because it is not a real separeted part of code. But it is an little part of a project. But I include the project and under the PUB Zend_Waarde(index,status) I show how it's works. The commant's in the program are Dutch, but I think it is easy to follow. My goal whas to buils a keybord from an old NewBrain computer. So i must implemend some strange key's in the list. Also I must make a choice for a Scan Code set. I use Scan Code Set 2. More about this: http://www.computer-engineering.org/ps2keyboard/


    Greeting Abraham.

    AV_NewBrain_v3%20-%20Archive%20%20%5BDate%202016.11.27%20%20Time%2018.12%5D.zip
  • I know there have been times when I wished I had a way to generate PS2 signals. It's nice to know there's code to do this now.

    Thanks for sharing your code.
  • I knew this couldn't be rocket science. Thanks AV tech you saved me the trouble of dusting off my old PS2 keyboard and working it out myself
Sign In or Register to comment.