DAQ/Basic/Installation/English

From Script | Spoken-Tutorial
Revision as of 15:00, 15 February 2013 by Manivel (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Title of script: Configuration of PC/Laptop to use DAQ with Scilab

Author: Rakhi R

Keywords: Data Acquisition, Scilab, HART, COMEDI, Installation


Visual Clue
Narration
Show Slide 1 Hello and welcome to the Spoken Tutorial on Configuration of PC/Laptop to use DAQ with Scilab.
Show Slide 2 The objectives of this tutorial are:


Downloading the required packages

Point 2 in Slide 2 Configuration of these packages, and
Point 3 in Slide 2 Checking and verifying your installation
Show Slide 3 The pre-requisites for this tutorial are:


Knowledge of Scilab, and

Point 2 in Slide 3 Basic knowledge of shell commands in Linux
Show Slide 4 For this tutorial, I have used the DAQ hardware, USBDUXFAST.


This is the hardware required for this tutorial.

Point 2 in Slide 4 Operating System used is Ubuntu 10.04
Show Slide 5 The software used in this tutorial are:

COMEDI suite

Point 2 in Slide 5 Scilab 5.3.1
Point 3 in Slide 5 HART Toolbox version 0.4.4 in Scilab


We recommend Scilab 5.3.1 for use with HART toolbox.

Show Slide 6 Let us first check the version of the kernel that I am running.
Open Linux terminal window and

type:

uname -r

Type this
Show the terminal screen with the output of uname -r My kernel version is 2.6.32-24.
Point 2 in Slide 6 If your kernel version is older than 2.6.30, you have to manually install the COMEDI suite in your PC.
Point 3 in Slide 6 For this, please watch the Spoken tutorial on Manual Installation of COMEDI suite.


After installing COMEDI manually, follow the steps in this tutorial from slide 7 onwards.

Point 4 in Slide 6 Lets continue this tutorial assuming that your kernel version is 2.6.30 or higher.


Lets install some packages.


The packages are libcomedi0, libcomedi-dev and python-comedilib.

Open terminal and type:


sudo aptitude install libcomedi0 libcomedi-dev python-comedilib

Install them using this command.

I have already installed these.

Open the terminal and type:


cd /lib/modules/2.6.32-24-generic/kernel/drivers/staging/comedi/drivers/


ls

You can validate comedi installation by checking the staging folder for COMEDI modules.


This folder must contain drivers for various DAQ cards as you see here.


Note that if your kernel version is different from mine,

the path will be lib-modules-your kernel version-kernel-drivers etc.

Show Slide 7 The next step is to install HART toolbox.
Point 2 in Slide 7 I assume that you have installed Scilab 5.3.1 in your PC.


Point 3 in Slide 7 Install the packages gcc and g++ if they are not installed in your PC.
Open terminal and type:


sudo apt-get install gcc g++

Gcc and g++ can be installed by this command.
Open firefox and go to the URL:

http://hart.sourceforge.net/downloads.html


Click on Download hart_0.4.4-src.tar.gz

Download the latest version of HART toolbox.


I am using the version 0.4.4.

I have already downloaded this.


Unpack the files in a folder of your choice.

Show the location of Scilab-5.3.1 folder Save the unpacked folder in the contrib directory of Scilab.


I have the Scilab-5.3.1 folder in /home/rakhi/Mystuff.


So I save this folder in /home/rakhi/Mystuff/scilab-5.3.1/share/scilab/contrib

I have already done this.

Open the terminal and type:


cd /home/rakhi/Mystuff/scilab-5.3.1/share/scilab/contrib/

I go to this folder now.
Type the following on terminal:


cd hart_0.4.4

sudo gedit Makefile

You may need to make some changes in the Makefile of the HART toolbox, if you have your scilab installation in say, /home/xxx folder.
Type the following in the makefile:


SCILAB_VERSION = 5.3.1

SCILAB_DIR = /home/rakhi/Mystuff/scilab-$(SCILAB_VERSION)

SCILAB = $(SCILAB_DIR)/bin/scilab


#SCILAB = scilab

#SCILAB = scicoslab

Modify the makefile

Uncomment the first three lines as shown (by deleting the hash symbol at the beginning of the line)


Type the version of Scilab in the field SCILAB_VERSION

Note that you will have to write the path to your Scilab-5.3.x folder in the field SCILAB_DIR.


Comment out the fourth line as shown (by adding a hash symbol)

Close and save the makefile.


Type the following on terminal:


sudo make

Do a make.


Wait for a couple of minutes.


Press Ctrl + Z when you get a --> at the end of make.

Please check the terminal for any errors.

Ensure that you do not get any errors while doing the make.

If you get any error, please troubleshoot and recompile until no errors are present on compilation.

Troubleshooting includes installing any missing libraries or packages.

Now you have installed HART toolbox.

As we do not use the hard real time component of HART, let us do the following to remove the RTAI related components from HART.

Go to ~/scilab-5.3.x/share/scilab/contrib/hart_0.4.4/etc folder

Modify the HART.start file in this folder( you need to do this in sudo mode, i.e., as a super user).

Comment out the following lines (by adding // to the left of the lines as given below):

//  xcosPalAdd(pathmacros+'/palettes/hart_base/hart_base.xpal','Hart');
//  xcosPalAdd(pathmacros+'/palettes/rtpreempt/rtpreempt.xpal','Hart');

Instead of the line containing rtprempt.xpal, you will have to comment out:

//xcosPalAdd(pathmacros+'/palettes/RTAI/RTAI.xpal','Hart');

in certain versions of HART


Save and close this file

Open Scilab-5.3.1


Click on Toolboxes and then click on hart_0.4.4

This toolbox can be loaded in Scilab now and let us find out what are the options in the toolbox.


The toolbox is loaded now.

Note that you need to get the same messages as these in the Scilab console.


Only then we can say the toolbox is loaded successfully.


On the Scilab window, type:


cd /home/rakhi/Mystuff/scilab-5.3.1/share/scilab/contrib/hart_0.4.4


exec loader.sce

If there is no option named Toolbox on the Scilab window (this could happen if you use say Scilab 5.3.2), change your directory.


And go to the contrib folder where hart_0.4.4 is saved.


And then execute the loader.sce file

Open Xcos.

Click on Hart from the Pallette browser.

Click on Comedi

Let us open xcos and check the COMEDI blocks available in the Hart COMEDI palette.
So the HART toolbox installation is now validated.
Show Slide 8 Now let us check this installation by using a DAQ card.
Point 2 in Slide 8 I am using USB DUX FAST, which is a USB based DAQ card.
Open terminal and type the following:


modprobe usbduxfast

Users with kernel versions older than 2.6.30, need to load the COMEDI modules corresponding to the DAQ hardware used.
Open firefox and type:


http://comedi.org/hardware.html


You can find the name of the module to be loaded from the COMEDI website.


It is listed under Driver

Plug in USBDUX FAST.

Type the following in the terminal to ensure that all users have the privilege to read and write into COMEDI devices.

This needs to be done as a super user:

chmod a+rw /dev/comedi*

This needs to be done each time you restart your computer.

You can also ask the OS to do this automatically after each reboot, if you wish to do so.

Plug in USBDUXFAST now.

Type the follwing in terminal:


dmesg | grep comedi

Type dmesg pipe grep comedi on the terminal

You can see that USBDUXFAST is recognised as a COMEDI device.


So the COMEDI suite installation is also validated.

Show Slide 9 So in this tutorial, we have learnt how to install the required packages
Point 2 in Slide 9 And how to verify the installation for using DAQ with Scilab
Show Slide 10 Spoken tutorial is a part of Talk to a Teacher project.



Point 2 in Slide 10 This is supported by National Mission on Education

through ICT, MHRD, Govt of India.

Point 3 in Slide 10 More information on this mission is available at :

http://spoken-tutorial.org/NMEICT-Intro

Hope you found this tutorial useful.


This is Rakhi from IIT Bombay signing off. Thanks for joining.

Contributors and Content Editors

Manivel