Instrument of Things

The Instrument of Things project shows how to extend your custom electrical instruments with industry-standard capabilities for remote control via a TCP/IP interface. The WIZnet WIZ550io module is used to enable a basic web server, a portmap service, and a server for the remote control of the instrument using the VXI-11 communications protocol. The ultimate goal for the Instrument of Things is to easily add the VXI-11 communications protocol and LAN eXtensions for Instruments (LXI) technology to any electrical instrument project.
WIZnetconnect_logo_horweb_550x

Modern electronics lab instruments feature an Ethernet port for remote control and reading measurement data by a PC or other networked instrument. These instruments can be recognized by the LXI (LAN eXtensions for Instrumentation) logo, indicating compliance with standards defined by the LXI Consortium. One of the core features of an LXI-compliant instrument is a built-in web interface for remote configuration and possibly remote control of the instrument.

Another standard is the TCP/IP instrument protocol specification VXI-11, which is defined by the VXIbus Consortium. Since LXI-compliant instruments are based on Ethernet, the TCP/IP interface allows communication with the instrument using the VXI-11 interface. The VXI-11 protocol enables the transmission of ASCII commands known as Standard Commands for Programmable Instrumentation (SCPI). A common SCPI is the short string “*IDN?”, which can be send to an instrument and should be replied to with a unique identifier (actually manufacturer name, model number, serial number and firmware version) of the instrument. Other SCPI commands allow the change of measurement settings, the triggering of measurements and the reading of measurement results.

The ultimate goal of the Instrument of Things (IoT), as submitted to the WIZnet Connect the Magic 2014 Design Challenge, is to deliver industry standard capabilities for remote control via a TCP/IP interface to any home-built electrical instrument. With the recent explosion in popularity of small and low cost microprocessor development boards, such as Arduino, Raspberry Pi, Beaglebone and others, every hobbyist can quickly implement a custom instrument for whatever type of measurement is needed to make the next step in a project. What was missing, up to now, was a LXI/VXI-11 package to easily integrate in the instrument and shorten the distance to the professional instruments.

The WIZnet WIZ550io module makes it very easy to add Ethernet capabilities to custom electronics instruments, especially when it is still under development on a breadboard. The module takes care of four layers of the OSI model for networking (see table 1), is preprogrammed with a unique MAC address and features automatic configuration of network settings. The remaining three layers of the OSI model have been implemented for this project in software running on the Atmel SAM3X8E ARM Cortex-M3 CPU of the Arduino Due microcontroller board.

Table 1, the layers of the OSI model for networking and the (partial) implementations in this project.

  OSI model layer implementation
7 application layer HTTP, VXI-11, port map
6 presentation layer XDR
5 session layer RPC
4 transport layer TCP, UDP
3 network layer IPv4
2 data link layer MAC
1 physical layer IEEE 802.3

The three networking-related applications are a basic web server (HTTP), a port map service and a server for remote control of the instrument using the VXI-11 communications protocol. The web server can be reached at the default port 80 on the instrument. The port map service operates at standard port 111 and processes RPC port mapper procedures using TCP or UDP. The VXI-11 server actually consists of up to three services: a VXI-11 Core listener, a VXI-11 Asynchronous listener and a VXI-11 Interrupt listener. The VXI-11 services can be set to listen at any available TCP port number, as long as the service is registered with the port map service for directing clients to the correct port. See table 2 for the unique program numbers of the VXI-11 listeners, which are registered with the port map service when available for clients.

Table 2, RPC program numbers of the VXI-11 listeners.

program number
0x0607AF DEVICE_CORE
0x0607B0 DEVICE_ASYNC
0x0607B1 DEVICE_INTR

The implementation of the XDR layer (eXtended Data Representation) consists of a library of functions, which are used to enable conversion to and from a standard data format for transmission. Incoming data on the physical interface of the WIZnet WIZ550io is first processed up to the transport layer of the OSI model. When the data is actually intended for one of the services running on the Arduino Due, the module will indicate that data is available in its buffers. This data is unpacked using the XDR library and processed further by the service running on the Arduino Due. The process of sending data from the instrument to the client follows the reverse route through the layers of the OSI model. The parts of the instrument not related to networking are a 20 x 4 LCD character display, a micro SD card reader and the RGB color sensor. The ease of use of the Arduino platform and availability of an extensive set of add-on modules, makes it trivial to add other sensors or components for local operation by the user.

WZ1295_block_diagramFigure 1, block diagram of the Instrument of Things.

Figure 1 shows a block diagram of the Instrument of Things as presented in this document. The microSD card and the Wiznet WIZ550io ethernet module are connected to the SPI interface bus of the Arduino Due. Separate slave select signals (CS) are available for the modules on the SPI bus. One digital I/O pin of the Arduino Due is used to reset the WIZ550io module. The interrupt and ready status signals of the WIZ550io module are connected to two other digital I/O pins of the Arduino Due.

The 20 x 4 character LCD display and the RGB sensor are connected to separate I2C lines of the Arduino Due, although they could also share a single I2C line. The LCD module has been configured to use address 0x20 on the I2C bus, while the RGB sensor uses address 0x29. The USB ports on the Arduino Due are used for programming updated versions of the (compiled) source code and for debugging the software via a RS232 serial port terminal. The last connection of the Instrument of Things is the LAN ethernet connection to the Wiznet WIZ550io module.

WZ1295_Prototype1_photoFigure 2, photograph of the first prototype of the Instrument of Things.

Let’s get to the point of the specific Instrument of Things presented here: a water color test kit meter. Water color test kits are chemical test sets, which can be used to measure the quality of water in e.g. an aquarium, swimming pool or rain water reservoir. Each set is specifically designed to measure a specific property or content, like acidity (pH-level) or concentration of nitrides. The result of a water color test is typically a specific color of the water sample, which can be compared to a color chart to obtain an approximate value of the measured parameter. Unfortunately, no electronics are involved here at all. The color chart that comes with a water color test kit typically has a scale of only 3 to 5 different colors. Interpolation between to colors can be challenging and will probably not result in reproducible results. Exposure to direct sunlight or prolonged storage in darkness will affect the quality of the color chart and thus the accuracy of the measurement. The visually impaired and people with color blindness will prefer an alternative method of reading the results of the water color test kit. Last but not least, some take performing measurements really serious. Instead of relying on the calibration of the color chart by the supplier of the test kit, calibration measurements become part of the sample measurement procedure. The color chart is disposed of and replaced by a more accurate color scale. Electronics are used to get accurate color readings, perform calculations on the measurement data and to store results. The RGB sensor selected for the Instrument of Things features a white LED to light the sample. This LED is mounted on the same PCB as the RGB sensor, thus only reflected light will be measured by the sensor. Optionally, a second white LED is easily connected to spare pins on the Arduino Due to measure by transmission of light through the sample. A third option is to place a reflective surface, e.g. aluminum foil, on the opposite side of the test vial.

WZ1295_Prototype2_photoFigure 3, photograph of prototype 2.

Follow this link to the WIZnet Connect the Magic 2014 Design Challenge. My entry can be downloaded from that site or by using this link: WZ1295_Entry.