../../_images/monodaq-u-x.png

Getting Started with MonoDAQ-U-X

Setting up IDM

  1. Download and install Installation

  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: IDM Command Line Parameters

  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://idm.isotel.eu 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 jupyter bokeh isotel-idm

to get full MonoDAQ-U-X support. Learn more under Python & Jupyter 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 ...