XPicoWiFi/Monitor
Contents
Overview
The Monitor feature can be used to query and capture desired information during an xPico Wi-Fi serial port to serial device connection. Through the Monitor feature in Web Manager, you may configure the monitoring of a connected serial device through a sequence of five pages via Explorer, or go to a specific Configuration page to make specific changes. The device monitoring status can be viewed through the Status page.
The documentation for Monitor can be found in the User Guide on Chapter 16. There is an extensive example there on how to communicate with a device that has a command line.
Example: The babbling device
A babbling device is one that sends data periodically over the serial port, regardless of whether another device is attached or not. Usually it is delimited by a newline or a carriage return to indicate new data. This kind of device is stateless, and usually we only care about the last value, rather than all the values in between.
An example is a scale like the Homedics 349klx or certain pulse oximeter devices.
Setting up Monitor
Serial Port setup
On the configuration for Line 1, set the Baud Rate to 2400 baud and the Protocol to Monitor. Don't forget to click the Submit button to save the configuration!
Monitor
To setup how Monitor will parse the data from the scale, we will use Explorer which makes it very easy to configure Monitor correctly.
Click on Monitor, then Explorer. With the scale on so that it is sending data, click Refresh to the see the data that is being sent by the scale.
The data shows up in the data display, which shows as:
[0x02][0x80][0xd7][0xe4]000.0[0x0d] [0x02][0x80][0xd7][0xe4]000.0[0x0d] [0x02][0x80][0xd7][0xe4]000.0[0x0d] [0x02][0x80][0xd7][0xe4]000.0[0x0d] [0x02][0x80][0xd7][0xe4]000.0[0x0d] [0x02][0x80][0xd7][0xe4]000.0[0x0d] [0x02][0x80][0xd7][0xe4]000.0[0x0d] [0x02][0x80][0xd7][0xe4]000.0[0x0d] [0x02][0x80][0xd7][0xe4]000.0[0x0d] [0x02][0x80][0xd7][0xe4]000.0[0x0d]
The data is shown highlighted by row sent by the scale. Each row ends in a [0x0d] which is the newline character. Note that the xPico Wi-Fi represents non-printable characters by their hex value, and inside brackets.
If our scale needed initialization data to be sent, here's where we would enter. But it's a babbler, so nothing is needed to get it to talk. Click Next> to move to the next page.
This next page is to setup the command to send on the serial port periodically to gather data. While the scale might not need it, there are devices that require a "read" command. The scale will discard it, so put anything you want in the Command, and set the Delay to 1 second. This way, we will read data from the scale once per second
Click Next>
Now we will setup some filters to extract the weight data that we want. As we saw earlier, the data comes in "rows" that are separated by newline characters. So expand the Rule 1 to setup a filter rule. Click on the data as the Source (or set the Source as 0), set Mode to Delimiter, and the string to [0x0d]. This will separate all the lines on their own. You can see the output of filter 1 below, at 1.1, 1.2, 1.3, etc.