Documente Academic
Documente Profesional
Documente Cultură
In this lab experiment, the student will be introduced to the concept of data acquisition using the analog
input AI pins available on the myRIO. Analog input pins are directly connected to the FPGA. This
experiment presents different techniques for sampling analog signals. The LM35 temperature sensor is
used for its simplicity and linearity.
Objectives
Understand myRIO analog functions and data acquisitions techniques.
Understand myRIO analog ADC sampling rate and timing specifications
Understand LM35 temperature sensor and functionalities.
Hardware Architecture
Overview
The NI myRIO-1900 has analog input channels on myRIO Expansion Port (MXP) connectors A and B, Mini
System Port (MSP) connector C, and a stereo audio input connector. The analog inputs are multiplexed
to a single analog-to-digital converter (ADC) that samples all channels at an aggregate sample rate of
500KS/s with 12-bits resolution. MXP connectors A and B have four single-ended analog input channels
per connector, AI0-AI3, which you can use to measure 0-5 V signals. MSP connector C has two high-
impedance, differential analog input channels, AI0 and AI1, which you can use to measure signals up to
±10 V. The audio inputs are left and right stereo line-level inputs with a ±2.5 V full-scale range. Figure 1
shows the relevant hardware architecture.
ADC on the myRIO returns raw data. You can use the following equations to convert raw data values to
volts:
Where Raw Data Value is the value returned by the FPGA I/O Node, LSB Weight is the value in volts of
the increment between data values and the smallest level an ADC can convert, Nominal Range is the
absolute value in volts of the full, peak-to-peak nominal range of the channel, and ADC Resolution is the
resolution of the ADC in bits. (ADC Resolution = 12.)
This data acquisition experiment uses the FPGA default personality and standard myRIO project. The
following experiment introduces the analog input libraries and express Vis while highlighting the most
common design and timing problems.
Connect the temperature sensor with the output pin (2) to the MXPB pin AI0, the first pin to 5V VCC and
the third pin to ground (Use the analog GND pin noted AGND for analog inputs).
Express VIs
An Express VI is a VI whose settings you can configure interactively through a dialog box. Express VIs
appears on the block diagram as expandable nodes with icons surrounded by a blue field. This part uses
the Analog input express VI for data acquisition. The analog input express VI, interfaces directly with the
FPGA’s VI and provides the user one sample per iteration.
Create a new project using the standard myRIO project (discussed in Lab 1) and save it in the folder
previously created under “myRIOAnalog” save the VI as AnalogBasics.
Modify the block diagram to include an analog input express VI and the data to voltage convers ion
functions for display. Use a numeric indicator and a waveform chart for display. Figure 3 shows the
modified block diagram.
The modified design includes additional shift register to display the timing of each iteration.
Task: Experiment by changing the timing constant connected to the wait VI to ‘5’ and then ‘1’
2) This part is the “Acquire and Process Data”. The following sequence is the core program, it includes a
while loop for continuous operation.
3) The final sequence is the close structure it is used to free allocated memory and channels and reset
the device to its default settings.
Task: Experiment by changing the timing constant connected to the wait VI to ‘5’ and then ‘1’
Warning: The RT main VI is independent from the PC it runs until an error occurs or stopped manually.
Do not close the project before stopping the VI.
The following design includes a for loop structures that iterates from 0 to N -1. A single iteration
represents an acquired sample. The For loop includes a flat sequence structures of two frames. The first
frame holds a more accurate Wait function, from the RT library (RT -> Timing), representing the looping
period in mSecs. The second frame consists of the data acquisition block and operation previously
discussed.
Tips
Use CTRL+SPACE for a quick drop search for a needed function.
Use CTRL+H to display the help window and display additional information
Data representations are identified by colors: Green -> Boolean, Pink -> String, Orange ->
floating point, Blue -> Integers.
Read the device guide and specifications for correct wiring and project design.
Questions
Explain the A/D conversion process and provide clear calculation for a 12-bit ADC with
differential voltage reference (Vref- = -10V and Vref+ = 10V). calculate the LSB and Full scale
range value.
Calculate the conversion function from Raw Data to Voltage for the Temperature sensor using
the previously discussed equations in the overview. (Hint 10mV = 1C).
Identify the Block Diagram components, what are the used functions, VIs and structures?
Indentify the timing functions used; provide a brief explanation of each. Compare the “Wait”
function and “Wait until next multiple”; what is the main difference?
Deduce why an Express VI, placed inside a loop structure, causes timing and synchronization
problems.
Explain the difference between “Single Ended Analog Input” and “Differential Input”; which
mode is supported by myRIO? How many connection pins available?
Pre Lab 3 Questions – PWM and Motors
Research the main operating modes of a BJT transistor. What is the relationship between the
base current and the collector current?
What is the required current to drive a DC motor connected to a 12V source and ground? How
do you drive a motor in different directions (Clock-Wise, Anti-Clock-Wise)?
What is the connection scheme for using a single transistor to drive a DC motor (How is the
motor connected); If the output pin supplies 3.3V TTL what is the value of the resistor R1 placed
at the base of the chosen BJT transistor?
Explain the basics of a PWM technique; what is the relationship between “Period”, “DuctyCyle”
and “Pulse duration”?
Provide an overview of a motor driver (H-Drive) and its benefits in controlling motors and
direction; what is a freewheeling diode? How does it operate in protecting the connected
transistor? Comment on diodes switching speeds.
Lab Report
Submit an individual lab report at the beginning of the next lab session with the following sections and
requirements:
Cover Sheet – Include title, name, class, section, date due, date submitted, and professor and
lab assistant names
Introduction – Summarize the lab procedure in a few sentences. Do not rewrite what is written
in this lab handout.
Design – Explain your design and its purpose, testing results, obstacles encountered and how
you resolved them. Include images.
Conclusion – Discuss your overall experienceand how it relates to digital logic and electronics
concepts.
Post-Lab Questions – Answer all questions completely.
The lab report should be single-spaced, typed, and a minimum of 1½ pages (excluding images). Neatness
and clarity are also required.