Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    Regular Coder
    Join Date
    Apr 2006
    Location
    Northbrook, IL
    Posts
    394
    Thanks
    8
    Thanked 6 Times in 6 Posts

    Question can i read raw data from a USB port (weight scale)

    hi peoples,

    i'm looking for a small commandline app that is able to read data from a specified USB port.

    trying to integrate a USB-connected scale to an order-processing webapp.

    i'd try to do it directly through PHP or extension if i could have it access windows usb/hid drivers and read raw data from USB ports, but it doesnt look like that's possible. the win32api extension was dropped in 5.1 and its replacement (Foreign Function Interface) is still in alpha with no dev or compatibility with anything current.

    i could also try converting it into a virtual com port, but few devices support that type of data transfer conversion.

    thanks,
    Leon

  • #2
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,502
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    Are you running your own server with Apache/ PHP installed?

  • #3
    Regular Coder
    Join Date
    Apr 2006
    Location
    Northbrook, IL
    Posts
    394
    Thanks
    8
    Thanked 6 Times in 6 Posts
    yeah, i will run a local http server on the shipping computer just to be able to query from my webapp. as small a footprint as possible. it'll just run an ajax request to a script that needs to retrieve the reading on the scale.

  • #4
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,502
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    I think your best bet is to get a hold of a USB -> Javascript driver.
    With Javascripting, you can do certain things to the local computer,
    as Javascripting runs on the PC itself. You normally cannot access
    any disk drives or other hardware. But, with a driver, you could access
    activity on a USB port.

    Because Javascripting can be embedded on your web page (PHP script),
    that would be an easy way to read the buffer on the USB port (your scale).

    Not sure which application or driver you might need, but this is a place to start:
    http://www.google.com/search?hl=en&q...&aqi=&aql=&oq=

    EDIT:
    Tell me more about the scale itself.
    I'm wondering what the scale outputs on the USB port.
    Maybe it's smart enough to be polled using something like these?
    http://www.google.com/search?hl=en&q...i=g10&aql=&oq=



    .
    Last edited by mlseim; 03-12-2010 at 10:43 PM.

  • #5
    Regular Coder
    Join Date
    Apr 2006
    Location
    Northbrook, IL
    Posts
    394
    Thanks
    8
    Thanked 6 Times in 6 Posts
    ummm, javascript has no access to anything outside your browser.

    i am aware that you can do this with a java applet, or flash, or silverlight (probably). you can also do it by writing an activex control you install into the browser or mozilla's XPCOM equivalent + a plugin.

    but i am interested in doing this through php or php + commandline exe that can get the job done.

  • #6
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,502
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    What brand/model is the scale?

  • #7
    Regular Coder
    Join Date
    Apr 2006
    Location
    Northbrook, IL
    Posts
    394
    Thanks
    8
    Thanked 6 Times in 6 Posts
    not sure yet, have not checked

  • #8
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,502
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    If a scale, temperature controller, motor drive, any industrial electronic equipment
    has a USB connection, they most likely also have some software ... probably with a
    driver. For software connection to Visual BASIC, C++, Java, etc.

    As soon as you tell me what the brand/model is the scale is, I'm going to look it up.
    If they do provide software, that pretty much will answer your question.



    .


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •