Friday 16 December 2011

Connecting to the USB My Weigh Ultraship U2 scale using Visual Studio C# 2010 - Part 1

I'm trying to figure out how to connect to a My Weigh weighing scale, the Ultraship U2 to be specific. I'm going to want to connect to it and control it using Visual C# 2010. This post details my findings as I worked through the issues of identifying what I would need to find out in order to do this.

I'll say from the start of this post that if you have any additional information about this device and about how to connect to it, make sure you let me and everyone else know in the comments.

Identifying the Ultraship's Vendor ID and Product ID


The My Weigh Ultraship U2 is a USB HID (Human Interface Device) and as such its Vendor ID and Product ID can be found in the Device Manager of your Windows PC. 

Connect the scale to your PC and on Windows 7, open your Start Menu and right click on Computer and select Properties. This opens the Control Panel -> System and Security -> System Page where you need to select Device Manage from the top left.

From the Device Manage window that opens, it is easiest to reorganise the view of the devices by going to the View menu and selecting Devices By Connection.


The Ultraship U2 scale is the HID-Compliant Device that you can see highlighted in the image above. You can right-click on it and select properties, then select the details tab and where you see the Property drop down, select Hardware IDs.


From this Device Properties window, you can now see the VID and PID for the scale.
  • VID 04D9
  • PID E002
Now that I know VID 04D9 PID E002, I need to find out how to access the device using from Visual C# 2010. Any suggestions?

11 comments:

  1. Did you manage to find a way to pull the value from the scale rather than push by way of the "SEND" button? I've been able to connect and access some properties through HID but have NOT been able to read a value from the scale. Just thought I'd check if you had managed that?

    ReplyDelete
    Replies
    1. Hey Scuba Steve, no, I did not find any way other than pressing the SEND button on the scale to read the weight from the device. In the end, I simply used the scale as a 'Keyboard Wedge' where pressing the Send button pushed the weight into the keyboard buffer.

      Delete
  2. Hi, I've had some issues trying to read values from my Ultraship U-2 scale. I bought it a while ago (probably about 1.5 years ago) and gave when the USB sniffer I tried never gave out consistent input for the same weight. What driver did you use? I used the ones given by the manufacturer and the device shows up as a "Prolific USB-to-Serial Comm Port" not as a HID device. Do you have to "activate" the scale through their tool to get any packets from the device? Do you have any sample code you would share?

    Thanks.

    ReplyDelete
    Replies
    1. Hi. No, I never had to activate the scale in any way. Also, I have scales that are easily over 1.5 years old and they don't need any activation. They all give consistent results too. I can't recall exactly how the Windows Plug-n-Play identified them when they were first plugged in I'm afraid. As for code, I ended up foregoing all development with the device by simply treating them as a keyboard wedge device where pressing the Send button on the scale sends the scales output to the keyboard buffer.

      Delete
  3. Hi,
    The only solution I found to this is to modify the U2 scale's hardware by adding a micro-controller circuit board (costs about £30). That captures the data from the scale's circuit board and transfers it via a virtual com port the micro-controller installs on the PC. Works like a charm in real time, it is relatively simple to install, but it requires to modify the hardware and it took about 6 weeks to reverse engineer the raw binary signals in the circuit board and write the decoder library for it.
    The result is that I wrote a neat little application on the PC emulating the scale's display showing real time info from the scale. Also the library allows me to embed it to any application in visual studio. I simply need to open the com port, read the incoming data and translate it via the library to get the real time weight.

    ReplyDelete
    Replies
    1. @dscharge that seems like the most thorough and complete solution, if there were a prize you'd be the recipient.

      Does this mean that, with the micro-controller, it is constantly reading the port for weight information and there is no need to hit the send button, or, do you still have to trigger the send, but, you can do it from the app rather than having to hit the physical button on the scale?

      The holy grail is to have the app record the weight when the weight settles without having to press any buttons. Is this what you have been able to achieve?

      Delete
    2. Yes. The point of my development was that our company uses about 100 of these scales, and wanted to eliminate the button press completely and automatize the weighing process.
      I did in fact achieve that.
      It works so, that the embedded extra circuit board in the scale sends the weight info to the PC via the serial connection about 10-20 times per second and it doesn't care if the port is open or not on the PC side or if the button is pressed or not.
      The PC application has to open the port and on DataReceived event on the com port it reads the incoming data line, and translates each lines to weight refreshing the screen.
      It also takes all icons as well, so the program can see the steady icon, hold icon or the load bar on the side etc.

      Actually I just finished with the project a couple of days ago, upgraded 4 scales and it is in production test now, so I can't say anything about its long-term reliability yet, but so far it works.

      Delete
    3. Sounds like the ultimate result. It's a shame there isn't a scale out there that would have done all of this by default and without the need to add in extra components.

      Our ultimate question is, can you share the controller board details and github the soource code? :D

      Delete
    4. Well, I basically just finished it, still testing, fine tuning the software, e.g. added auto conversion function that automatically converts the weight to any other weight units etc.
      Also my company will need to sign off on sharing it (since I developed it to them) and then we may even consider selling the scale with the upgrade, if there is a market for it. (I was even thinking about putting one or two up on ebay :) ) However, if they don't really care about it being shared, I will definitely put it up somewhere. Just not yet.

      Delete
    5. dscharge, any updates on this? Would love to have a continuous reading.

      Delete
  4. The software BillRedirect is compatible with this scale here the manual that indicate how install the driver and software:
    -
    http://www.billproduction.com/Bill_Redirect_scale.pdf
    -
    -
    At step #5 use the command at page 8 : Scale ULTRASHIP U2 Configuration

    ReplyDelete