Shop OBEX P1 Docs P2 Docs Learn Events
Output USB keyboard values from Prop? — Parallax Forums

Output USB keyboard values from Prop?

T ChapT Chap Posts: 4,223
edited 2014-10-12 09:13 in Propeller 1
Can this be done? I am thinking about a way to create my own buttons for a special function keyboard that outputs the hex values just like the new Mac keyboards (buttons F1-F19). How can the Prop get recognized as a keyboard in OSX 10.8/9?

Comments

  • jmgjmg Posts: 15,183
    edited 2014-10-07 18:21
    I would guess you would need a SiLabs CP2110 / CP2112 - USB HID peripheral device - connected to the Prop.
    That should work without needing any special driver installations.
  • T ChapT Chap Posts: 4,223
    edited 2014-10-07 18:36
    That is awesome jmg. Thanks. I will test it out.
    824 x 402 - 89K
  • TubularTubular Posts: 4,706
    edited 2014-10-07 18:55
    I'm not 100% clear on what you're trying to do, but BradC's "california dreaming" demo, makes the prop looks like a keyboard to the PC, and outputs "keystrokes" (song lyrics). Only involves a couple of passive components.
    http://forums.parallax.com/showthread.php/97027-California-Dreamin

    I don't know whether it would work with a mac. BradC was a mac user though (think BST) so it probably does
  • T ChapT Chap Posts: 4,223
    edited 2014-10-07 19:43
    That is very cool, I will test that tomorrow.

    BTW I just want to have the Prop show up as a typical keyboard and create my own buttons and assign them to F keys.
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2014-10-08 06:34
    Here is a $7.00 hobbiest friendly solution that will interface to the Propeller.

    https://learn.adafruit.com/trinket-usb-keyboard
  • T ChapT Chap Posts: 4,223
    edited 2014-10-08 09:17
    All I get on win8 with Brads code is device not recognized.
  • abecedarianabecedarian Posts: 312
    edited 2014-10-08 09:27
    Not trying to sway you one way or another, but TI's MSP430F5529 LaunchPad comes out of box emulating mass storage and HID, for $13 USD.

    Would take a bit of work though to interface it with the Propeller.
  • T ChapT Chap Posts: 4,223
    edited 2014-10-08 15:33
    If generic device like a USB keyboard can send data( key values ) to the computer, is there a way that the generic device can receive data back via USB without using a USB 2 Serial device like FTDI? I would like to configure some buttons from a GUI on the computer to become whatever key I want although this is not mandatory. Worst case is an LCD display with menu attached to the Prop to allow key values per button.

    The adafruit trinket linked above uses the attiny85 "The device achieves a throughput of 20 MIPS at 20 MHz". It looks very similar to Brads circuit with 68R and 1.5K.
  • T ChapT Chap Posts: 4,223
    edited 2014-10-09 06:59
    After some reading, the FT232RL cannot easily be configured for dual purposes. So I am thinking about the SiLabs CP2110 and FT232RL with a DPDT switch to swap the USB port type on the module. This way I can have the Prop show up as a generic USB HID, but have the option to flip to USB2Serial so that the Prop settings can be managed via the PC/Mac GUI. The ultimate goal would be to allow some background app to act as a filter and depending on what app was in focus on the screen, the filter could swap out key values per button on the module based on the app requirements. In a perfect world, I would only use the FT232RL and have an app running at all times that read incoming data from the Prop, and by some magical method have the app output a key value to the computer simulating a keystroke from a generic HID.
    274 x 293 - 84K
  • jmgjmg Posts: 15,183
    edited 2014-10-09 12:49
    T Chap wrote: »
    If generic device like a USB keyboard can send data( key values ) to the computer, is there a way that the generic device can receive data back via USB without using a USB 2 Serial device like FTDI?

    I would think so, as the LEDs are driven from the PC.

    Oops, I miss-remembered the CP2110 HID details, it says this in the data

    Note: The CP2110 devices will not enumerate as a standard HID mouse or keyboard. - bummer.

    However, google finds this, which may help
    http://forums.parallax.com/showthread.php/138549-C-Prop-Serial-Boot-loader-example-for-the-Silabs-CP2110
  • T ChapT Chap Posts: 4,223
    edited 2014-10-09 15:36
    Thanks for the update jmg. I have studied this a lot today and it looks promising that I can just use the FT232RL and have software send a key to other apps.
  • T ChapT Chap Posts: 4,223
    edited 2014-10-10 16:05
    http://www.mbsplugins.eu/component_RemoteControl.shtml

    This looks like it is going to let me send data from the Prop to my app and have the app press any key plus other cool stuff.

    On another forum
    I just played with that on Mac. Very nice. It works fine in any Mac application just as if typed from the keyboard.
  • jmgjmg Posts: 15,183
    edited 2014-10-10 23:06
    T Chap wrote: »
    http://www.mbsplugins.eu/component_RemoteControl.shtml

    This looks like it is going to let me send data from the Prop to my app and have the app press any key plus other cool stuff.

    On another forum

    Nifty, and a virtual keyboard obvious when you see it :)
    The CP2110 will avoid users needing any driver installation, if that detail matters.
  • T ChapT Chap Posts: 4,223
    edited 2014-10-11 04:46
    JMG, for this project the target is mac pro's, which will mostly be above 10.8 and typically 10.9x. FTDI does not offer drivers any longer above 10.7, they say that the driver is built into the kernel on the mac. I have had trouble with bst/bstl working with FTDI on 10.9, but others say that the FTDI works fine as a a usb to serial interface so it must be a bst issue. I like the SiLabs approach but after looking at it, it seems a like a ton of work to find a method to both program the Prop and incorporate the protocol into the GUI. I am still looking at it, maybe someone with more experience can suggest how much of a challenge this would be. Driverless is certainly the preference. If I can get the SiLabs to communicate and it is easy to drop into the GUI, then maybe transferring a .eeprom is an alternative to designing a bootloader. If field firmware will be mandatory, but since the GUI is required, and since the .eeprom will be the delivery method anyway, maybe the transfer of data is fine. Assuming the main program never gets corrupted during an eeprom overwrite, in which case how to bail it out.

    Edit just tested OSX 10.9.5 with BST and no FTDI driver installed and it worked right away. Tested my own GUI prop loader with BSTL and it worked fine.

    Edit I downloaded the CP2110 example application, it looks like if you know C then there are all the code parts included that you need to make your own app for communication.
  • T ChapT Chap Posts: 4,223
    edited 2014-10-12 09:13
    I have gotten the Prop to send out raw data from a set of test buttons on an LCD 0 - 9. The GUI takes the data and parses each raw button value from the Prop and converts it to whatever computer function needed( press any key, control the mouse). For example, any key can be pressed or combination of keys ie CMD>S, F1, CMD>SHIFT>4. The GUI can get the mouse position, move the mouse to any position, click the mouse at any XY position, click and drag a window from position to position, fill text, and tons more. Currently using the FTDI but any method of getting data to the app will work, I will test the CP2110 and see what is involved in using it for getting data as well as programming the prop.
    640 x 480 - 88K
    640 x 480 - 99K
Sign In or Register to comment.