You are on page 1of 9

2016

FFT Plot - MicroDAQ

Salaideva Thirumani
Tenet Technetronics

Tenet Technetronics 1
Application Notes

Contents
Introduction 2
Hardware employed..

Software employed

Steps

Scilab script 5
Output graph...

Tenet Technetronics | Varsity


#9/3, Shree Lakshmi Complex, 2nd Floor, Opp. To Vivekananda Park, Girinagar, Bangalore - 560085.
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com

Tenet Technetronics 2
Application Notes

Introduction:
In this application note we are combining combine real-time DSP processing
with standard Scilab script. In examples you can find fft_demo.sce script which
utilizes this XCos model to compute FFT. This is an analog loop example,
AI1(analog input 1) and AO1 (analog output 1 needs) to be wired to see result
on FFT plot. Generated DSP application is running with 5kHz frequency, it
calculates sine waveform which is generated at the DAC output. Data from
ADC is used in scipt to calculate FFT with standard Scilab fft function.
MicroDAQ

MicroDAQ is an ideal platform for developers, scientists and geeks


involved in real-time measurement and control development. The platform
supports design flows from popular model based tools like SCILAB, MATLAB, and
LABVIEW. The user has the choice to either go with a complete open source
software toolchain or with the existing access to proprietary tools in the house.

MicroDAQ Toolbox
MicroDAQ toolbox combines Scilab/XCos environment with Embedded
Solutions MicroDAQ real-time control measurement system equipped with TI
C6000 DSP. Module extends Scilab by allowing user to automatically generate
DSP applications directly from XCos scheme. User can use custom XCos blocks
which gives access to MicroDAQ hardware (ADC, DAC, DIO, PWM, UART,
Quadrature Encoder). Generated DSP application utilizes SYS/BIOS real-time
operating system combined with code generated from XCos scheme.

Tenet Technetronics | Varsity


#9/3, Shree Lakshmi Complex, 2nd Floor, Opp. To Vivekananda Park, Girinagar, Bangalore - 560085.
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com

Tenet Technetronics 3
Application Notes

Libraries of blocks allow seamless to create Models/Diagrams in either


XCOS/SIMULINK/NI Labview and also create optimized C-Code, Compile and
link with the target compiler and download it for deployment. In addition to this
the platform allows for high frequency real-time data acquisition to capture or
tune parameters from the hardware in real-time.

Hardware employed:

MicroDAQ E1100
Power adopter 5V 2A
USB CABLE
Ethernet cable
Analog sensor (LDR breakout)

Software employed:

SCILAB 5.5
Code composer studio 5.5

MicroDAQ E1100:
The MicroDAQ E1100/E1100 is a DSP real-time control measurement device
designed to solve complex problems.This device combines TI C6000
fixes/floating point DSP core and an ARM9 core. The MicroDAQ E1100 is
equipped with up to 8 channel analog input with a sample rate of upto 166
KSPS.
Tenet Technetronics | Varsity
#9/3, Shree Lakshmi Complex, 2nd Floor, Opp. To Vivekananda Park, Girinagar, Bangalore - 560085.
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com

Tenet Technetronics 4
Application Notes

Steps:
Step 1: Open Scilab demonstrations -> MicroDAQ -> fft_script
Step 2: Connect the blocks and hardwire A01-AI1 through jumper to
feed the DAC output of the summation of two sine wave to the ADC
channel.

Tenet Technetronics | Varsity


#9/3, Shree Lakshmi Complex, 2nd Floor, Opp. To Vivekananda Park, Girinagar, Bangalore - 560085.
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com

Tenet Technetronics 5
Application Notes

Step 3: Open Scilab script and run the simulation.

Program:
// Script execution duration in seconds
TIME = 20;
// build DSP binary from Xcos model
mdaq_dsp_build(mdaq_toolbox_path() + filesep() + "examples" + filesep() +"fft_demo.zcos");
// Start DSP application
result = mdaq_dsp_start('fft_demo_scig\fft_demo.out');
if result < 0 then
abort;
end
// Register signal ID and signal size
result = mdaq_dsp_signal(123, 1);
if result < 0 then
disp("ERROR: unable to register signal");
abort;
end
first_time = 1;
a = [];
// Process data from DSP
sample_count = 500;
for i=1:(10 * TIME)
[result, s] = mdaq_dsp_signal_read(sample_count);
if result < 0 then
disp("ERROR: unable to read signal data!");
abort;
end
t = 0:1/sample_count:1;
N=size(t,'*'); //number of samples
y=fft(s');
f=sample_count*(0:(N/2))/N; //associated frequency vector
n=size(f,'*');
if first_time == 1 then

Tenet Technetronics | Varsity


#9/3, Shree Lakshmi Complex, 2nd Floor, Opp. To Vivekananda Park, Girinagar, Bangalore - 560085.
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com

Tenet Technetronics 6
Application Notes
clf()
plot(f,abs(y(1:n)))
first_time = 0;
a = gca();
else
a.children.children.data(:,2) = abs(y(1:n))';
end
end
// Stop DSP execution
mdaq_dsp_stop();

Output:
Since this experiment is carried out E1100 which will not provide
negative voltage we changed sine waves amplitude and
frequency to get the fft plot.

Sine block 1 characteristics

Tenet Technetronics | Varsity


#9/3, Shree Lakshmi Complex, 2nd Floor, Opp. To Vivekananda Park, Girinagar, Bangalore - 560085.
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com

Tenet Technetronics 7
Application Notes

Sine block 2 characteristics

Tenet Technetronics | Varsity


#9/3, Shree Lakshmi Complex, 2nd Floor, Opp. To Vivekananda Park, Girinagar, Bangalore - 560085.
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com

Tenet Technetronics 8
Application Notes

If we need to use negative voltages then we have to use E2000


series.

Tenet Technetronics | Varsity


#9/3, Shree Lakshmi Complex, 2nd Floor, Opp. To Vivekananda Park, Girinagar, Bangalore - 560085.
Ph. No: 080-26722726., Website: www.tenettech.com, Email: info@tenettech.com