Using MonoDAQ-U-X with Raspberry Pi

Whether you are doing measurements on a remote site or keeping your brand new Macbook safe sometimes using a full-size computer to take measurements with the U-X is just not practical or economical. So let’s take a look at using the affordable but very capable Raspberry Pi to log data from the U-X.

While X3 is not supported on Linux there is an alternative in the form of Isotel Device Manager (IDM). This software serves as a gateway and allows us to store data directly, use it in python or even send it to a remote machine.

This is the fist of three guides. We will be setting up the IDM, connecting it to the Pi, and storing data locally. The second guide will cover sending data to python and the third connecting the Pi to a remote computer running Dewesoft’s X3 via UDP.

We will be using a Raspberry Pi B+ but most models should work just fine. We are assuming you have already set up Raspbian but if you haven’t you can find a great tutorial here.

So let’s get started!

Setting up the RPi

Before we start working with the IDM we first need to add a couple of lines of text to a system file on the Pi otherwise the Monodaq U-X wont be detected in the IDM.

Since we will be editing a system file we need to open the text editor as a superuser. We will be using the preinstalled Leafpad editor. To launch the editor open the terminal and run the command:

gksudo leafpad &

This will launch the Leafpad text editor. Using the editor open the system file “99-com.rules” which is located in /etc/udev/rules.d. The file should look something like this:

It is wise to backup the 99-com.rules file before making any changes to it just to be safe.

Copy/paste the code below to the top of the 99-com.rules file. Where exactly you paste it is not critical just make sure not to accidentaly edit any existing code.

SUBSYSTEMS=="usb", ATTRS{idVendor}=="5726", ATTRS{idProduct}=="1500", GROUP="users", MODE="0666"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="5726", ATTRS{idProduct}=="1502", GROUP="users", MODE="0666"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1ced", ATTRS{idProduct}=="8000", GROUP="users", MODE="0666"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1ced", ATTRS{idProduct}=="8001", GROUP="users", MODE="0666"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1ced", ATTRS{idProduct}=="8002", GROUP="users", MODE="0666"
KERNEL=="hidraw*", SUBSYSTEM=="hidraw", MODE="0666"

Save the file and close it. To apply the changes we will need to run a few commands. First, open up the terminal and navigate to the rules.d folder by running the command:

cd /

And then the command

cd etc/udev/rules.d

Finally, run the command below which applies the changes. After it completes reboot the Pi:

sudo udevadm control --reload-rules && udevadm trigger

Excellent! We have configured everything and are ready to get started with the IDM

Setting up the Isotel Device Manager

Download the latest version of the IDM which can be found on Isotel’s website.

The downloaded IDM will be in the form of a .jar file. In order to use the IDM we need to open the .jar file by using the terminal.

Open the terminal and navigate to the folder which contains the downloaded .jar file. In our example we have downloaded the file to the Downloads folder so for us the commands are:

cd

Then:

cd Downloads/

If you are not familiar with navigating through folders with the cd command you can find an explanation here.

When we are in the folder containing the .jar file open it with the command:

java -jar idm.jar

Make sure to replace idm.jar with the actual name of the downloaded file. In our example, this was “idm-1.1b5.jar.

After a few seconds, the Isotel Device Manager will open. We plug in the U-X and if everything has been set up correctly it will show up under USB Devices.

Double-clicking on the MonoDAQ-U-X will open a new window. This device view window contains four tabs: Contents, Parameters, Records, and Activity.

The Contents tab should be familiar to anyone who has used the Monodaq plugin in X3. It is where all channels can be configured. All values in blue can be adjusted by clicking on them.

For this demonstration we will be connecting a thermocouple to the U-X and logging the temperature. The thermocouple has been connected to the pins 1 and 2 on the U-X and their function has been adjusted accordingly as seen on the picture above.

Switching over to the Parameters tab allows us to adjust what data we will be storing. It shows all of the device parameters structured in a tree. Fully expanding a part of the tree will make it show up under the records tab and allow us to view and store the data.

While the tree can be expanded to show various data we are only interested in the measured channel values so we will be expanding the var/ch/value part of the tree.

Starting the recording by clicking the record button and moving to the Records tab will show us the data being recorded. This screen does not refresh automatically so make sure to press the refresh button if you can’t see any data.

We can see the temperature logs above. The program will store as many samples as were set in the View>Record Settings menu (maximum of 999) before overwriting the old data.

Finally if we are happy with the recorded data clicking on the export button allows us to save the content of the Records tab as a .csv file.

That’s it! As easy as Pie

Conclusion

As you might have noticed using the IDM as a standalone piece of software comes with limitations. Regardless of the sample rate set on the Contents screen, the data will always be stored at 1Hz and the maximum number of samples stored is 999.

While you can use the IDM by itself it is primarily intended to be used in conjunction with python or with a remotely connected computer. Both options allow the U-X to be used to its full potential and give us.

Make sure to check out the other parts of this tutorial series to learn how to do just that! #Python link# #UDP link#