Isotel Precision Family Photos
MonoDAQ-U-X is a Universal 16-bit galvanically isolated USB DAQ Device specially designed for IoT development. It features a configurable front-end with 1..24 V @ 1 W supply, 50 kSa/s alias free voltage sampling in ranges from +/-100 mV to +/-10 V, currents, strain-gauge, thermocouples, digital inputs, and more.

Getting Started with MonoDAQ-U-X

MonoDAQ is an USB Full-Speed 500 mA Plug and Play device providing up to 8 multiplexed voltage inputs from +/-100 mV up to +/-10 V and one current input up to +/-500 mA. To extend a number of channels, MonoDAQ can easily scale and fully synchronize its operation via USB.

MonoDAQ talks in Open ISN language and is fully supported by IDM, python API and jupyter.

Setting up IDM

  1. Download and install IDM for your Desktop, Raspberry PI or Synology

  2. To start IDM in MAC or Windows just click on the downloaded file. In Linux type java -jar idm.jar. for further instructions please see: Running IDM from Command Prompt

  3. Plug in your MonoDAQ, click on Devices and go to USB devices; you should see it displaying its version and up-to-date status.

    ../../../_images/idm-started.png

Status Reporting

IDM stores everything it receives from MonoDAQ-U-X by default, except the streaming samples. The history of these records can be browsed under the Records Tab.

If an error occurs, the MonoDAQ-U-X title turns red and the Issues button displays the number of errors. Clicking on it will highlight the parameters that reported a problem. For a deep diagnosis, the user may need to change the Basic View into a more detailed view, which can be done in the View menu.

Embedded Operation and Remote Control

IDM can run as a deamon on Raspberry PI, NAS or other systems supporting java. The status reporting integrates with a standard syslog and IDM also starts Web API by default. By visiting the web view app at http://www.isotel.net you can easily access MonoDAQ-U-X, monitor and control it remotely.

All the information from the Channel Setup is recorded, meaning that the web view app offers a simple way to plot temperatures from thermocouples, or other channels, by simply clicking on a parameter and adding it to the chart.

../../../_images/mdu-webview.png

Real Power comes with Python and Jupyter

Assuming you are familiar with python and have already installed it, install isotel-idm package with: pip install isotel-idm to get full MonoDAQ-U-X support.

The isotel-idm package is best described in the following Jupyter Getting Started Notebook:

GettingStarted

Getting Started with MonoDAQ

We will walk you through the basic usage of python API, like how to:

  1. setup channels,
  2. fetch values,
  3. plot it,
  4. add a math channel and
  5. run it as a real-time scope with a rising edge trigger.

Wiring

In this demo we shall activate an analog, a digital one and a PWM channel, then wire the PWM output (from pin 4) back to the digital input (pin 1).

1. Setup Channels

First we call the reset() function to begin from the start, then we configure the channels, and print out the configuration. The configuration could also be stored in a 1-wire memory attached to a connector that is automatically reloaded when the connector with such a memory is detected.

When directly accessing the parameters, you may want to use the Parameters view of the IDM, which will help you browse through the device data structure.

In [1]:
from isotel.idm import monodaq, signal, gateway

mdu = monodaq.MonoDAQ_U()
mdu.reset()

mdu['ch.function.function3'] = 'PWM'
mdu['ch.rate.rate3'] = 1200
mdu['ch.set.set3'] = 0.25

mdu['ch.function.function0'] = 'Digital Input'
mdu['ch.function.function2'] = 'Voltage Input'
mdu['ch.rate.rate2'] = 50000

mdu.wait4ready()
mdu.print_setup()
pinfunctiontyperangerate [Hz]minmaxoffsetsetvalueunit
DI1 Digital Input TTL 5 V 100000 0 5 --- --- 5 V
2 Off --- --- --- --- --- --- --- ---
V1+ Voltage Input Single Ended 2V 50000 -0.1 2.0 --- --- 0.0397 V
PWM4 PWM TTL 5 V 1200 0.00 0.83 --- 0.25 --- ms
5 Off --- --- --- --- --- --- --- ---
6 Off --- --- --- --- --- --- --- ---
7 Off --- --- --- --- --- --- --- ---
8 Off --- --- --- --- --- --- --- ---
GND OneWire --- --- --- --- --- --- --- ---
IO --- --- --- --- --- --- --- --- ---
CUR+ Off --- --- --- --- --- --- --- ---
CUR- --- --- --- --- --- --- --- --- ---
GND --- --- --- --- --- --- --- --- ---
PWR Off --- --- --- --- --- --- --- ---

Ambient

Tcjc=25.9 ±0.2 oC RH=75 ±3 %

2. Acquire Only

The MonoDAQ_U.fetch() method is a python generator and fetches N samples from analog channels or digital ones if the analog channels are not active to return the stream of tuples organized as:

  • tuples of independent streams,
  • each stream holds time (x-axis) and the tuple of channels synchronous to the time (y-axis),

For example:

  • s[0][1][0] means from stream0, channels, and select 0-th channel

The generator provides meta information on the channels in the first line (row). In order to fetch the values, the generators need a sink, which loops over all the entries. In our example, we simply use the list() as the sink to display values.

From the channel setup above, we can see that digital samples run twice as fast as analog ones. However since N primarily selects analog samples, the following example will put twice the number of digital samples compared to analog ones:

In [2]:
list( mdu.fetch(N=3) )
Out[2]:
[(('t [s]', ('V1+ [V]',)), ('t [s]', ('DI1 [V]',))),
 ((0.0, (0.13,)), (0.0, (1,))),
 ((None, (nan,)), (1e-05, (1,))),
 ((2e-05, (0.1275,)), (2e-05, (1,))),
 ((None, (nan,)), (3e-05, (1,))),
 ((4e-05, (0.1102,)), (4e-05, (1,)))]

3. Plot

The fetch() method outputs a stream. To be able to plot it, the stream must be collected into a signal. A signal here means a dict sorted by channels, each having a pair of lists of equal size, providing Y samples and corresponding X time samples.

To convert the generated output to a stream use the signal.stream2signal() method, which is a generator returning signals.

By extending this example we get a nicely sorted dict; again we use the list() to display the results. We may again observe more digital samples than analog ones, however, the time axis fits together nicely:

In [3]:
list( signal.stream2signal( mdu.fetch(3) ))
Out[3]:
[{'DI1 [V]': {'x': [0.0, 1e-05, 2e-05, 3e-05, 4e-05], 'y': [0, 0, 0, 0, 0]},
  'V1+ [V]': {'x': [0.0, 2e-05, 4e-05], 'y': [0.0006, -0.0001, 0.0011]}}]

Now to the plot, with the signal.scope() which iterates over signals provided by the stream2signal() method and returns last acquired signal as data. Let us increase the number of samples to get a nicer waveform.

In [4]:
signal.scope( signal.stream2signal( mdu.fetch(100) ), title = 'First Plot');
Loading BokehJS ...

4. Adding a Math Channel

It would be a pity not to be able to perform a real-time analysis or computation on data in python. We mute the first V1+ [V] channel and change the colors of the other two. You may freely enter an equation with channel names with big capital letters, and only up to the + sign or space.

In [5]:
signal.scope(
    signal.stream2signal(
        signal.addmath( mdu.fetch(100), 'Masked [V]', expr = '5*V1*DI1'),
    ), title = 'First Plot with Math Channel', colors = [ None, 'darkgreen', 'darkorange']);
Loading BokehJS ...

5. Real-time Scope

Real-time updates require that a larger continuous stream of samples is fetched from the MonoDAQ. We achieve that by providing fetch(2000000) a sufficiently big number to run for some more time.

To display the intermediate collected samples, we need to instruct the stream2signal() a split parameter with a number of samples to be displayed in one shot. Note that fetch() refers to analog samples and there may be a significantly larger number of digital samples at the output. In addition if you want, you can reset the time and start at zero each time a shot is made. Then you should set the relative_time to True.

And last, we introduce a rising edge trigger function signal.trigger, which evaluates:

  • The precondition that must be met in order to search for a
  • trigger condition.
  • Trigger is set a single_shot mode by default.

The example below shows how to wait for a rising edge on the DI1 digital channel by specifying both the pre-condition and the condition. When the condition triggers, P pre-buffered samples are yielded and then continues for the remaining N samples.

In [6]:
data = signal.scope(
    signal.stream2signal(
        signal.trigger( mdu.fetch(2000000), precond='DI1 < 0.5', cond='DI1 > 0.5',
                        P=200, N=200, single_shot=False, post_delay = 0.1),
        split=400, relative_time=True),
    title="Continous Mode - Rising Edge Trigger", y_range = (-0.1,1.1) )
if not data:
    print('Signal not detected')
Loading BokehJS ...

MonoDAQ-U-X Command Line Interface

On embedded systems, like Raspberry PI, or even desktop, you may want to have a CLI control over the device. The monodaq module within the isotel-idm provides:

$ python -m isotel.idm.monodaq -h
usage: monodaq.py [-h] [--gateway GATEWAY] [-d D] [-N N] [-s S [S ...]]

MonoDAQ-U-X Utility 1.0a11

optional arguments:
-h, --help         show this help message and exit
--gateway GATEWAY  gateway address, defaults to http://localhost:33000
-d D               Device to fetch from, like: 'MonoDAQ-U-X v1.55.0.17 0x4'
                    or just: device0
-N N               Fetch N samples and print results in TSV format
-s S [S ...]       Set or query a parameter, like: ch.function.function0
                    'Digital Input'

To list all available devices type (or optionally provide a –gateway):

$ python -m isotel.idm.monodaq
device0      MonoDAQ-U-X v1.55.0.17 0x4

To see the Channel Setup:

$ python -m isotel.idm.monodaq -d device0
|pin           |function      |type          |range         |rate [Hz]     |min           |max           |offset        |set           |value         |unit          |
|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|
|DI1           |Digital Input |TTL           |5 V           |100000        |0             |5             |---           |---           |5             |V             |
|2             |Off           |---           |---           |---           |---           |---           |---           |---           |---           |              |
|V1+           |Voltage Input |Single Ended  |2V            |50000         |-0.1          |2.0           |---           |---           |0.0439        |V             |
|PWM4          |PWM           |TTL           |5 V           |1200          |0.00          |0.83          |---           |0.25          |---           |ms            |
|5             |Off           |---           |---           |---           |---           |---           |---           |---           |---           |              |
|6             |Off           |---           |---           |---           |---           |---           |---           |---           |---           |              |
|7             |Off           |---           |---           |---           |---           |---           |---           |---           |---           |              |
|8             |Off           |---           |---           |---           |---           |---           |---           |---           |---           |              |
|GND           |OneWire       |---           |---           |---           |---           |---           |---           |---           |---           |              |
|IO            |---           |---           |---           |---           |---           |---           |---           |---           |---           |              |
|CUR+          |Off           |---           |---           |---           |---           |---           |---           |---           |---           |              |
|CUR-          |---           |---           |---           |---           |---           |---           |---           |---           |---           |              |
|GND           |---           |---           |---           |---           |---           |---           |---           |---           |---           |              |
|PWR           |Off           |---           |---           |---           |---           |---           |---           |---           |---           |              |

To fetch 10 samples and print them on screen. Note that the t character may not perfectly align the spacing between the numbers, however the single t simplifies parsing and importing into LibreCalc or Excel. To redirect them to a file add > file.tsv at the end.

../../../_images/TSV-LibreCalc.png
$ python -m isotel.idm.monodaq -d device0 -N 10
t [s]       V1+ [V] t [s]   DI1 [V]
0.0 0.1738  0.0     1
        1e-05       1
2e-05       0.1599  2e-05   1
        3e-05       1
4e-05       0.1559  4e-05   1
        5e-05       1
6e-05       0.1422  6e-05   1
        7e-05       1
8e-05       0.1386  8e-05   1
        9e-05       1
0.0001      0.1226  0.0001  1
        0.00011     1
0.00012     0.1241  0.00012 1
        0.00013     1
0.00014     0.0721  0.00014 1
        0.00015     0
0.00016     -0.0529 0.00016 0
        0.00017     0
0.00018     -0.0379 0.00018 0

To change input on the 1st channel:

$ python -m isotel.idm.monodaq -d device0 -s ch.function.function0 'Voltage Input'
Voltage Input

or to obtain reading, i.e. of humidity, or a value from the 1st voltage channel:

$ python -m isotel.idm.monodaq -d device0 -s ch.ambient.RH
56.0+/-2.0

$ python -m isotel.idm.monodaq -d device0 -s ch.value.value0
2.4533

However you can combine the IDM Web View (http://www.isotel.net) to configure and review the Channel Setup with the CLI to fetch samples into TSV formatted file.