QNET MECHKIT Workbook Student
QNET MECHKIT Workbook Student
Quanser Inc.
119 Spy Court
Markham, Ontario
L3R 5H6
Canada
[email protected]
Phone: 1-905-940-3575
Fax: 1-905-940-3576
Acknowledgements
Quanser, Inc. would like to thank the following contributors:
Dr. Hakan Gurocak, Washington State University Vancouver, USA, for his help to include embedded outcomes assessment, and
Dr. K. J. strm, Lund University, Lund, Sweden for his immense contributions to the curriculum content.
Contents
1
Introduction
Sensor Properties
2.1
Resolution
2.2
Range
2.3
Absolute and Incremental
2.4
Analog Sensor Measurement
7
7
7
7
7
9
9
10
12
13
13
13
Pressure Sensor
4.1
Background
4.2
Pressure Virtual Instrument
4.3
Lab 1: Collect Data
4.4
Lab 2: Calibrate Sensor
4.5
Results
14
14
15
16
17
17
Piezo Sensor
5.1
Background
5.2
Lab 1: Data Analysis
5.3
Lab 2: Natural Frequency
18
18
18
18
Potentiometer
6.1
Background
6.2
Potentiometer Virtual Instrument
6.3
Lab 1: Collect Data
6.4
Lab 2: Calibrate Sensor
6.5
Results
19
19
20
21
22
22
Infrared
7.1
7.2
7.3
7.4
7.5
Background
Potentiometer Virtual Instrument
Lab 1: Collect Data
Lab 2: Calibrate Sensor
Results
23
23
24
25
26
26
Sonar
8.1
8.2
8.3
8.4
8.5
Background
Sonar Virtual Instrument
Lab 1: Collect Data
Lab 2: Calibrate Sensor
Results
27
27
28
29
30
30
Optical Position
9.1
Background
9.2
Optical Virtual Instrument
9.3
Lab 1: Collect Data
9.4
Lab 2: Calibrate Sensor
9.5
Results
31
31
32
33
34
34
v 1.0
10
Magnetic Field
10.1
Background
10.2
Magnetic Field Virtual Instrument
10.3
Lab 1: Collect Data
10.4
Lab 2: Calibrate Sensor
10.5
Results
35
35
36
37
38
38
11
Encoder
11.1
11.2
11.3
11.4
11.5
39
39
41
41
42
42
Background
Encoder Virtual Instrument
Lab 1: Analysis of A, B, and I Signals
Lab 2: Encoder Calibration
Results
12
Temperature Sensor
12.1
Background
12.2
Temperature Virtual Instrument
12.3
Lab 1: Collect Data
12.4
Lab 2: Calibrate Sensor
12.5
Results
43
43
45
46
47
47
13
48
48
50
53
54
54
54
55
14
Switch Debounce
Analysis
14.1
Background
14.2
Switches and LEDs Virtual Instrument
14.3
Lab 1: Running the Oscilloscope
14.4
Lab 2: Micro Switch
14.5
Lab 3: Push Button
14.6
Results
56
56
57
58
59
59
60
15
System Requirements
15.1
Overview of Files
15.2
Strain Gage with Flexible Link VI
15.3
Pressure Laboratory VI
15.4
Piezo VI
15.5
Potetiometer VI
15.6
Infrared Sensor Laboratory VI
15.7
Sonar Sensor VI
15.8
Optical Position Laboratory VI
15.9
Magnetic Field Laboratory VI
15.10
Encoder Laboratory VI
15.11
Temperature Laboratory VI
15.12
Switches and LEDs Laboratory VI
15.13
Switch Debounce Laboratory VI
61
61
62
64
66
68
70
72
74
76
78
80
81
84
16
Lab Report
16.1
Template for Content
(Strain Gage with Flexible Link)
85
86
16.2
16.3
16.4
16.5
16.6
16.7
16.8
16.9
16.10
16.11
16.12
16.13
87
88
89
90
91
92
93
94
95
96
97
98
v 1.0
INTRODUCTION
Mechatronics engineering is a cross-disciplinary field that combines mechanical and electronic design in control
systems architecture though the application of computer programming. One of the most useful topics that can be
covered in an introductory mechatronics course is the understanding and application of sensors. Various sensors
are used in all types of industries. For example, in the automotive industry magnetic field transducers are used for
throttle, pedal, suspension, and valve position sensing. In assembly line and machine automation, optical sensors
are used for non-contact position sensing and safety. Piezo film sensors are installed in packages to log vibration
history of a shipment.
The QNET mechatronics sensors (MECHKIT) trainer is shown in Figure 1.1. It has ten types of sensors, two types
of switches, a push button, and two LEDS. This QNET module can be used to teach the physical properties of most
sensors used today, and the techniques and limitations of their application.
There are 12 experiments: strain gage with flexible link, pressure sensor, piezo sensor, potentiometer, infrared,
sonar, optical position, magnetic field, encoder, temperature sensor, switches and LEDs, and switch debounce
analysis. The experiments can be performed independently.
Topics Covered
Strain gauge to measure deflection
Piezo film sensor to measure vibration
Rotary potentiometer to measure position
Pressure and thermistor sensors
Long range sensors: sonar and infrared
Short range sensors: magnetic field and optical
Micro switch, push button, and optical switch
Light emitting diodes (LEDs)
Encoders
Switch debouncing
Prerequisites
In order to successfully carry out this laboratory, the user should be familiar with the following:
Using LabVIEWr to run VIs.
SENSOR PROPERTIES
This section discusses various sensor properties that are often found in technical specifications.
2.1 Resolution
The resolution of a sensor is the minimum change that can be detected in the quantity that is being measured. For
instance a sensor that measures angular position of a motor shaft may only be able to detect a 1 degree change.
Thus if the motor moves 0.5 degrees, it will not be detected by the sensor. Depending on the precision needed for
the application, this may be adequate.
2.2 Range
Range sensors can only take measurements of a target within a certain operating range. The operating range
specifies a maximum, and sometimes also a minimum, distance where the target can be from the sensor in order to
obtain an accurate measurement. Sensors with a small range are the magnetic field and optical position sensors.
Sensor with a relatively larger range are infrared and sonar.
v 1.0
y = ax + b
where a is the rate of change and b is the offset. Variable x is the sensor output signal and y is the measurement,
e.g. for the potentiometer x would be the voltage measured by the sensor and y would be the angular measurement
(in either degrees or radians). Other types of sensors need to be characterized by more complex relationship such
as polynomial
y = ax2 + bx + c
(2.2)
y = aebx
(2.3)
or exponential
3.1 Background
A strain gage measures strain, or deflection, of an object. As shown in Figure 3.1, in the QNET mechatronic sensors
trainer a strain gage is used to measure the deflection of a flexible link. As the link bends, the resistance of the strain
gage changes.
Figure 3.1: Strain gage measuring deflection of flexible link on QNET mechatronic sensors trainer
deflection of flexible link on QNET mechatronic sensors trainer.
v 1.0
10
v 1.0
12
Parameter
Sensor Measurement:
Sensor Measurement:
Sensor Measurement:
Sensor Measurement:
Sensor Measurement:
Gain
Offset
Value
at -1.0 cm
at -0.5 cm
at 0 cm
at 0.5 cm
at 1.0 cm
Units
V
V
V
V
V
cm/V
cm
Notes
3.6 Results
Parameter
Gain
Offset
Natural Frequency
Value
Units
cm/V
cm
Hz
Notes
v 1.0
PRESSURE SENSOR
4.1 Background
A pressure sensor is attached to the plunger on the QNET mechatronic board shown in Figure 4.1. This is a gage
pressure sensor and its measurements are relative to the atmospheric pressure. The voltage signal generated is
proportional to the amount of pressure in the vessel of the plunger. So as the plunger is pushed further, the air inside
the vessel becomes more compressed and the reading increases.
Pressure sensors can also be used to indirectly measure other values. For example, in the QNET mechatronics
board the position of the plunger head is measured. It can also be used to measure the amount of volume in a
reservoir or the altitude of an aerial vehicle.
14
v 1.0
16
Parameter
Sensor Measurement:
Sensor Measurement:
Sensor Measurement:
Sensor Measurement:
Sensor Measurement:
Sensor Measurement:
Sensor Measurement:
Value
at 6.0 cm
at 5.0 cm
at 4.0 cm
at 3.0 cm
at 2.0 cm
at 1.0 cm
at 0.0 cm
Units
V
V
V
V
V
V
V
Notes
4.5 Results
Parameter
a
b
c
Value
Units
cm/V2
cm/V
cm
Notes
v 1.0
PIEZO SENSOR
5.1 Background
Piezo sensors measure vibration. The piezo sensor on the QNET-MECHKIT trainer, shown in Figure 5.1, is connected to a plastic band that has a brass disc weight at the end.
18
POTENTIOMETER
6.1 Background
Rotary potentiometers are absolute analog sensors used to measure angular position, such as a load shaft of a
motor. They are great to obtain a unique position measurement. However, caution must be used as their signal is
discontinuous. That is, after a few revolutions potentiometers will reset their signal back to zero. The potentiometer
on the QNET MECHKIT board is shown in Figure 6.1.
v 1.0
20
v 1.0
Parameter
Sensor Measurement:
Sensor Measurement:
Sensor Measurement:
Sensor Measurement:
Sensor Measurement:
Gain
Offset
Value
at 0 deg
at 45 deg
at 90 deg
at 135 deg
at 180 deg
Units
V
V
V
V
V
deg/V
deg
Notes
6.5 Results
Parameter
Gain
Offset
Value
Units
deg/V
deg
Notes
22
INFRARED
7.1 Background
Infrared (IR) sensors are widely used in robots, automotive systems, and various other applications that require
an accurate, medium-range non-contact position measurement. An IR sensor is typically composed of an infrared
emitting diode (IRED), a position sensing detector (PSD), and a signal processing circuit. It outputs a voltage the
correlates to the distance of the remote target. The infrared distance measuring sensor on the QNET MECHKIT
board is shown in Figure 7.1.
Infrared-based distance sensors typically have a smaller maximum range than sonar but the resolution is better.
v 1.0
24
v 1.0
9. Repeat for different target positions. The IR sensor is quadratic. As the measurements are entered, the
coefficients for the second-order polynomial are generated and the fitted curve is automatically plotted.
10. Record your distance and voltage observations and capture the corresponding Sensor Readings scope.
Parameter
Sensor Measurement:
Sensor Measurement:
Sensor Measurement:
Sensor Measurement:
Sensor Measurement:
Sensor Measurement:
Sensor Measurement:
Sensor Measurement:
Sensor Measurement:
Value
at 17cm
at 22 cm
at 27 cm
at 32 cm
at 37 cm
at 42 cm
at 47 cm
at 52 cm
at 57 cm
Units
V
V
V
V
V
V
V
V
V
Notes
7.5 Results
Parameter
a
b
c
Value
Units
cm/V2
cm/V
cm
Notes
26
SONAR
8.1 Background
Often used in mobile robotics, sonar sensors are fitted with an emitter that generates ultrasonic waves and a receiver
that captures them after hitting a target. A timer calculates how long it takes for the signal to return and, given the
speed of sound in air, the distance of the remote target is measured. The sonar ranger on the mechatronic trainer
is pictured in Figure 8.1.
v 1.0
28
v 1.0
9. Enter your collected target distances and voltages. Capture the Sensor Readings scope as well.
Parameter
Sensor Measurement:
Sensor Measurement:
Sensor Measurement:
Sensor Measurement:
Sensor Measurement:
Value
at 7 cm
at 8 cm
at 9 cm
at 10 cm
at 11 cm
Units
V
V
V
V
V
Notes
8.5 Results
Parameter
Range
Resolution
Gain
Offset
Value
Units
cm
cm
cm/V
cm
Notes
30
OPTICAL POSITION
9.1 Background
Optical position sensors are used in applications such as assembly lines, machine automation, and even edge
detection in robots. The optical position sensor on the QNET mechatronic sensors board is the black plastic housing
located at the bottom of Figure 9.1. An infrared emitting diode and an NPN silicon phototransistor are mounted
side-by-side and are used to measure the position of a target. This sensor has a range of 0.25 inches.
Figure 9.1: Optical position sensor (bottom) and target position knob (top) on QNET mechatronic sensors trainer
v 1.0
32
v 1.0
8. Take samples for the entire range of the target (i.e. until the knob cannot be rotated CCW anymore). Remark
that the optical position sensor is exponential. As data is being entered, the exponential parameters are
generated and the fitted curve is automatically plotted.
9. Enter the measured sensor data and capture the Sensor Readings response.
Parameter
Sensor Measurement:
Sensor Measurement:
Sensor Measurement:
Sensor Measurement:
Sensor Measurement:
Sensor Measurement:
Sensor Measurement:
Sensor Measurement:
Sensor Measurement:
Sensor Measurement:
Sensor Measurement:
Sensor Measurement:
Value
at 0 in.
at 0.025 in.
at 0.050 in.
at 0.075 in.
at 0.100 in.
at 0.125 in.
at 0.150 in.
at 0.175 in.
at 0.200 in.
at 0.225 in.
at 0.250 in.
at 0.28 in.
Units
V
V
V
V
V
V
V
V
V
V
V
V
Notes
9.5 Results
Parameter
Gain
Damping
Value
Units
in
Notes
34
10 MAGNETIC FIELD
10.1
Background
A magnetic field transducer outputs a voltage proportional to the magnetic field that is applied to the target. The
magnetic field sensor is the chip located on the bottom of Figure 10.1. It applies a magnetic field perpendicular to
the flat screw head. The position of the screw head is changed by rotating the knob. This magnetic field transducer
has a similar range to the optical position sensor.
v 1.0
10.2
The virtual instrument used to collect data using the magnetic field transducer is shown in Figure 10.2. The virtual
instrument used to calibrate magnetic field data is shown in Figure 10.3.
36
10.3
v 1.0
8. Take samples for the entire range of the target (i.e. until the knob cannot be rotated CCW anymore). The
magnetic field sensor is exponential. The parameters of the exponential function are outputted and the fitted
curve is automatically plotted as data is entered.
9. Enter the range and measured sensor voltages and capture the Sensor Readings scope.
Parameter
Sensor Measurement:
Sensor Measurement:
Sensor Measurement:
Sensor Measurement:
Sensor Measurement:
Sensor Measurement:
Sensor Measurement:
Sensor Measurement:
Sensor Measurement:
Value
at 0 in.
at 0.025 in.
at 0.050 in.
at 0.075 in.
at 0.100 in.
at 0.125 in.
at 0.150 in.
at 0.175 in.
at 0.200 in.
Units
V
V
V
V
V
V
V
V
V
Notes
10.4
1. Run QNET_MECHKIT_Magnetic_Field.vi
2. Enter Gain and Damping exponential function parameters to correctly measure the distance of the target. For
instance, when target is at 0.10 inches from the reference, then the display should read 0.10 inches.
3. Record Gain and Damping parameters used for correct measurement.
4. Click on Stop button to stop the VI.
10.5
Results
Parameter
Gain
Damping
Value
Units
in/V
Notes
38
11 ENCODER
11.1
Background
Similar to rotary potentiometers, encoders can also be used to measure angular position. There are many types
of encoders but one of the most common is the rotary incremental optical encoder, shown in Figure 11.1. Unlike
potentiometers, encoders are relative. The angle they measure depends on the last position and when it was last
powered. It should be noted, however, that absolute encoders are available.
The encoder has a coded disk that is marked with a radial pattern. As the disk rotates (with the shaft), the light
from an LED shines through the pattern and is picked up by a photo sensor. This effectively generates the A and B
signals shown in Figure 11.2. An index pulse is triggered once for every full rotation of the disk, which can be used
for calibration or homing a system.
The A and B signals that are generated as the shaft rotates are used in a decoder algorithm to generate a count. The
resolution of the encoder depends on the coding of the disk and the decoder. For example, an encoder with 1024
lines on the disk can generate a total of 1024 counts for every rotation of the encoder shaft. However, in a quadrature
decoder the number of counts quadruples, therefore the encoder would generate 4098 counts per revolution.
The encoder knob on the QNET mechatronic sensors trainer is pictured in Figure 11.3 and the corresponding A, B,
QNET MECHKIT Workbook - Student Version
v 1.0
and Index signals are displayed on the LEDs shown in Figure 11.4.
40
11.2
The virtual instrument used to collect and calibrate encoder data is shown in Figure 11.5.
11.3
v 1.0
11.4
1. Run QNET_MECHKIT_Encoder.vi
2. Using the 16-bit Position (counts) indicator on the VI, as shown in Figure 11.5, rotate the knob and determine
how how many counts there are per revolution. Enter your result in the Counts per rev box in the VI. Rotate
the knob and confirm that the Angle (deg) indicator is displaying an accurate angle.
3. Turn the knob such that the 0 is in the upward position and reset the counter by clicking on the Reset button.
4. Enable the index by clicking on the Enable Index button.
5. Rotate the knob a full CW turn until the index is triggered. Keep turning the knob until the 0 mark on the knob is
pointing upwards. What do you notice about the 16-bit Position (counts) and the Angle (deg) indicator values?
6. Adjust the Reload Value such that Angle (deg) measures 0 degrees when the 0 mark of the knob is pointing
up. Confirm this by moving the knob CW.
7. Enter the Count per rev and the Reload Value values used for a calibrated measurement.
8. Position the knob such that its 0 label is pointing upwards again. The Counts per rev and Angle (deg) should
both be reading 0. Rotate the knob in the CCW fashion one full rotation. Is Angle (deg) reading 0 degrees?
Discuss why or why not.
9. Click on Stop button to stop the VI.
11.5
Results
Encoder Knob Rotation
Clockwise
Counter-clockwise
A or B Signal Leads?
Parameter
Counts per rev
Reload Value
Value
Units
counts/rev
counts
Notes
42
12 TEMPERATURE SENSOR
12.1
Background
As described in [3], there are several different types of transducers available to measure temperature: the thermocouple, the resistance temperature detector (RTD), the thermistor, and the integrated circuit (IC). Each have their
own advantages and disadvantages. The Thermocouple has a wide temperature range and is easy to use but is the
least stable and sensitive. The RTD, on the other hand, is most stable and accurate of the sensors but is slow and
relatively more expensive. The IC is the only linear transducer, has the highest output, but is slow. The thermistor
responds very quickly but has a limited temperature range. The thermistor on the mechatronic sensors board is
shown in Figure 12.1.
R = R0 e
1 1
T T0
(12.1)
The resistance is R0 when the temperature is at T0 . For the thermistor on the mechatronic sensors trainer, the
sensor resistance is
R0 = 47000
(12.2)
T0 = 298.15 K
(12.3)
Thermistors are typically part of a circuit. In the QNET mechatronic sensors trainer, the thermistor is in the circuit
shown in Figure 12.2 and labeled by R.
QNET MECHKIT Workbook - Student Version
v 1.0
vi =
30(R + 10000)
15
67000 + R
(12.4)
(12.5)
where vo f f is the voltage adjusted using the Offset potentiometer and Av is the amplifier gain that can be changed
externally using the Gain potentiometer. The Gain and Offset potentiometers are on the QNET mechatronic sensor
trainer and shown in Figure 12.3.
Figure 12.3: Thermistor Gain and Offset potentiometers on QNET mechatronic sensors trainer
44
12.2
The virtual instrument used to collect temperature data is shown in Figure 12.4. The virtual instrument used to
calibrate temperature data is shown in Figure 12.5.
v 1.0
12.3
46
12.4
12.5
Results
Temperature ( C)
25
32
Temperature (K)
298
305
Units
V
V
Notes
Voltage at room temp, T0
Voltage with finger, T
Temperature ( C)
25
32
Temperature (K)
298
305
Measured Resistance ()
Units
Notes
Resistance at room temp, R0
Resistance with finger, R
v 1.0
Background
13.1.1 Switches
Different applications call for different types of switches. For example, a micro switch may be used to detect mobile
robot hitting a wall whereas an optical switch could be used to detect an edge. The push button is the most common
type of switch mechanism. A switch that is active high means the output is high, e.g. 5.0 V, when the switch is
triggered (e.g. pressed down). Active low means the signal is high, e.g. 5.0 V, when the switch is not engaged (e.g.
not pressed down).
The different switches on the QNET mechatronic sensors trainer are introduced in this section followed by a discussion about debouncing.
Micro Switch
The micro switch is an active low device and is shown in Figure 13.1.
Push Button
The push button on the QNET MECHKIT is pictured in Figure 13.2 and is active high.
48
Optical Switch
The optical switch, shown in Figure 13.3, is a photo-microsensor that includes transmissive and reflective components. As opposed to the push button and micro switch, this is a non-contact triggering solution. It is triggered when
the reflective sensor does not detect any light, i.e. when an object is placed between the components. It goes low
when no object is detected.
v 1.0
13.2
The virtual instrument used to collect optical switch data is shown in Figure 13.5. The virtual instruments used to
calibrate the micro switch, and push button are shown in Figure 13.6, and Figure 13.7 respectively. The virtual
instrument used to control the LEDs is shown in Figure 13.8.
50
v 1.0
52
13.3
v 1.0
13.4
13.5
13.6
Lab 4: LEDs
1. Run QNET_MECHKIT_Switches_and_LEDs.vi
2. Select the Digital Outputs tab.
3. As shown in Figure 13.8, switch DO 1 and DO 0 between the up/down positions and examine its effect on the
on-board LEDs.
4. Record what position, i.e. up or down, the DO 1 and DO 0 switches have to be in such that the DO 1 and DO
0 LEDs are lit.
5. Click on Stop button to stop the VI.
54
13.7
Results
Parameter
Gain
Offset
Gain
Offset
DO 1 Switch position for DO 1 LED ON
DO 1 Switch position for DO 1 LED
OFF
Value
Units
Notes
v 1.0
14 SWITCH DEBOUNCE
ANALYSIS
14.1
Background
56
14.2
The NI ELVISmx Oscilloscope is shown in Figure 14.2. The virtual instrument used to analyze and debounce the
micro switch, and push button is shown in Figure 14.3.
v 1.0
Figure 14.3: VI used to analyze debounce of micro switch and push button
14.3
58
8. Try to setup the oscilloscope for the Push Button. This is on analog input channel #2 and you can choose to
configure it on the Channel 1 of the oscilloscope (if you do, make sure you enable the channel). Note: To
increase the sampling rate and obtain a more closeup view of the signal, decrease the Time/Div knob control.
9. When you are done, stop and close down the Oscilloscope instrument.
Caution: Make sure any ELVISmx instrument, e.g. the oscilloscope, is closed before running any ELVIS II
based VIs. Otherwise the VI will not be able to run.
14.4
14.5
v 1.0
14.6
Results
Trigger Parameters
Micro Switch
Type
Slope
Source
Level
Push Button
Type
Slope
Source
Level
Value
Units
Notes
V
Table 14.1: Debouncing trigger parameters summary
60
15 SYSTEM REQUIREMENTS
Required Hardware
NI ELVIS II (or NI ELVIS I)
Quanser QNET Mechatronic Sensors Trainer. See QNET MECHKIT User Manual ([2]).
Required Software
NI LabVIEWr 2010 or later
NI DAQmx
NI LabVIEW Control Design and Simulation Module
ELVIS II Users: ELVISmx installed from ELVIS II CD.
ELVIS I Users: ELVIS CD 3.0.1 or later installed.
Caution: If these are not all installed then the VI will not be able to run! Please make sure all the software
and hardware components are installed. If an issue arises, then see the troubleshooting section in the QNET VTOL
User Manual ([2]).
15.1
Overview of Files
File Name
QNET MECHKIT User Manual.pdf
QNET_MECHKIT_Flexgage.vi
QNET_MECHKIT_Pressure Sensor.vi
QNET_MECHKIT_Piezo.vi
QNET_MECHKIT_Potentiometer.vi
QNET_MECHKIT_Infrared.vi
QNET_MECHKIT_Sonar.vi
QNET_MECHKIT_Optical.vi
QNET_MECHKIT_Magnetic_Field.vi
QNET_MECHKIT_Encoder.vi
QNET_MECHKIT_Temperature.vi
QNET_MECHKIT_Switches_and_LEDs.vi
QNET_MECHKIT_Switch_Debounce.vi
Description
This manual describes the hardware of the QNET Mechatronic Sensors trainer and how to setup the system on the
ELVIS.
This laboratory guide contains pre-lab questions and lab
experiments demonstrating how to calibrate and use sensors on the QNET MECHKIT trainer LabVIEWr .
Control the current in the propeller motor
Validate transfer function model and identify system parameters
Control the pitch of the VTOL device using PID
Calibrate potentiometer to get correct angle
Calibrate infrared sensor to measure target distance
Implement sonar sensor to measure target range
Calibrate optical sensor to measure the position of the flat
screw head, which can be adjusted using the knob
Implement magnetic field sensor to measure position of the
screw head, which can be adjusted using its knob
Used to teach the fundamentals of a rotary optical encoder
Calibrate thermistor to measure correct temperature
Change the on/off behaviour of the micro switch, push button, and optical switch and drive on-board LEDs
High-frequency analysis of micro switch and push button
v 1.0
15.2
This VI can be used to view the strain gage measurements when moving the flexible link on the QNET mechatronic
sensors trainer. Table 15.2 lists and describes the main elements of the QNET Flexgage VI and every element is
uniquely identified by an ID number in Figure 15.1, Figure 15.2, and Figure 15.3.
62
v 1.0
ID #
1
2
3
4
5
6
7
8
9
10
11
12
Label
Scope: Flexgage (V)
Link Position (cm)
Sensor Measurement (V)
Sensor Readings
Slope
Intercept
Gain (cm/V)
Offset (cm)
Slider: Flexgage (cm)
Scope: Flexgage (cm)
Graph: Power Spectrum
Cursor
13
14
15
Device
Sampling Rate
Stop
Description
Scope showing raw voltage measured by strain gage
Position of flexible link along printed graduated ruler on QNET board
Recorded strain gage measurement for each link position
Graph showing measured and curve fitted data
Slope computed by curve fitting algorithm
Intercept computed by curve fitting algorithm
Sensor calibration gain (slope)
Sensor calibration offset (intercept)
Displays position of flexible link using Gain and Offset parameter
Displays position of flexible link using Gain and Offset parameter
Graph showing power spectrum of flexible link (after being perturbed)
Displays numerically the location of the cursor on the Power Spectrum graph
Selects the NI DAQ device
Sets the sampling rate of the VI
Stops the LabVIEW VI from running
Unit
V
cm
V
cm/V
cm
cm/V
cm
cm
cm
Hz
15.3
Pressure Laboratory VI
This VI can be used to view the pressure sensor measurements as the plunger is moved at different locations within
the syringe on the QNET mechatronic sensors trainer. Table 15.3 lists and describes the main components of the
QNET Pressure Sensor VI and they are uniquely identified by an ID number in Figure 15.4 and Figure 15.5.
64
v 1.0
ID #
1
2
Label
Scope: Pressure Sensor (V)
Plunger Position (cm)
4
5
6
7
8
9
10
11
12
13
14
15
Device
Sampling Rate
Stop
Description
Scope showing raw voltage measured by pressure sensor
Position of syringe along printed graduated ruler on QNET
board
Recorded pressure sensor measurement for each plunger position
Graph showing measured and curve fitted data
Intercept computed by curve fitting algorithm
Slope computed by curve fitting algorithm
Rate of slope computed by curve fitting algorithm
Rate of slope computed by curve fitting algorithm
Slope computed by curve fitting algorithm
Intercept computed by curve fitting algorithm
Chart displays position of target using a, b, and c parameters
Slide indicator displays position of target using a, b, and c parameters
Selects the NI DAQ device
Sets the sampling rate of the VI
Stops the LabVIEW VI from running
Unit
V
cm
V
cm
cm/V
cm/V2
cm/V2
cm/V
cm
cm
cm
Hz
15.4
Piezo VI
The QNET Piezo VI is used to view the piezo sensor readings as the plastic strip on the QNET MECHKIT is perturbed.
The components of the VI are listed in Table 15.4, and identified in Figure 15.6 and Figure 15.7.
66
Figure 15.6: QNET MECHKIT Piezo Sensor VI: Collect Data tab
v 1.0
Figure 15.7: QNET MECHKIT Piezo Sensor VI: Natural Frequency tab
ID #
1
2
3
Label
Scope: Piezo (V)
Graph: Power Spectrum
Cursor
4
5
6
Device
Sampling Rate
Stop
Description
Scope showing raw voltage measured by piezo film sensor
Graph showing power spectrum of film (after being perturbed)
Displays numerically the location of the cursor on the Power Spectrum graph
Selects the NI DAQ device
Sets the sampling rate of the VI
Stops the LabVIEW VI from running
Unit
V
Hz
15.5
Potetiometer VI
This VI can be used to view the potentiometer measurements when moving the potentiometer knob on the QNET
mechatronic sensors trainer. Table 15.5 lists and describes the main elements of the QNET Potentiometer VI and
every element is uniquely identified by an ID number in Figure 15.8 and Figure 15.9.
68
v 1.0
ID #
1
2
3
4
5
6
7
8
9
Label
Scope: Potentiometer (V)
Pot Angle (deg)
Sensor Measurement (V)
Sensor Readings
Slope
Intercept
Gain (deg/V)
Offset (deg)
Scope: Potentiometer (deg)
10
11
12
13
Device
Sampling Rate
Stop
Description
Scope showing raw voltage measured by potentiometer
Angle of top arrow on the potentiometer knob
Recorded potentiometer measurement for each angle
Graph showing measured and curve fitted data
Slope computed by curve fitting algorithm
Intercept computed by curve fitting algorithm
Sensor calibration gain (slope)
Sensor calibration offset (intercept)
Displays angular position of potentiometer according to the Gain
and Offset parameters
Displays position of potentiometer according to the Gain and Offset parameters
Selects the NI DAQ device
Sets the sampling rate of the VI
Stops the LabVIEW VI from running
Unit
V
deg
V
deg/V
deg
deg/V
deg
deg
deg
Hz
15.6
Use the QNET Infrared VI to view and calibrate the readings of the infrared sensor on the MECHKIT as the target
distance is changed. The components of the VI are listed in Table 15.6 and identified in Figure 15.10 and Figure
15.11.
70
Figure 15.10: QNET MECHKIT Infrared Sensor VI: Collect Data tab
v 1.0
ID #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Label
Scope: Infrared Sensor (V)
Target Range (cm)
Sensor Measurement (V)
Graph: Sensor Readings
c (Collect Data tab)
b (Collect Data tab)
a (Collect Data tab)
a (Calibrate Sensor tab)
b (Calibrate Sensor tab)
c (Calibrate Sensor tab)
IR Sensor (cm)
IR (cm)
Device
Sampling Rate
Stop
Description
Scope showing raw voltage measured by infrared sensor
Distance between the target and IR sensor
Recorded IR measurement for each target position
Graph showing measured and curve fitted data
Intercept computed by curve fitting algorithm
Slope computed by curve fitting algorithm
Rate of slope computed by curve fitting algorithm
Rate of slope computed by curve fitting algorithm
Slope computed by curve fitting algorithm
Intercept computed by curve fitting algorithm
Displays target distance using a, b, and c parameters
Knob displays position of target using a, b, and c parameters
Selects the NI DAQ device
Sets the sampling rate of the VI
Stops the LabVIEW VI from running
Unit
V
cm
V
cm
cm/V
cm/V2
cm/V2
cm/V
cm
cm
cm
Hz
15.7
Sonar Sensor VI
Use this VI to view the sonar measurements as a target is moved at different distances away from the sensor. Table
15.7 lists and describes the main components of the QNET Sonar VI and they are uniquely identified by an ID number
in Figure 15.12 and Figure 15.13.
72
v 1.0
ID #
1
2
3
4
5
6
7
8
9
10
11
12
13
Label
Scope: Sonar (V)
Target Range (in)
Sensor Measurement (V)
Sensor Readings
Slope
Intercept
Gain (deg/V)
Offset (deg)
Scope: Sonar (in)
Meter: Sonar (in)
Device
Sampling Rate
Stop
Description
Scope showing raw voltage measured by sonar
Distance between target and sonar sensor
Recorded sonar measurement for each target position
Graph showing measured and curve fitted data
Slope computed by curve fitting algorithm
Intercept computed by curve fitting algorithm
Sensor calibration gain (slope)
Sensor calibration offset (intercept)
Displays target position according to the Gain and Offset parameters
Displays target position according to the Gain and Offset parameters
Selects the NI DAQ device
Sets the sampling rate of the VI
Stops the LabVIEW VI from running
Unit
V
in
V
in/V
in
in/V
in
in
in
Hz
15.8
The QNET-MECHKIT Optical VI is used to view the measurements of the optical position sensor as the target is
moved at different locations using the knob. The components of the VI are described in Table 15.8 and identified in
Figure 15.14 and Figure 15.15.
74
v 1.0
ID #
1
Label
Scope: Optical Position Sensor (V)
2
3
4
5
7
8
9
Amplitude
Damping
Scope: Optical Position (in)
10
11
12
13
Device
Sampling Rate
Stop
Description
Scope showing raw voltage measured by optical position
sensor
Distance between the target and optical sensor
Recorded optical sensor measurement for each target position
Graph showing measured and curve fitted data
Exponential function amplitude parameter computed by
curve fitting algorithm
Exponential function decay/growth parameter computed
by curve fitting algorithm
Gain of exponential function
Exponential decay/growth factor of exponential function
Scope that shows position of target based on entered Amplitude and Damping parameters
Slider indicator displays position of target based on entered
Amplitude and Damping parameters
Selects the NI DAQ device
Sets the sampling rate of the VI
Stops the LabVIEW VI from running
Unit
V
in
V
in
in
Hz
15.9
Using this VI, the magnetic field measurements can be read as the target is moved at different locations using the
knob on the QNET mechatronic sensors trainer. The components of the QNET Magnetic Field VI are summarized
76
Figure 15.16: QNET MECHKIT Magnetic Field VI: Collect Data tab
v 1.0
ID #
1
Label
Scope: Magnetic Field Sensor (V)
2
3
4
5
7
8
9
Amplitude
Damping
Scope: Magnetic Field (in)
10
11
12
13
Device
Sampling Rate
Stop
Description
Scope showing raw voltage measured by magnetic field
sensor
Distance between the target and magnetic field sensor
Recorded sensor measurement for each target position
Graph showing measured and curve fitted data
Exponential function amplitude parameter computed by
curve fitting algorithm
Exponential function decay/growth parameter computed
by curve fitting algorithm
Gain of exponential function
Exponential decay/growth factor of exponential function
Scope that shows position of target based on entered Amplitude and Damping parameters
Slider indicator displays position of target based on entered
Amplitude and Damping parameters
Selects the NI DAQ device
Sets the sampling rate of the VI
Stops the LabVIEW VI from running
Unit
V
in
V
in
in
Hz
15.10
Encoder Laboratory VI
This VI shows the A, B, and Index signals generated by the rotary optical encoder on the QNET mechatronic sensors
trainer as the knob is rotated. The components of the QNET Encoder VI are described in Table 15.10 and identified
in Figure 15.18.
78
ID #
1
Label
Scope: Encoder A and B (V)
2
3
4
5
6
7
8
9
10
11
Device
Sampling Rate
Stop
Description
Scope showing encoder A (blue) and B (red) voltage signals. Signals are offset by 2.5 V for viewing purposes
Scope displays the index trigger
Resets the encoder count
When enabled, the encoder count is reset on an index pulse
Count generated by decoder
Number of counts for every full rotation
Resets the count to this value
Angle measured by encoder according to the Counter per rev parameter
Selects the NI DAQ device
Sets the sampling rate of the VI
Stops the LabVIEW VI from running
Unit
V
V
Hz
v 1.0
15.11
Temperature Laboratory VI
The measured voltage output from the thermistor circuit is displayed on this VI as well as the calibrated temperature
reading. The QNET MECHKIT Temperature VI components are given in Table 15.11 and identified in Figure 15.19.
ID #
1
2
3
4
5
Label
R0
T0
B
Scope: Temperature Sensor (V)
Scope: Temperature Sensor (deg C)
Temperature (deg C)
7
8
9
Device
Sampling Rate
Stop
Description
Resistance of thermistor at temperature specified in T0
Room temperature in Kelvin
Thermistor equation exponential parameter
Scope shows the output voltage of the thermistor circuit
Scope displays the measured temperature based on
the T0 and B parameters entered
Thermometer displays the measured temperature
based on the T0 and B parameters entered
Selects the NI DAQ device
Sets the sampling rate of the VI
Stops the LabVIEW VI from running
80
Unit
Hz
15.12
The QNET MECHKIT Switches and LEDs VI allows users to view the output of the optical switch, micro switch,
and push button and calibrate them to obtain a desired on/off behaviour. This VI can also be used to drive the
digital output lines #0 and #1 that are connected to the LEDs on the QNET mechatronics sensors trainer. The VI
components are listed in Table 15.12 and identified in figures Figure 15.20, Figure 15.21, Figure 15.22, and Figure
15.23.
Figure 15.20: QNET MECHKIT Switches and LEDs VI: Opto Switch tab
v 1.0
Figure 15.21: QNET MECHKIT Switches and LEDs VI: Micro Switch tab
Figure 15.22: QNET MECHKIT Switches and LEDs VI: Push Button tab
82
Figure 15.23: QNET MECHKIT Switches and LEDs VI: Digital Outputs tab
ID #
1
2
Label
Scope: Optical Switch
Scope: Optical Switch - Digital
Threshold
4
5
6
7
8
9
Gain
Offset
Scope: Push Button
Scope: Push Button - Digital
10
11
12
Gain
Offset
DO 1
13
DO 0
14
15
16
Device
Sampling Rate
Stop
Description
Scope shows the optical switch output voltage
Scope displays readout of optical switch when passed through
Threshold switch
Adjusts the threshold of the optical switch that determines
when it is ON or OFF
Scope shows the micro switch output voltage
Scope displays calibrated micro switch output based on Gain
and Offset parameters.
Micro switch calibration gain
Micro switch calibration offset
Scope shows the push button output voltage
Scope displays calibrated push button output based on Gain
and Offset parameters.
Push button calibration gain
Push button calibration offset
Digital output to channel #1 - connected to LED7 on QNET
MECHKIT trainer
Digital output to channel #0 - connected to LED8 on QNET
MECHKIT trainer
Selects the NI DAQ device
Sets the sampling rate of the VI
Stops the LabVIEW VI from running
Unit
V
V
V
Hz
v 1.0
15.13
In this VI, the triggered output of the Micro Switch and the Push Button can be viewed. The ELVISmx Oscilloscope
VI is setup to monitor either the Micro Switch or Push Button analog input lines at a sample rate 100 kHz. Once the
signal is triggered, the VI automatically stops and outputs a 1k sample of the voltage output. In effect, this gives a a
10 ms sample of the signal. See Table 15.13 for a listing of the VI components that are shown in Figure 15.24.
ID #
1
2
3
Label
Type
Source
Slope
6
4
5
7
Level (V)
Graph: Micro Switch/ELVIS Ch0
Graph: Push Button/ELVIS Ch1
Device
Description
Type of signal trigger
Select which ELVIS channel (0 or 1) to trigger
Select whether the trigger is to occur when the edge is rising
(positive) or decreasing (negative)
Threshold of the trigger
Graph displays the triggered micro switch output
Graph displays the triggered push button output
Selects the NI DAQ device
84
Unit
16 LAB REPORT
This laboratory contains twelve groups of experiments, namely,
1. Flexgage,
2. Pressure Sensor,
3. Piezo Film Sensor,
4. Potentiometer,
5. Infrared Sensor,
6. Sonar Sensor,
7. Optical Position,
8. Magnetic Field,
9. Encoder,
10. Temperature,
11. Switches and LEDs, and
12. Switch Debouncing.
For each experiment, follow the outline corresponding to that experiment to build the content of your report. Also,
in Section 16.13 you can find some basic tips for the format of your report.
v 1.0
16.1
I. PROCEDURE
1. Collect Data
Briefly describe the main goal of the experiment.
Briefly describe the experimental procedure in Step 7 in Section 3.3.
2. Calibrate Sensor
Briefly describe the main goal of the experiment.
Briefly describe the experimental procedure in Step 3 in Section 3.4.
3. Natural Frequency
Briefly describe the main goal of the experiment.
Briefly describe the experimental procedure in Step 4 in Section 3.5.
II. RESULTS
Do not interpret or analyze the data in this section. Just provide the results.
1. Sensor readings plot from Step 7 in Section 3.3.
2. Power spectrum response from Step 4 in Section 3.5.
3. Provide applicable data collected in this laboratory from Table 3.2.
III. ANALYSIS
Provide details of your calculations (methods used) for analysis for each of the following:
1. Natural frequency measurement in Step 4 of Section 3.5.
86
16.2
I. PROCEDURE
1. Collect Data
Briefly describe the main goal of the experiment.
Briefly describe the experiment procedure in Step 7 in Section 4.3.
2. Calibrate Sensor
Briefly describe the main goal of the experiment.
Briefly describe the experiment procedure in Step 3 in Section 4.4.
II. RESULTS
Do not interpret or analyze the data in this section. Just provide the results.
1. Sensor readings from Step 7 in Section 4.3.
2. Provide applicable data collected in this laboratory from Table 4.2.
v 1.0
16.3
I. PROCEDURE
1. Data Analysis
Briefly describe the main goal of the experiment.
Briefly describe the experiment procedure in Step 6 in Section 5.2.
2. Natural Frequency
Briefly describe the main goal of the experiment.
Briefly describe the experiment procedure in Step 3 in Section 5.3.
II. RESULTS
Do not interpret or analyze the data in this section. Just provide the results.
1. Sensor response from Step 6 in Section 5.2.
2. Power spectrum response from Step 3 in Section 5.3.
III. ANALYSIS
Provide details of your calculations (methods used) for analysis for each of the following:
1. Piezo sensor analysis in Step 6 in Section 5.2.
2. Natural frequency measurement from Step 3 in Section 5.3.
88
16.4
I. PROCEDURE
1. Collect Data
Briefly describe the main goal of the experiment.
Briefly describe the experiment procedure in Step 8 in Section 6.3.
2. Calibrate Sensor
Briefly describe the main goal of the experiment.
Briefly describe the experiment procedure in Step 3 in Section 6.4.
II. RESULTS
Do not interpret or analyze the data in this section. Just provide the results.
1. Sensor response from Step 8 in Section 6.3.
2. Provide applicable data collected in this laboratory from Table 6.2.
v 1.0
16.5
I. PROCEDURE
1. Collect Data
Briefly describe the main goal of the experiment.
Briefly describe the experiment procedure in Step 10 in Section 7.3.
2. Calibrate Sensor
Briefly describe the main goal of the experiment.
Briefly describe the experiment procedure in Step 3 in Section 7.4.
II. RESULTS
Do not interpret or analyze the data in this section. Just provide the results.
1. Sensor response from Step 10 in Section 7.3.
2. Provide applicable data collected in this laboratory from Table 7.2.
III. ANALYSIS
Provide details of your calculations (methods used) for analysis for each of the following:
1. Observations in Step 11 in Section 7.3.
90
16.6
I. PROCEDURE
1. Collect Data
Briefly describe the main goal of the experiment.
Briefly describe the experiment procedure in Step 9 in Section 8.3.
2. Calibrate Sensor
Briefly describe the main goal of the experiment.
Briefly describe the experiment procedure in Step 3 in Section 8.4.
II. RESULTS
Do not interpret or analyze the data in this section. Just provide the results.
1. Sensor response from Step 9 in Section 8.3.
2. Provide applicable data collected in this laboratory from Table 8.2.
III. ANALYSIS
Provide details of your calculations (methods used) for analysis for each of the following:
1. Sonar sensor analysis in Step 10 of Section 8.3.
v 1.0
16.7
I. PROCEDURE
1. Collect Data
Briefly describe the main goal of the experiment.
Briefly describe the experiment procedure in Step 9 in Section 9.3.
2. Calibrate Sensor
Briefly describe the main goal of the experiment.
Briefly describe the experiment procedure in Step 3 in Section 9.4.
II. RESULTS
Do not interpret or analyze the data in this section. Just provide the results.
1. Sensor response from Step 9 in Section 9.3.
2. Provide applicable data collected in this laboratory from Table 9.2.
92
16.8
I. PROCEDURE
1. Collect Data
Briefly describe the main goal of the experiment.
Briefly describe the experiment procedure in Step 9 in Section 10.3.
2. Calibrate Sensor
Briefly describe the main goal of the experiment.
Briefly describe the experiment procedure in Step 3 in Section 10.4.
II. RESULTS
Do not interpret or analyze the data in this section. Just provide the results.
1. Sensor response from Step 9 in Section 10.3.
2. Provide applicable data collected in this laboratory from Table 10.2.
v 1.0
16.9
I. PROCEDURE
1. Analysis of A, B, and I Signals
Briefly describe the main goal of the experiment.
Briefly describe the experiment procedure in Step 4 in Section 11.3.
2. Encoder Calibration
Briefly describe the main goal of the experiment.
Briefly describe the experiment procedure in Step 7 in Section 11.4.
II. RESULTS
Do not interpret or analyze the data in this section. Just provide the results.
1. Provide applicable data collected in this laboratory from Table 11.1 and Table 11.2.
III. ANALYSIS
Provide details of your calculations (methods used) for analysis for each of the following:
1. Enocder signal observations from Step 4 in Section 11.3.
2. Identifying the transfer function in Step 5 in Section 11.3.
3. Index pulse analysis in Step 8 in Section 11.4.
94
16.10
I. PROCEDURE
1. Collect Data
Briefly describe the main goal of the experiment.
Briefly describe the experiment procedure in Step 6 in Section 12.3.
2. Calibrate Sensor
Briefly describe the main goal of the experiment.
Briefly describe the experiment procedure in Step 2 in Section 12.4.2.
II. RESULTS
Do not interpret or analyze the data in this section. Just provide the results.
1. Sensor response from Step 2 in Section 12.4.2.
2. Provide applicable data collected in this laboratory from Table 12.1.
IV. CONCLUSIONS
Interpret your results to arrive at logical conclusions for the following:
1. Sensor response from Step 3 in Section 12.4.2.
v 1.0
16.11
I. PROCEDURE
1. Optical Switch
Briefly describe the main goal of the experiment.
Briefly describe the experiment procedure in Step 7 in Section 13.3.
2. Micro Switch
Briefly describe the main goal of the experiment.
Briefly describe the experiment procedure in Step 6 in Section 13.4.
3. Push Button
Briefly describe the main goal of the experiment.
Briefly describe the experiment procedure in Step 6 in Section 13.5.
4. LEDs
Briefly describe the main goal of the experiment.
Briefly describe the experiment procedure in Step 4 in Section 13.6.
II. RESULTS
Do not interpret or analyze the data in this section. Just provide the results.
1. Provide applicable data collected in this laboratory from Table 13.1.
III. ANALYSIS
Provide details of your calculations (methods used) for analysis for each of the following:
1. Optical switch response from Step 7 in Section 13.3.
2. Micro switch and digital response from Step 6 in Section 13.4.
3. Push button and digital response from Step 6 in Section 13.5.
4. Comparitive analysis in Step 7 in Section 13.5.
5. Observations in Step 4 in Section 13.6.
96
16.12
I. PROCEDURE
1. Running the Oscilloscope
Briefly describe the main goal of the experiment.
2. Micro Switch
Briefly describe the main goal of the experiment.
Briefly describe the experimental procedure in Step 4 in Section 14.4.
3. Push Button
Briefly describe the main goal of the experiment.
Briefly describe the experimental setup in Step 3 in Section 14.5.
II. RESULTS
Do not interpret or analyze the data in this section. Just provide the results.
1. Optical switch response from Step 6 in Section 14.4.
2. Micro switch and digital response from Step 5 in Section 14.5.
3. Cross channel response from Step 7 in Section 14.5.
III. ANALYSIS
Provide details of your calculations (methods used) for analysis for each of the following:
1. Trigger settings in Step 4 in Section 14.4.
2. Trigger settings in Step 3 in Section 14.5.
3. Micro switch observations in Step 6 in Section 14.4.
4. Push button observations in Step 5 in Section 14.5.
5. Comparitive analysis in Step 6 in Section 14.5.
6. Cross talk analysis in Step 7 in Section 14.5.
v 1.0
16.13
PROFESSIONAL APPEARANCE
Has cover page with all necessary details (title, course, student name(s), etc.)
Each of the required sections is completed (Procedure, Results, Analysis and Conclusions).
Typed.
All grammar/spelling correct.
Report layout is neat.
Does not exceed specified maximum page limit, if any.
Pages are numbered.
Equations are consecutively numbered.
Figures are numbered, axes have labels, each figure has a descriptive caption.
Tables are numbered, they include labels, each table has a descriptive caption.
Data are presented in a useful format (graphs, numerical, table, charts, diagrams).
No hand drawn sketches/diagrams.
References are cited using correct format.
98
REFERENCES
[1] Quanser Inc. QNET Mechatronic Sensors Trainer User Manual, 2011.
[2] Agilent Technologies. Practical Temperature Measurements (Application Note 290), 2008.
[3] Wikipedia. Thermistor. http://en.wikipedia.org/wiki/Thermistor.
v 1.0