How to start listener for serial data from mettler toledo

798 views
Skip to first unread message

tommy.h...@gmail.com

unread,
Apr 24, 2018, 10:35:18 PM4/24/18
to qz-print
Hi,

I want to start listener on serial port for mettler toledo scale data, so user just need to click button once to start the listener and then they can scale many item one by one without need to click button again. If they finish, they can click close button to stop the listener.
Is that possible with qz tray?

Tres Finocchiaro

unread,
Apr 24, 2018, 10:57:42 PM4/24/18
to tommy.h...@gmail.com, qz-print
QZ Tray's serial support was coded specifically for Mettler Toledo serial scales.  Just setup the start/end properly and it should get you what you're asking for.

https://qz.io/wiki/2.0-serial-communication#mettler-toledo

In regards to the timing of things (no button), I think you're asking if the serial port can notify that the weight is stable/non-stable. This is a bit tricker to detect what a human was thinking when they moved the scale and I'm not sure there's an easy way to automate that.  You would have to make some guesses client-side, I'd think.

Personally, I'd recommend HID interface if the scales offer one because HID can tell you a lot more about the status of the scale.

Some sample HID code is here:

But you'd still have to guess that when the scale returns to zero, and is not busy that it's a sign the item has been removed and the next one is ready.  This sounds more like a JavaScript problem then a QZ Tray option, don't you think?

--
You received this message because you are subscribed to the Google Groups "qz-print" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qz-print+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

tommy.h...@gmail.com

unread,
Apr 27, 2018, 3:44:13 AM4/27/18
to qz-print
Hi Tres,

I finally decide to do it with button press to avoid the weight is stable/non-stable issue.

But i got some problems when try to detect the weight with qz tray. Below is some test that i do

1. For initial test i use hterm to see that the scale working fine and can send data. Hterm can receive weight from scale like "35.95"
2. Second test i use nodejs + serialport to try send "S\n" command can got result "S S 35.95 g"
3. After both test i install qz tray 2.0 and use https://demo.qz.io
- I try list port, got COM1
- I fill port COM1 and click open port : Success
- I fill S\n on command and click Send Command but no result appear.
- I fill W\n on command, set Data Bits 7, set Parity EVEN on command and click Send Command but also got no result appear.

Can you advice why i cant get result with qz tray?
> To unsubscribe from this group and stop receiving emails from it, send an email to qz-print+u...@googlegroups.com.

Tres Finocchiaro

unread,
Apr 27, 2018, 11:11:08 AM4/27/18
to tommy hendrawan, qz-print
"S\n" sounds like a different communication entirely.  Do you have a raw packet capture? Is the STX and ETX that we provide in our demo correct for this model?  There may be differentiating standards here.

One thing we don't do well (yet) is blindly read until there's a carriage return.  We need to fix this because we're starting to do R&D against other serial devices (such as arduino) and this would make integration easier.  These fixes will be coming eventually.

Another problem -- as identified by one of our developers -- is the code we wrote to work with the P60 series MT scales has the potential to lose data due to the message chunking logic we wrote.  This shouldn't affect your readings, but it's a bug worth making note of.

What you may be interested in is firing QZ Tray up in IntelliJ Community Edition and doing some debugging.



You can put some echo statements in there and see what's happening.  Note, our https://demo.qz.io page won't work through IntelliJ, so you'll need to fire up a local instance of sample.html for debugging.

If there's something we can do to improve compatibility with this scale, we can talk through official support channels and get you a patch.  Device compatibility is the cornerstone to the project's success. :)


Reply all
Reply to author
Forward
0 new messages