Shop OBEX P1 Docs P2 Docs Learn Events
Interface USB Device to Prop to Create a Datalogger App — Parallax Forums

Interface USB Device to Prop to Create a Datalogger App

Little-endianLittle-endian Posts: 91
edited 2009-10-25 13:33 in Propeller 1
I have peripheral device that has a USB port on it that I'd like to interface to a Prop to essentially create a datalogger. Currently, this peripheral device is intended to be connected to the USB port on a PC and it has a Windows application that takes the incoming data stream and logs it to a file.

Rather than always having this peripheral connected to a Windows PC with the software running I was wondering if it would be possible to interface a Prop to this peripheral's USB port to create a stand-alone datalogger? I was thinking of using the Prop to receive the incoming data stream and write it to an SD card or perhaps transmit the data stream over a wireless connection to a monitoring PC. The data stream isn't huge, I believe it's approximately 60 bytes per string to be received in one second intervals. This peripheral has the USB port directly on it so it doesn't use a serial to USB converter between the two devices as some peripherals do.

Would it be possible to interface a Prop to this peripheral? I've been doing some searching on Prop/USB interfaces and I'm not sure if this would require a Host USB chip in order to make this work. Or, I was wondering if I was totally looking the obvious and if a USB to serial converter could be used to convert the USB output of this peripheral to be serial to be read by the Prop?

Any advice on where to start would be greatly appreciated. I'm a Prop newbie.

Comments

  • T ChapT Chap Posts: 4,223
    edited 2009-10-24 20:41
    I would start by looking at the Vinculum manual. I think you can get the vinculum to talk to other USB devices, but this may be limited to other FTDI USB devices. You likely not be able to use the Prop to talk to the device directly. The Prop can talk to the vinculum serially or with SPI. Depending on what the device is doing and how complex it is, you may be able to hack it with a vinculum instead or build your own device with the Prop and datalog to USB drive or other flash drive.
  • LeonLeon Posts: 7,620
    edited 2009-10-24 20:47
    There are plenty of other devices with USB OTG (PICs, AVRs and ARMs) that you could probably interface directly to your USB device, if you want the whole thing to be as cheap and simple as possible.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
  • Mike GreenMike Green Posts: 23,101
    edited 2009-10-24 20:49
    If the USB device uses an FTDI chip for its serial to USB adapter, then you could use a Vinculum chip (like in the Parallax Memory Stick Datalogger) as the USB host and a Prop could act as the controller for the Vinculum chip. You have to have some kind of USB host.

    It's theoretically possible for a Prop to act as a USB host for something like what you want, but you'd have to use some kind of USB host interface like the MAX3420E and, as far as I know, there's no existing host stack for the Prop + MAX3420E.
  • Little-endianLittle-endian Posts: 91
    edited 2009-10-24 21:08
    @Todd Chapman - Thanks, I'll take a look at the Vinculum

    @Leon - Thanks, I may consider another chip, but my main focus is improving my Prop skills and this is a one off learning experience and I have no plans to make it a commercial product. However, maybe I should use one of these as a front end it the Prop? If so, which chip of the ones you have listed do you think would be the easiest to integrate with?

    @Mike Green - Thanks, this device uses the Silicon Labs CP210x chipset. Do you think it would still be possible to use the Vinculum chip? I'll take a look at the Vinculum and MAX3420E.
  • Mike GreenMike Green Posts: 23,101
    edited 2009-10-24 21:26
    I haven't looked at that portion of the Vinculum firmware manual in detail. The Vinculum directly supports the FTDI serial to USB chips. It may be that it can be made to support the Silicon Labs' chip, but it would be messy. The MAX3420E is a general purpose USB host interface. As such, it could support anything, but you'd have to do all the coding. As a newcomer, you'd be asking for a heap of work at best unless you're experienced in developing low-level USB support code (It'd still be a lot of work).
  • LeonLeon Posts: 7,620
    edited 2009-10-24 21:31
    Any of the USB OTG PICs could be used, the 16-bit PIC24FJ128GB106 is the smallest and cheapest. It would be quite easy to interface it to the Propeller via SPI.

    The Vinculum VNC1L has it's own processor, and has 28 I/O pins, so the Propeller isn't actually necessary for your application.

    What is the CP210x interfaced to? You could simply interface it directly to the Propeller, dispensing with the CP210x and the Vinculum chip. It seems pointless to have two USB conversions in the same system.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle

    Post Edited (Leon) : 10/24/2009 10:10:32 PM GMT
  • Little-endianLittle-endian Posts: 91
    edited 2009-10-25 03:49
    @Mike Green - I spent some time this evening looking and the Vinculum and it appears it can be used a generic USB host device accessible from any microcontroller via SPI just as the MAX3420E can be used. Of course, I'm no expert on this so I'm looking at it at a very high level at the moment. Since the Vinculum does have development boards and sample code available I was thinking it might be easier to implement than the MAX3420E.

    @Leon - Thanks for your recommendation on a PIC chip. There are always so many PICs available I always have a hard time deciding which would be the best one to use for a particular application and I really have very little experience using PICs.

    I'll take a look at what can be done with the VNC1L itself.

    I actually thought about opening up the device and seeing what's on the other side of the CP210x. My biggest concern would be voiding the warranty if I modify the device and also if someone else ever wanted one of these loggers I couldn't expect them to open up the device and modify it them self.

    Thanks again to everyone for their help.
  • Mike GreenMike Green Posts: 23,101
    edited 2009-10-25 04:00
    Remember that the Parallax Memory Stick Datalogger is a Vinculum chip packaged up much like the VMusic2.

    The CP210x datasheet should give the information you would need to use it with the Vinculum acting as host.
  • T ChapT Chap Posts: 4,223
    edited 2009-10-25 04:01
    I think if you were to mention the device and what exactly it does you might get better info towards a solution. It may very well be something that can be designed from scratch with a Prop versus spending a lot of time just trying to talk to it.
  • Little-endianLittle-endian Posts: 91
    edited 2009-10-25 11:45
    @Mike Green - I'll take a closer look at the Parallax Memory Stick Datalogger. After looking at the Vinculum website I thought the VDIP2 might be a good choice since it already has two USB ports on it. If I were to use the Vinculum I thought I could use one USB port to interface to the device and the other port to connect to a flash drive rather than using a SD Card to log the data to.
  • Little-endianLittle-endian Posts: 91
    edited 2009-10-25 12:04
    @Todd Chapman - The device is a battery charger. The charger has a USB port on it that uses the Silicon Labs CP210x chipset. I don't have device with me at the moment, but I'll try to open it up to see what the CP210x is interfaced to as well as the exact model CP210x used as it looks like the CP210x is a family of three chips. When in use the chargers outputs a string like the one below at one second intervals:

    17 02 369E 00 00 00 3067 0000 0000 0000 00 00 0FFA 102F 1032 0000 0000 0000 3692 00 00 00 3099 000F 0000 0000 00 00 103F 1038 1028 0000 0000 0000 160D
    



    My original plan was to see if I could use a Prop to log these data strings coming from the charger to a memory device. Something removable such as an SD Card or a flash drive would be my top choice.

    I apologize for not mentioning this earlier, but I was also considering adding a real-time clock so I could time stamp each string since the charger doesn't have an on-board real-time clock.
  • LeonLeon Posts: 7,620
    edited 2009-10-25 12:21
    What do the numbers mean?

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
  • Little-endianLittle-endian Posts: 91
    edited 2009-10-25 13:33
    I'm waiting for the final version of the protocol from the vendor as the protocol has changed with the latest version of the firmware for the charger. The data string in my post is from an older version of the firmware, but the changes won't be drastic. Perhaps just a few more fields and in a different order.

    The string contains the version of the firmware of the charger, individual cell voltages of the battery pack under charge/dis-charge, charge rate, power supply voltage to the charger, etc. The data is used to graph charge/dis-charge curves of the battery.
Sign In or Register to comment.