Shop OBEX P1 Docs P2 Docs Learn Events
Memory Stick Datalogger as a HID Controller — Parallax Forums

Memory Stick Datalogger as a HID Controller

MSDTechMSDTech Posts: 342
edited 2011-01-29 13:57 in Robotics
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.

Comments

  • dredre Posts: 106
    edited 2010-01-14 17:56

    [noparse][[/noparse]First off: I realize that I have taken the topic away from 'Completed Projects' but I am unfamiliar with the proper procedure. Therefore please feel free to transfer this to another forum.]

    Hi,

    I read your project with great interest as I have been trying, without success, to use a USB output sensor [noparse][[/noparse]a barometric altimeter - UP24WT from www.ramseykits.com] as input to the Stamp. I was especially pleasantly surprised to review your program statements in regards to reading a USB port.

    As I am not knowledgeable in USB interfacing I was wondering if I might prevail upon you to help me code the necessary statements to read some ASCII data into the memstk/Stamp? The data takes the form of the following:

    Baudmodes anywhere from 4,800 8,N,1 to 36,800 8,N,1; with 38,400 8,N,1 suggested for speed and reliability.

    In order to request the UP24WT to send altitude data, the necessary command to the unit is:

    G EL<CR>.

    The unit then returns [noparse][[/noparse]example {in feet}]:

    1203.5ft<CR><FL>



    Any help will be greatly appreciated.

    cheers, David

  • MSDTechMSDTech Posts: 342
    edited 2010-01-14 19:10
    David,
    I could not find the altimeter listed on the Ramsey site. Do you have more information on the model?
  • dredre Posts: 106
    edited 2010-01-14 20:41
    I found that Ramsey has a newer model "High Res Air Pressure Elevation Sensor", the UP24B, under hobby kits. The site is:

    http://www.ramseyelectronics.com/site/default.asp?search=UP24B&page=search&x=11&y=7

    However, one needs the manual [noparse][[/noparse]which I have] to get the details on the requirements for downloading the altitude, etc. data. And Ramsey does not supply the manual as a download.
    If you are interested, I can make a copy of the pertinent pages and send them to you.

    cheers, David
  • dredre Posts: 106
    edited 2010-01-15 16:06
    Hi,

    Two corrections to my previous posts:

    The maximum baudmode is: 76,800 8,N,1 [noparse][[/noparse]and not 36,800]

    Secondly, I have located the download site for the UP24 manual:

    http://www.ramseyelectronics.com/downloads/manuals/UP24B.pdf

    This·issue of the manual·however does not include the paragraphs on 'Using the USB port' as was given in the· manual sent with my unit. I wonder if these paragraphs are included in the software download .exe which contain the drivers for exporting the altitude, etc. data to a PC. Will try to locate or scan in these paragraphs.

    cheers, David
  • Miles. kMiles. k Posts: 34
    edited 2010-01-20 02:36
    this is really cool i only thought the datalogger could "datalog" now that i know it supports HID devices i think ill use use the datalogger, 2 RF transceivers and a joystick with another BOE and make a wireless controller for my robot!
  • coryco2coryco2 Posts: 107
    edited 2011-01-29 13:57
    I am very interested in the possibility of using the Parallax Memory Stick Datalogger as an HID host so that I can use an HID mouse with the Propeller. Has anyone done this successfully, or could you give me an idea of how to modify the Mouse.spin object to work with the datalogger? Thanks!

    P.S. Can the Memory Stick Datalogger support two USB devices simultaneously? Are the four open holes on the PCB a place where the second USB connection can be made?
Sign In or Register to comment.