ECE 495- Project 1- Configure Tools William Johnson Auston Thompson Paul David

ECE 495- Project 1- Configure Tools
William Johnson
Auston Thompson
Paul David
Ricky Sease
David McCormmick
Executive Summary
The goal of project 1 is for the group to get familiarized with the the MATLAB simulink system
and the xPC Target. The team will be utilizing the Qunaser Q4 board, which is a real time cloosed loop
system. This means that the board constantly monitors the current state of the system and provides
feedback to change how the system will behave in the future. The project takes the approach of slowly
building a comfort level between the group members and the MATLAB xPC Target setup, by setting
simple goals to start with and slowly building on the complexity. The team will start by learning basic
procedures used to program the Qunaser Q4 by having it produce sine and square waves. To get a better
understanding of how the simulink system works the team will make adjust the parameters of the wave
forms, including the frequency of the wave forms and the port that the waves are produced on. By the end
of the project the team will learn how to connect an encoder shaft and read information from it.The
following flow chart shows in general what stages the group went through.
Connect to the
xPC Target
Produce 100hz
Sine wave
Modify sine wave
to 2khz
Produce Square
wave using digital
output ports
Count Square
waves from digital
out using encoder
Count Square
waves from
encoder shaft
using encoder port
Materials and Methods
1. xPC Target running MATLAB 2012a (32 bit) with Microsoft Visual Pro. 2010. This software
setup will allow for real time closed loop feedback to be performed and is the method by which
all software will be run on the Quanser.
2. Qunaser Q4 breakout board. This break out board will allow for the Target PC to receive inputs
and give outputs. It has 4 analog inputs and outputs, 16 digital ports which can be configured for
either input or output, and 5 pin DIN encoder input ports that will allow for data to be transmitted
in multiple ways.
3. For creating loopback controls RCA, 5 pin DIN, and 16 pin ribbon cables were used to connect
between different input and output ports. Often times chords were re-wired to adapt from one
type of input to another. So, a wave could be produced using the digital ports but be read using an
RCA connector on the analog ports. The encoder was wired through the 5 pin DIN connectors
using the pin outs supplied for the encoder and the Quanser board shown in figures 1 and 2
respectively below.
Figure 2: Quanser pinout
Figure 1: Encoder Wiring
Discussion and Results
1. In the first part a 100hz sine wave was created using Simulink and was shown on oscilloscopes
using the analog inputs and an RCA connector. In order to get the sine wave look appropriate the
number of samples was increased to 10,000 and the decimation was decreased to 1. The resultant
sine wave is shown in figure 3.
2. In the second part a sine wave was produced again but this time the frequency was set to 2khz.
Because of the significant increase in frequency, the dine wave isn’t as well defined. The
resulting wave form is shown in figure 4.
3. In part 3 the digital ports were used to create a 100hz square wave. A 16 pin ribbon cable was
wired to an RCA adaptor to allow the square wave to be read from the analog inputs. Flaws in
making the adaptor could have possibly introduced noise into the system and lead to the
imperfections in the square wave. The results are in figure 5.
4. In part 4 the digital port was wired to an encoder input port which was used to count the number
of square waves. The pin out for the Quanser shown in figure 2 was used here. The target scope
simply displayed the count of square waves numerically and the host scope displayed this same
information graphically. Because the ribbon cable supplied no direction signal the encoder
subtracted. Results in figure 6.
5. In the last part an encoder shaft was wired into the encoder input port as talked about above.
Turning the shaft one way causes the encoder to add to the count while turning the shaft in the
opposite direction causes subtraction. The results of this behavior is displayed in figure 7.
Figure 3: 100hz Sine Wave
Figure 4: 2khz Sine Wave
Figure 5: 100hz Square Wave
Figure 6
Figure 7
After testing the system it was shown that MATLAB and Simulink are powerful tools that will be relied
on in building devices that require real time closed loop feedback. All of the experiments produced
expected outcomes and helped build an understanding among the team members on how to use the
MATLAB Simulink system. The encoder shat portion showed how the Quanser board could be used to
interact with part created with the laser cutter, and in conjunction these two tools will be used to solve the
mine sweeper task for the semester.
[1] ECE 495. Encoder Wiring Diagrams [Online]. Available: