Shop OBEX P1 Docs P2 Docs Learn Events
USB mouse to BS2 using Parallax Memory Stick Data Logger — Parallax Forums

USB mouse to BS2 using Parallax Memory Stick Data Logger

Bill KingsleyBill Kingsley Posts: 11
edited 2011-08-19 10:04 in BASIC Stamp
Has anyone used the Parallax Memory Stcik Data Logger as a USB Host to read input from a USB mouse to a Basic Stamp? I want to receive touch data from a USB touch screen into a BS2. I have done this with a few times before with a rs232 serial touch screen. The touch screen sends a string of bytes that relate to the x and y coordinates each time the screen is touched.

Is there a simple way for the USB Memory Stick Data Logger to simply pass received USB strings to the BS2? I am new to using USB with a micro. I suspect I may need to do some sort of hand shake to make the USB connection first?

Comments

  • SRLMSRLM Posts: 5,045
    edited 2011-08-18 11:17
    I don't think you can use the Parallax Datalogger for any USB device except as storage. Apparently from the VDAPFirmwarespec (product page there are two USB interfaces on the chip, and they have different, exclusive functionality. You can try anyway to hook up a USB HID to the port, and then test the interface with the QP1 and QP2 commands, and from there see if it does recognize the HID then try out some of the commands on page 12. I'd start with the sample datalogger code, test that with a flash drive first, then once it works try and modify it to see if you can get an HID device to work.
  • Mike GreenMike Green Posts: 23,101
    edited 2011-08-18 11:19
    There is not a "simple way" for the USB Memory Stick Datalogger to simply pass received USB strings to the BS2. USB just doesn't work that way. You will need to download and carefully read the documentation for FTDI's Vinculum chip (look here) which is the USB controller in the Datalogger. I have version 2.05 of the Firmware User Manual and section 6.6 discusses the various commands for controlling arbitrary USB devices like a mouse. You'll need documentation on the mouse you're using since these are general purpose commands. You may want to get a book or some kind of on-line general documentation on USB so you'll understand the terminology.
  • Bill KingsleyBill Kingsley Posts: 11
    edited 2011-08-19 08:34
    Thank you both for your replies. I am still hopeful that someone may have tried this before and can lend more information. Until then, I will work on this as tiem allows.
  • dredre Posts: 106
    edited 2011-08-19 09:58
    How about this:

    Memory Stick Datalogger as a HID Controller :: Parallax Forums
    See:
    http://forums.parallax.com/forums/default.aspx?f=21&m=416258

    MSDTech

    Total Posts : 318
    Posted 1/7/2010 6:49 PM (GMT -7)
    School finally got past the "Science Fair" and I've finally got some time to get back working on my robot Sparkey. I've gotten tired of lugging around a notebook
    to allow me to use a game controller to drive him and have decided to build a dedicated controller module. As part of this effort, I've been looking at methods to interface a BS2px with a Philips SGC2909BB/27 Game Controller.
    For one of the experiments in the "Science Fair", the student requested I build a module to measure and record the data in his experiment. To support this, I bought the Memory Stick Datalogger (#27937) and a USB jump drive. As it turned out, I was able to use the teachers PC and the Parallax PLX-DAQ Spreadsheet tool to log the data directly into Excel. Reading the datasheets on the data logger, I noticed that the default software would also support a HID on the port and decided to see if I could get it to read a game pad. And it does. The wiring for the attached code is simple:

    Memstick Pin Connect to BS2px Pin:
    1 Vss
    2 Pin 4 (USBDataIn) I always have to remember the the
    Serial Data Output for the device is Input to the Stamp
    3 Vdd
    4 Pin 5 (USBDataOut)
    5 Pin 6 (USBClk)
    6 Pin 7 (USBCS)
    7 No Connection
    8 No Connection
    Also to use this code, the Jumper must be in the SPI position before the Data Logger is powered up.

    Caveat: The only game controller I have this working for is the Philips unit listed above.
    Reverse engineering the Philips unit, I came up with the following:
    Data Packet - 6 Bytes Total
    Byte 1
    Left Joystick Horizontal 0=full left 128=Centered
    255=full right

    Byte 2
    Left Joystick Vertical 0=full up 128=Centered 255=full
    down

    Byte 3
    Right Joystick Vertical 0=full up 128=Centered 255=full
    down

    Byte 4
    Right Joystick Horizontal 0=full left 128=Centered
    255=full right

    Byte 5
    Button Status (Active High)
    Bits 0 to 3 = Top Hat Control (my springs are loose and
    I get non-consistant output)
    Bit 4 - Button 1
    Bit 5 - Button 2
    Bit 6 - Button 3
    Bit 7 - Button 4

    Byte 6
    Button Status (Active High)
    Bit 0 - Button 5
    Bit 1 - Button 6
    Bit 2 - Button 7
    Bit 3 - Button 8
    Bit 4 - "Select" Button
    Bit 5 - "Start" Button
    Bits 6 & 7 - Not in packet

    The controller sends a new packet each time a button status changes. The controller sends a continuious stream of packets any time one of the two analog joysticks is off the center position.

    Now to start working on integrating a Propeller Backpack to display the telemetry the robot sends back on the TV monitor and replacing the bluetooth link with a pair of the 433 MHz RF Transceivers. The bluetooth link is in the same frequency band as the TV security camera and causes interference.

    File Attachment :
    Gamepad Test.bpx 3KB (application/octet-stream)
  • Mike GreenMike Green Posts: 23,101
    edited 2011-08-19 10:04
    Thanks for the link, but there's some kind of problem with it. I searched for "datalogger hid controller" and found the thread here.
Sign In or Register to comment.