Digital outputs are one of the ways the MonoDAQ U-X can be used to interact with other electronics.
The digital output channels can be set to either 0 V or 5 V potentials with respect to GND.
At least one input channel must always be used since the sample rate depends on it. This means we can configure a maximum of 7 channels as digital outputs.
Adding a Digital Output channel
Any of the 8 channels can be used as a digital output by selecting “Digital Output” in the Function column.
We have set the second channel as the digital output and the first channel as a voltage input which won’t be used but is needed to determine the sample rate
Manually controlling the channel with a button
In order to control the channel we go to the Measure tab and create a display by pressing the plus button and adding a custom display.
Edit the display by clicking the design button then select the “Input control display”
A small box appears in the display window. The default type is “Input field” which we change to “Push Button”. Select the digital output which needs to be controlled by this button in the column on the right. In this case, this is 2-DO2 (digital output 2).
We can also add button text, change its color, and scale the button by dragging its corners. When the button is configured the editing mode is closed by clicking the design button again.
Finally, we verify that everything is working by adding a recorder that logs the DO2 and clicking the button a couple of times.
Controlling the channel with math
While letting the user control the Digital Output is useful a more versatile option is controlling digital outputs with math channels.
As long as a conditional statement can be made any measured or derived value can be used as a trigger for the digital output.
Toggling the output when a measured quantity reaches some predetermined value is a simple example.
Important note: the channel update rate is dependant on operating system jitter. It is usually around 50Hz but this can vary. Because of this digital output control should only be used for relatively slowly changing signals.
Let’s assume we have a pressure sensor monitoring pressure in a container. If the pressure exceeds some predetermined pressure limit a digital output needs to be triggered which will be used to open a relief valve.
Instead of using an actual sensor we’ll represent the pressure sensor input with a simple formula that oscillates between 0 and 10 bar.
We want the output to engage whenever the pressure exceeds 8 bar. In other words, we need a formula that outputs 1 whenever pressure exceeds 8 bar and 0 when it does not.
We can add this in math by using a formula with an if() operator.
The general form is:
if(condition, 1, 0)
The condition in our case being ‘Pressure’ > 8. As long as the condition is true the first value (1) will be the output and if it is not true the second (0) value will be the output.
After setting up the formula we move back to the MonoDAQ plugin channel view. Right-click on the table header and click edit columns.
We make sure the box next to “Source channel” is checked and click OK. Then we select the formula we have just set up as the Source channel for our digital output.
The channel is now controlled by our formula and triggers the 5V output whenever the pressure exceeds 8 bar. This can be seen on the recorder:
For controlling simple systems switches can be set up for the user to manually operate the digital outputs.
For most other applications the usage of math formulas enables much more versatile and precise control. Integrals, statistics, and all other math operations can all be used as triggers.