Studying Digital Signal Processing On Arduino Based Platform
Studying Digital Signal Processing On Arduino Based Platform
Abstract. Digital Signal Processing (DSP) has become today an integral part of the basic skills required for
scientists and engineers of many specialties. Most courses offer only using for DSP laboratory classes the Matlab
system. This approach has the disadvantage it excludes the students acquisition of the basic skills of software
development for implementation of DSP algorithms based on real digital devices. DSP is informative
technologies in real-time and in most cases they use the closest to the hardware Assembler and C/C++
languages. To eliminate this drawback the authors propose using for DSP laboratory classes the known Arduino
platform. Nowadays, this platform is one of the most affordable budgetary and rather universal decisions
produced on popular AVR microcontrollers. It allows using of the most popular in DSP Assembler and C++
languages. As an example the structure of the laboratory lesson: Development and research of the moving
average filter in Matlab and Arduino is presented. This filter is the most common. Embodiments of the filter
developed in Matlab and ArduinoUno-based controller are given. And oscillograms of the signals at the input of
the filter and at its output are shown. Integrated using of the Matlab system and Arduino platform contributes to
a better understanding of theoretical fundamentals of DSP, and more importantly, influence development of
practical skills in design and development of microprocessor systems for DSP.
Keywords: lab work, virtual-real method, Matlab, moving average filter, microcontroller, program.
Introduction
Digital Signal Processing (DSP) is one of the most powerful technologies that will determine the
further development of science and technology in the XXI century. DSP is a set of the mathematical
methods, the algorithms, and the techniques that are used to control the signals after they have been
converted into digital form. Signal processing can solve many tasks, such as: enhancement of the
image quality, recognition and synthesis of speech, compression of data for storage and transmission,
etc. Revolutionary changes have already happened in a broad range of activity spheres:
communications and broadcasting, radar and sonar, high quality sound reproduction and image
compression, in medicine, in monitoring and control systems, etc. [1]. These changes have a direct
affect to engineering education. In this article, we will focus on improving the DSP training methods.
This is important, because DSP is one of the most topical disciplines for the modern engineer
development.
Note that most DSP courses have offered using for lab works only the program Matlab. Virtual
lab, has a lack excludes students acquisition of practical software development skills to implement
DSP based on real-programmable systems (PS). DSP is a real-time information technology. In most
cases for implementation DSP based on real-PS C/C++ and Assembler programming languages are
used. Popularity rating of these languages is above Matlab [2]. The purpose of this article is to show
the ability of using Arduino platform for real lab works on DSP.
Arduino platform (hereinafter simply Arduino) contains an extensive assortment of modular
hardware and software with an open source license, continues to develop and is supported by
sufficient amount of literature [3-5]. Arduino is the most affordable budget solution, implemented on
the popular AVR microcontrollers and allows using C/C++ and Assembler languages the most
requested for DSP.
The DSP study process should be divided into two stages. The first stage is studying DSP
algorithms using computer-aided design (CAD) systems, for example, the Matlab program [6]. The
second step implementation of DSP algorithms developed in Matlab on the base, e.g., Digital Signal
Processor. However, Digital Signal Processor is quite complicated PS for beginners to learn DSP [7].
Therefore, the authors suggest for the initial stage of DSP studying to use Arduino as a simplified
analog of the Digital Signal Processor. Arduino hardware is constructed on AVR microcontrollers of
Atmels company [3-5]. It is a well-known microcontroller family, on the basis of which the
Microprocessor Technique is studied in many universities [8-11]. In addition, Arduino software is
supported by such program environments as Matlab, AVR Studio 7 (for 8-bit and 32-bit AVR
microcontrollers) and new Windows 10 operating system [12-14].
236
ENGINEERING FOR RURAL DEVELOPMENT Jelgava, 25.-27.05.2016.
Fig. 1. Model of the system for forming the input signal samples
Range generated numbers from 0 to 255 are set in URN settings. This range is convenient because
the maximum decimal number 255 is equivalent to the maximum value of 8-bit binary code. To store
this code, you can use 8-bit registers, which simplifies the task solution while implementing DSP
algorithms in Assembler.
237
ENGINEERING FOR RURAL DEVELOPMENT Jelgava, 25.-27.05.2016.
Fig. 2 shows an input signal consisting of 30 samples. The values of the input signal samples are
read visually from the oscillogram of the Scope block (Fig. 1).
238
ENGINEERING FOR RURAL DEVELOPMENT Jelgava, 25.-27.05.2016.
Fig. 5. Oscillogram of signals: CH1 - the filter input signal; CH2- the filter output signal
The following Fig. 6 shows the program 2 fragment for a 4 point moving average filter that is
realized on the Arduino Uno controller.
We form the sample values of the input and output filter signals according to scillograms and
process them in Matlab. As a result, we obtain for the input signal of the filter the mean value
i 2.7 V and the standard deviation i 1.4 V; for the output signal, respectively 2.5 and o
0.5 V. We define the CV for the input and output signals of the filter: Ci = i / i = (1.4 / 2.7)100 %
52 %;
239
ENGINEERING FOR RURAL DEVELOPMENT Jelgava, 25.-27.05.2016.
o = o/o = (0.5/2.5)100 % 20 %. In this case, the noise reduction factor by the Arduino-based
filter is Ca = Ci / Co = 52/20 2.5.
{ // Loop Start
x1 =
x2; // Send the second sample into a memory cell of the first sample
x2 =
x3; // Send the third sample into a memory cell of the second sample
x3 =
x4; // Send the fourth sample into a memory cell of the third sample
x4 =
analog Read(ADC0); // Read from ADC the conversion result of the next sample
// and send its value into a cell memory of the fourth sample
x4 = x4/4; // Convert 10-bit binary code to an 8-bit
y = (x1+x2+x3+x4)/4; // Calculate the average value of the last four samples
PORTD = (y); //and output this value to the parallel port PD
} // Go to the top of the loop
Fig. 6. Fragment of Program 2
Conclusions
Arduino platform can and should be used to study the DSP course. The results presented in this
paper prove that there is an opportunity of developing real DSP systems on the base of this platform.
This fact contributes to realization of the important in educational process scientific and didactic
principle from theory to practice. The benefits of real lab work compared with virtual ones are
obvious and do not require evidence, sufficient to recall the words of Confucius: I hear and I forget, I
see and I remember, I do and I understand. Reasonable integration in lab works the virtual and real
techniques is contributing to deeper understanding of the studied issues.
References
1. Stewen W.S. The Scientist and Engineers Guide to Digital Signal Processing. Second edition.
San Diego: California Technical Publishing, 1999. 650 p.
2. TIOBE Index for February 2016 [online] [12.02.2016]. Available at:
http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html
3. Igoe . Making Things Talk: Using Sensors, Networks, and Arduino to see, hear, and feel your
world. OReilly Media, 2011. 496 p.
4. .. Arduino (Projects using Arduino
controller). 2nd ed. SPb.: BHV-Petersburg, 2015. 446 p. (In Russian).
5. Blum J. Exploring Arduino: Tools and Techniques for Engineering Wizardry. Wiley, 2013. 384 p.
6. .., .., .., ..
MATLAB: . (Digital Signal Processing and MATLAB: textbook).
SPb.: BHV-Petersburg, 2014. 512 p. (In Russian).
7. Hochgraf . Using Arduino To Teach Digital Signal Processing. Reviewed Paper of ASEE
Northeast Section Conference, March 14-16, 2013, Norwich University. [online] [12.02.2016].
Available at: http://asee-ne.org/conferences/aseene/2013/index.php/aseene/aseene2013/paper
/view/235/24.
8. . . AVR. : . (AVR
Microcontrollers. Workshop for beginners: tutorial). Moscow: Publ. house Bauman Moscow State
Technical University, 2013. 280 p. (In Russian).
240
ENGINEERING FOR RURAL DEVELOPMENT Jelgava, 25.-27.05.2016.
241