Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

REPORT 4: Data acquisition using MATLAB

1st Milton Arroyave, 2nd Marily Hincapie, 3rd William Martinez, 4th Daniver Leon
Grupo n°1
(milton.arroyave, marily.hincapie, willian.martinez, d.leon)@.utp.edu.co
Electrical Engineering Program- Measurement and instrumentation lab
Universidad Tecnológica de Pereira
March 14 of 2023

Abstract—In this practice a DAQ was used to acquire signals to be read by the converter. For this purpose, this circuit has
generated in Matlab in the first part, then in the second part the ability to amplify or reduce the magnitude of the signal
audio signals were acquired corresponding to the recording of based on the correct value, filtering it magnitude of the signal
the musical note LA, at different frequencies, this was possible
thanks to the Matlab script which allows to visualize the graphs based on the correct value, filtering it by eliminating improper
corresponding to the acquired signal in the time and frequency signal peaks and keeping them stable, and isolating external
domain, this allowed to identify the fundamental frequency of disturbances that affect the collection of the signals.[1]
each recording and its harmonics. Finally, a recording was taken
in order to reconstruct it identifying the harmonics with greater These cards are commonly used in industrial control and
magnitude and at what frequency they occur, this in order to
reconstruct the signal and that the captured spectrum and the monitoring applications, laboratory instrumentation, prototype
reconstructed spectrum are as similar as possible. testing and process control systems. Data acquisition boards
Index Terms—Generate, acquire, signals, Matlab, acquisition take a signal from a sensor (analog system), and that signal
board, programming, harmonic analysis, musical notes, charac- is transformed into data that can be recorded and recognized
terization, information, instrumentation, measurement, parame- by a digital system so that a user can read it and perform
ters.
tasks. They consist of three elements: The signal conditioning
circuit, followed by the analog-to-digital converter (ADC)
I. R ESUMEN
and finally the informational bus.[2]
En esta práctica se utilizó una DAQ para adquirir señales
generadas en Matlab en la primer parte, posteriormente en la Data acquisition is the process of measuring an electrical
segunda parte se adquirieron señales de audio correspondientes or physical phenomenon such as voltage, current, temperature,
a la grabación de la nota musical LA, a diferentes frecuencias pressure or sound. A DAQ system consists of sensors, DAQ
esto fue posible gracias al script de Matlab el cual permite measurement hardware and a PC to store and process the
visualizar las gráficas correspondientes a la señal adquirida data. Compared to traditional measurement systems, PC-based
en el dominio del tiempo y la frecuencia, esto permitio DAQ systems leverage the processing power, productivity,
identificar la frecuencia fundamental de cada grabación y visualization and connectivity abilities of industry standard
sus armónicos. Finalmente se tomo una grabacion cualquiera PCs providing a more powerful, flexible and affordable mea-
con el fin de reconstruirla identificando los armonicos con surement solution.
mayor magnitud y en que frecuencia se dan, esto con
el fin de reconstruir la señal y que el espectro capturado III. C ONTENT
y el espectro reconstruido sean tan parecidos como sea posible.
A. Report of practice
1) Part 1: Generating a signal and capturing it with the
II. I NTRODUCTION same DAQ:
The data acquisition card is a hardware device that acts 1) The terminals were connected AO-0 with AI-0+ and
as an interface between a computer device that acts as an AGND with AI-0- as shown in figure 1.
interface between a computer and the physical physical signals 2) A sinusoidal signal was generated with routine MyPrat-
from sensors on the plant floor. It transforms the analog ice21.m as follows:
analog codes provided by the instruments into digital signals
that can be digital signals interpretable by a computer through x(t) = 3 · Sin(2π60t + θ) (1)
an analog-to-digital converter.In addition to this component,
they are usually provided with a signal conditioning circuit From which figure 3 was acquired.
to eliminate noise and a bus connector to the computer. All 3) Making the necessary changes to the routine MyPrat-
these features are redundant in any other type of DAQ device. ice21.m to simultaneously generate the signal in the
following way:
The conditioning circuit is necessary to eliminate the
◦ ◦ ◦
instability characteristic of this type of signal and to be able x(t) = 5Sin(2π60t + 10 ) + 2Sin(2π180t + 60 ) + 1Sin(2π300t − 30 ) (2)
Fig. 1. Connection NI-myDAQ

Fig. 4. Signal generated 2

Fig. 2. Signal generated 1

Fig. 5. Signal acquired 2

and as can be seen in figure 6.


2) The files in the Instrument 2 folder were listed as shown
in Figure 7.
3) The LA 5 octave of 880Hz was chosen and the corre-
sponding frequency domain plot of instrument 1 and 2
was obtained in Figures 8 and 9 respectively.
4) It can be observed that the fundamental frequency of
the two signals are very close, being the frequency of
instrument 1 closer to 900kHz and that of instrument 2
Fig. 3. Signal acquired 1 closer to 880Hz. With respect to the magnitudes they
are also very similar being the magnitude of instrument
2 a little larger than that of instrument 1.
The signal in Figure 5 was acquired. 5) The difference between the same musical note generated
with different instruments is almost imperceptible.
2) Part two: Audio signal analysis: The reason why the difference between the same musical
1) The 1x1 cable plug connection was made as indicated note generated with different musical instruments is
Fig. 8. Instrument 1 - LA 5 (880Hz)
Fig. 6. Connection plug

Fig. 9. Instrument 2 - LA 5 (880Hz)

distinguishes the sound of different instruments.


Fig. 7. Folder instrument 2 - Organization Since the fundamental frequency is the same for a
specific musical note, different instruments playing the
same note will have different overtones, which affects
almost imperceptible is due to the physical properties the timbre of the sound. However, the difference between
of sound. When a musical note is produced, sound overtones can be very subtle and difficult for the human
waves are generated that contain information about the ear to detect, especially if the note is short or played in
frequency, amplitude and sound quality of the note. a middle register. In addition, the human brain can be
The frequency determines the pitch of the musical note, fooled by sight, which means that if you see a musician
and is the property that remains constant for a specific playing a particular instrument, your brain may interpret
musical note, for example, the note LA4 has a frequency the sound differently than if you hear the same sound
of 440 Hz in standard pitch. Musical instruments come without seeing the musician producing it.
in different shapes and sizes, which affects the acoustic That is, the difference between the same musical note
properties of the sound waves they produce. This means generated with different instruments can be subtle due
that different instruments can produce sounds with dif- to the physical properties of the sound and the interpre-
ferent combinations of harmonics, which are multiples tation of the human brain.
of the fundamental frequency. These overtones influence 6) To reconstruct the chosen signal, the harmonics were
the timbre of the sound, which is the property that characterized in terms of frequency and magnitude.
Fig. 10. Captured signal sound spectrum LA Fig. 12. Spectrum of the reconstructed signal

The captured and reconstructed spectrum will now be fundamental frequency.


compared. The Fourier transform allows decomposing this complex
signal into its corresponding spectral components, and
reconstructing the signal from these components allows
recovering the complete spectral information of the
original signal. Although the individual harmonics may
have different amplitudes and phases compared to the
original signal, the sum of all harmonics produces a
signal that is very similar to the original sound, because
most sounds in everyday life are composed of multiple
harmonics related in a simple way.

B. Answer to the questions proposed


1) What are the important considerations for data
acquisition, such as sampling rate, noise and signal
quality?

R//=

Fig. 11. Spectrum of the captured signal • Sampling Frequency


The sampling rate is the number of times the signal
7) When reconstructing a sound with the Fourier transform, is sampled per unit time. It is important to ensure
a mathematical technique is used to decompose the that the sampling rate is high enough to adequately
sound into its spectral components, in the frequencies capture the signal characteristics. Too low a sam-
that compose it. These spectral components are known pling rate can cause aliasing, which is an effect
as harmonics and each has an associated amplitude and where frequencies above half the sampling rate are
phase. confused with lower frequencies, which can distort
The reason why the reconstruction of the sound with the signal.
the Fourier transform resembles the original sound is • Noise
because most of the sounds we hear in everyday life Noise is any interference or unwanted signal that
are composed of a set of frequencies that are integer is added to the measured signal. It is important
multiples of a fundamental frequency. For example, in a to minimize noise as much as possible, as it can
sound produced by a guitar, the fundamental frequency affect the quality and reliability of the acquired data.
corresponds to the lowest string being played, and Measures can be taken to reduce noise, such as
the harmonics correspond to integer multiples of this using filters and minimizing sources of interference.
• Signal Quality a) Data Acquisition Toolbox: This is the main Matlab
Signal quality refers to the fidelity with which the toolbox for data acquisition. It provides a wide
acquired signal represents the actual signal. It is variety of functions and tools for data acquisition,
important to ensure that the signal quality is high from device configuration to signal analysis.
enough for the data to be accurate and reliable. Mea- b) Simulink: Matlab also offers the possibility to
sures can be taken to improve signal quality, such as program real-time data acquisition by creating
the use of amplifiers and interference suppression. Simulink models. Simulink provides predefined
• Dynamic Range blocks that can be used to build models of real-
Dynamic range refers to the difference between time data acquisition systems.
the lowest and highest level that can be accurately c) Instrument Control Toolbox: This Matlab toolbox
measured. It is important to ensure that the dynamic provides tools for measurement instrument control
range is wide enough to adequately capture all and test automation. It can be used in conjunction
variations in the signal. with the Data Acquisition Toolbox to program
• Sensitivity real-time data acquisition.
Sensitivity refers to the ability of a measurement
system to detect small variations in the signal. It
is important to ensure that the sensitivity is high
3) What are the challenges or limitations of data acquisition
enough to detect any significant changes in the
with Matlab, and how can they be addressed?
signal.
R//=
2) How can the data acquisition process be automated in
Matlab? What tools are used to program real-time data
acquisition?
• Limited sampling frequency: The sampling rate
R//= is the number of samples per second taken from
In Matlab, you can automate the data acquisition process a signal. Insufficient sampling rate can result in a
using the Data Acquisition (DAQ) toolbox. This toolbox loss of information and inaccurate representation of
provides a set of functions and tools for real-time data the signal. To address this problem, the sampling
acquisition. The following are some general steps to rate can be increased, however, this may require
automate the data acquisition process in MATLAB using increased processing and storage capacity.
DAQ: • Noise: Noise can be a problem in data acquisition,
especially in noisy environments or on weak signals.
a) Configure input/output devices: Before acquiring One way to address this is by using signal filtering
data, the required input and output devices must techniques, such as low-pass filters or adaptive
be configured. This is done using DAQ functions filters, which can help reduce noise and improve
and tools that allow configuring the input/output signal quality.
channels, sampling frequencies, signal type, among • Hardware limitations : Data acquisition can be
others. limited by available hardware, such as input and out-
b) Define the acquisition parameters: Once the in- put capabilities of devices, accuracy of analog-to-
put/output devices have been configured, the ac- digital converters, among other factors. To address
quisition parameters must be defined, such as ac- this problem, high quality input and output devices
quisition duration, sampling frequency, number of with larger capacities can be used, and calibration
samples, etc. techniques can also be used to improve accuracy.
c) Acquire data: The DAQ data acquisition function • Processing and storage time : Data acquisition
is used to start data acquisition in real time. This can generate large amounts of data, which can
function returns the acquired data in an object that require significant processing and storage capacity.
can be analyzed later. Data compression techniques, such as lossless signal
d) Analyze the data: Once the data has been compression, can be used to address this problem,
acquired, it can be analyzed using MATLAB and the algorithms used can also be optimized to
signal processing tools. For example, you can reduce processing time.
apply filters, Fourier transforms, statistical • Multi-channel synchronization: In applications
analysis, among others. that require the acquisition of multiple data chan-
nels, it can be important to ensure synchronization
• To program real-time data acquisition, Matlab DAQ between them. To address this problem, hardware-
functions and tools are used. Some of these tools or software-based synchronization techniques, such
are: as the use of high-precision clocks and event-based
synchronization, can be used.
IV. P ROBLEMS AND DISADVANTAGES [7] C. M. W EI AND Y. H. W U , ”D ESIGN OF DATA ACQUISITION S YSTEM
U SING MATLAB AND MY DAQ,” 2017 IEEE I NTERNATIONAL
There were no inconveniences in the performance of the C ONFERENCE ON I NFORMATION , C OMMUNICATION AND
E NGINEERING (ICICE), X IAMEN , 2017, PP. 43-47, DOI :
laboratory practice. 10.1109/ICICE.2017.8279744.

V. C ONCLUSIONS [8] M. J. ATKINSON , T. A. H ABETLER AND R. G. H ARLEY, ”A


HIGH - SPEED , HIGH - RESOLUTION DATA ACQUISITION SYSTEM FOR
MOTOR DRIVE TESTING USING NI- MY DAQ AND MATLAB,”
• Data acquisition is a critical task in many engineering
2014 IEEE E NERGY C ONVERSION C ONGRESS AND E XPOSITION
and science applications, and may require a combination (ECCE), P ITTSBURGH , PA, 2014, PP. 3672-3678, DOI :
of specific hardware and software to obtain accurate and 10.1109/ECCE.2014.6953931.
reliable results.
[9] A. A MMAR , N. B. S AHNOUN , H. C HAOUCHI AND M. A BID , ”R EAL -
• The NI-myDAQ tool provides a complete, easy-to-use TIME IMPLEMENTATION OF AN AUTOMATIC VOLTAGE REGULATOR FOR
platform for data acquisition, including a variety of A SYNCHRONOUS GENERATOR USING MATLAB AND NI- MY DAQ,”
analog and digital inputs and outputs, as well as data 2016 3 RD I NTERNATIONAL C ONFERENCE ON C ONTROL , D ECISION
AND I NFORMATION T ECHNOLOGIES (C O DIT), S AINT J ULIAN ’ S ,
acquisition and analysis software. 2016, PP. 1132-1137, DOI : 10.1109/C O DIT.2016.7593587.
• Matlab is a very powerful and widely used programming
tool for data acquisition, with a wide variety of functions [10] J. D. M URRAY, ”DATA ACQUISITION WITH MATLAB: FROM
SOUND WAVES TO SEISMOGRAPHS ,” C OMPUTING IN S CIENCE
and tools for signal analysis. E NGINEERING , VOL . 11, NO . 3, PP. 38-49, M AY-J UNE 2009, DOI :
• The combination of NI-myDAQ and Matlab provides an 10.1109/MCSE.2009.52.
effective and efficient solution for real-time data acqui-
[11] P R ÀCTICA 4:A DQUISICI ÓN DE DATOS USANDO MATLAB Y INETH
sition, with the ability to process large amounts of data M ARTINEZ A RMERO , E DUARDO G IRALDO, Universidad Tecnològica
and provide high measurement accuracy. de Pereira
• Data acquisition can present several challenges and lim-
itations, such as limited sampling frequency, noise and
signal quality, but these can be addressed using specific
techniques and tools.
• In general, data acquisition using Matlab and NI-myDAQ
can be a valuable tool for a wide range of applications,
including process monitoring and control, biological and
biomedical signal measurement, and general science and
engineering research.

VI. B IBLIOGRAPHY
R EFERENCES
[1] R. L OPEZ V ILLANUEVA , D ISE ÑO DE UNA TARJETA DE ADQUISICI ÓN
DE DATOS .

[2] “U SO DE M YDAQ - PORTAL ISCATEC ,”


G OOGLE S ITES : S IGN - IN . [O NLINE ]. AVAILABLE :
HTTPS :// SITES . GOOGLE . COM / SITE / PORTALISCATEC / USO - DE - MYDAQ .
[ACCESSED : 05-M AR -2023].

[3] “P RODUCT,” NI. [O NLINE ]. AVAILABLE : HTTPS :// WWW. NI . COM / ES -


CO / SHOP / HARDWARE / PRODUCTS / MYDAQ - STUDENT- DATA -
ACQUISITION - DEVICE . HTML . [ACCESSED : 05-M AR -2023].

[4] R. S INGH , S. L. T IKU AND D. K. S HARMA , ”ACQUISITION OF ECG


SIGNALS USING NI- MY DAQ AND ITS ANALYSIS IN MATLAB,” 2016
I NTERNATIONAL C ONFERENCE ON E LECTRICAL , E LECTRONICS ,
AND O PTIMIZATION T ECHNIQUES (ICEEOT), C HENNAI , 2016, PP.
1185-1189, DOI : 10.1109/ICEEOT.2016.7755236.

[5] “A NLISIS Y SINTESIS DE FOURIER ,” F OURIER A NALYSIS AND


S YNTHESIS . [O NLINE ]. AVAILABLE : HTTP :// HYPERPHYSICS . PHY-
ASTR . GSU . EDU / HBASEES /AUDIO /F OURIER . HTML . [ACCESSED :
05-M AR -2023].

[6] “N I MYDAQ SUPPORT FROM M ATLAB ,” H ARDWARE S UPPORT


- MATLAB AMP ; S IMULINK . [O NLINE ]. AVAILABLE :
HTTPS :// LA . MATHWORKS . COM / HARDWARE - SUPPORT / NI -
MYDAQ . HTML . [ACCESSED : 05-M AR -2023].

You might also like