ME 588 Lab 4
docx
keyboard_arrow_up
School
Purdue University *
*We aren’t endorsed by this school
Course
588
Subject
Mechanical Engineering
Date
Feb 20, 2024
Type
docx
Pages
14
Uploaded by mailrahultanwar
ME 588 – Section 4
Lab 4: Analog I/O & Sensor Integration
Wednesday Lab – 09/21/22
Lab Summary:
The purposes of this lab were to analyze and change analog input and output signals and to calibrate sensors in a circuit. In order to analyze and change analog input and output signals, we first used a function generator to create an input signal. We then read this signal through an Arduino and saw how the PWM output compared to the input signal in a circuit. Then, we used hardware and software filters to filter out noise in the signals of sensors. In order to calibrate sensors in a circuit, we integrated analog and digital IR sensors and saw how their output changed for different stimuli in the surroundings. In our case, we used the distance of an object from the sensor. The first thing that we learned was how reading and outputting analog signals with hardware and software can change the signal. One must be careful not to push the system past its limits in order to retain the entire signal. The second thing that this lab shed light on was the differences between hardware and software filtering. We learned that each type of filtering has its own advantages and disadvantages, and how to effectively use each for different purposes. A third core thing that was learned was integrating sensors into a circuit. This is extremely valuable as this lets a system make decisions based on its surroundings by connecting real life stimuli to digital and analog signals. Lab Analysis
Section A: Analog I/O
Q1
. Assemble the circuit shown in Circuit 1, in appendix A, and select values of R and Q that give the filter a cutoff frequency of roughly 100 hz.
A1.
R = 150 Ω, C = 10 µF were used, giving
f
c
=
1
2
πRC
=
106
hz
Q3.
What do the numbers shown on the serial monitor show
A.3.
The numbers vary between zero and 255. They are the duty cycles of the output PWM signal.
Q.4.
Calculate the quantization interval of the Arduino ADC. Why is this value important?
A.4.
i
=
V
¿
n
bits
=
5
V
1024
bits
=
.00488
v
. This is the smallest change in voltage that the ADC can pick up. Its also the threshold above which noise will be detected.
Q.5
Observe the oscilloscope output. How do they compare? Does the serial monitor being turned on affect this?
A.5
. See the figure below. As can be seen, the filtered output from the PWM output matches closely with the analog input waveform. This is not affected by the serial monitor.
Q.6.
Adjust the frequency of the input. Can you find the critical frequency where they no longer match?
A.6.
At roughly 25 Hz input, the phase difference between the two signals hits 90 degrees. At 40 Hz, the shape begins to break down due to gain rolloff and phase difference. At 100 Hz, the signal is lost entirely.
This occurs because the filter imposes a -20 db/decade gain rolloff and -90 degree phase drop above the cutoff frequency, but because the bode plot isn’t perfectly linear, some of that occurs before the cutoff. The behavior of the signal being lost entirely above 100 Hz is as expected. Section B: Analog Sensor Reading
Q2.
Using the oscilloscope, observe the noise on the analog IR sensor output Vo (Do not block the
sensor lens). What is the noise range in volts? Include an oscilloscope screenshot in your report
A2.
The observed noise range is 1.27 to 1.34 Volts, or .07V. The maximum and minimum values in this range are hard to see in the figure below which is zoomed out for a better view, but this range was evident when zoomed in.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Q5.
Using the calculated quantization interval, how many digital codes will be spanned by the measured broadband noise voltage range? Can you verify it in the Serial Monitor of Arduino? If so,
plot the data from the Serial Monitor. If not, explain the reason.
A5.
Since the quantization interval is 1024codes/5V, there will be about 14.3 digital codes spanned by the measured broadband noise (see equation below). This can be seen in the figure below as the peak value of the broadband noise is about 280 codes and the trough is about 266 (a range of about 14 codes).
dig codes
[
codes
]
=
Q
[
codes
V
]
⋅
noise
[
V
]
=
1024
5
⋅
.07
=
14.336
codes
Q6.
The analog IR sensor output includes a periodic spike of noise. Identify the frequency and maxi-
mum amplitude of the noise spike. Include an oscilloscope screenshot in your report.
A6.
The maximum amplitude of the spike is about 0.49V (1.75V-1.26V). This can be seen in the figure below as the max and min of the spike. The frequency of this spike is about 1000 Hz. This can be seen in the figure below by 1/period, where the period was 1ms.
Q7.
Using the calculated quantization interval, how many digital codes will be spanned by the measured noise spike amplitude? Can you verify it in the Serial Monitor of Arduino? If so, plot the
data from the Serial Monitor. If not, explain the reason.
A7.
Since the quantization interval is 1024codes/5V, there will be about 100 digital codes spanned by the measured noise spike (see equation below). This can be seen in the figure below as the peak value of
the noise spike is about 360 codes and the trough is about 260 (a range of 100 codes). dig codes
[
codes
]
=
Q
[
codes
V
]
⋅
noise
[
V
]
=
1024
5
⋅
.49
=
100.352
codes
Q8.
Build an RC filter at the IR sensor output Vo to filter out noise spikes. Use the oscilloscope to
compare the unfiltered and filtered signals. Does the filter work? What is the break frequency of the filter? In your report, include a screenshot of the comparison of unfiltered and filtered
signals.
A8.
The filter worked very well as shown in the figure below. The green line is the unfiltered signal and the yellow is the unfiltered signal. We have offset these signals to make them more easily viewable. As you can see, the yellow signal had its noise greatly reduced/cut off. The break/cutoff frequency of the filter was 106Hz as shown in the equation below. This ensured that the higher frequency noise spikes would be removed.
f
c
=
1
2
πRC
=
1
2
π
(
150
Ω
) (
10
μF
)
=
106.10
Hz
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Q10.
Collect the raw IR sensor reading data and the associated filtered data online concurrently in the
Serial Monitor. Plot both data in one figure and see their difference. Include the comparison
figure in the report. (Not offline data filtering.)
A10.
As you can see in the figure below of the serial plotter, the filtered (blue) signal has significantly less noise spikes than the unfiltered (red) signal using an averaging filter. The code for this can be seen in Appendix 2.
Q11.
Instead of an averaging filter, use the one-dimensional median filter with a window size of three
developed in the Prelab assignment. How well does this filter work? Collect the raw IR sensor
reading data and the associated filtered data online concurrently in the Serial Monitor. Plot both
data in one figure and see their difference. Include the comparison figure in the report. (Not the
offline data filtering.)
A11.
:(
Q12.
Identify two advantages and disadvantages for the hardware (RC filter) implementation.
A12.
One advantage of the hardware RC filter is that the cutoff frequency is easily chosen since it follows
a simple equation. Another advantage of the RC filter is that you retain the whole signal before the cutoff frequency, whereas in software filters you might lose some data points. On the other hand, one disadvantage of the RC filter is that it is not easily changed postproduction. With software, a cloud update could be done but changing hardware would require reconstruction. Another disadvantage is that noise before the cutoff frequency is still retained. This can be seen in Figure ____ since the broadband noise is still present in the yellow signal. (I think we cannot say this as the input signal also has noise.)
However, we can mention that the output signal from hardware RC filter will always be less than the input signal due to Capacitive reactance, as it acts like a potential divider. This is evident from the data captured in Q8 where input and output are overplotted. To retain a similar level of input, RC filter output needs to be amplified
....
Rahul
Q13.
Identify two advantages and disadvantages for software implementations.
A13.
One advantage of software implementations of filtering data is that it is easily manipulated to fit different needs. You can easily reuse code by copying and pasting, whereas in hardware you must physically rebuild circuits for testing. Another advantage of software implementations is that signals can be averaged over a certain period. This is different from an RC filter that will cut off all data above a certain frequency. Sometimes seeing noise or outliers in data can be a good thing. On the other hand, one disadvantage of software limitations is that it can take longer to develop during testing. An RC filter can take less than a minute to implement, whereas a software script can take a few minutes to a few hours to write. Another disadvantage of software implementations is that it can cost more initially. Filtering a signal with hardware can cost less than a dollar whereas a software system can cost north of one hundred dollars to set up.
Section C: Digital IR Sensor Calibration
Q1. Does your code work as expected?
Answer:
Yes, the code works fine.
Q2. According to the specification sheet, at what range of distances will the digital sensor output a
LOW signal?
Answer
: From 20mm to 100mm, sensor output is LOW signal.
Q3. Using a yard stick (or tape measure), record the range of distances for which your digital sensor
actually outputs a LOW signal.
Answer
: Observed range of low signal is 10mm to 100mm.
Q4. Does your measured range match the specification sheet value?
Answer
: Yes, the obtained range of 10mm to 100mm for LOW signal output is close to the specification
of 20mm to 100mm.
Section D: Analog IR Sensor Calibration
Q1. Does your code work as expected?
Answer:
Yes, the code works fine.
Q2. Using a yard stick (or tape measure) to measure distance, and a multimeter to measure voltage,
create a graph of the relationship between output voltage and object distance.
Answer
:
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Q3. What is the maximum output voltage from your analog IR sensor, and at what distance does it
occur?
Answer
: The maximum output voltage from sensor is 3.1V and it occurs at 30mm from sensor.
Q4. Does your data match with the values given in the graph on the specification sheet? If not, why do
you think this is so?
Answer
: The peak value of sensor output matches with the specification value i.e., 3.1V. However, the
peak output was observed at 30mm distance compared to specification of 5mm. As per
specification, for farther distances the output stagnates at around 0.55V compared to observed
value of 1V to 1.3V. As per the specification sheet (attached below), the output voltages at farther
distance are for a specific reflective white paper made by Kodak Co. This might be the source of
error for us as the reflectivity of the paper used might be different than the control.
Conclusion
The main finding of analog I/O was that analog signals sometimes suffer due to being read in and out of systems. The process of converting the analog signal to a PWM signal, then filtering it back to an analog one resulted in phase lag and gain loss occurring. One main finding in analog filtering is that key differences exist between software and hardware implementations with each having its own benefits and drawbacks as discussed earlier. Another key finding in sensor calibration is that input signals can be noisy and not exact, but with proper circuit design sensors are an effective way of
changing real-world information to signals. Overall, this lab was very effective in teaching us how to read, output, and change digital and analog signals. Appendix 1: Circuit Figures
Circuit 1 – PWM Filtering Setup
Circuit 2 – Digital IR sensor powering circuit with external LED
Circuit 3 – Analog IR sensor powering circuit with external LED
Appendix 2: Code Used in Lab
Part B averaging filter
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Part median filter code
Digital IR sensor code:
Analog IR sensor code:
Related Documents
Related Questions
Subject: Mechanical Measurements
Do not copy other online answers
arrow_forward
Subject: Mechanical Measurements
arrow_forward
Design and develop a suitable processor-based Data Acquisition (DAQ) system and external hardware to interface, measure, display and store the responses from the selected sensors.
arrow_forward
Sensor systems for obstacle detection and avoidance in mobile robots.
• Produce a written report documenting: the choice of sensors, sensor evaluation, the developed processor/measurement system, and overall system performance.
arrow_forward
Sensor systems for obstacle detection and avoidance in mobile robots.
• Design and develop a suitable processor-based Data Acquisition (DAQ) system and external hardware to interface, measure, display and store the responses from the selected sensors.
arrow_forward
i need a explanation about this picture and what it's work the system of DCV In detail and briefly please
arrow_forward
• Characterize and evaluate the sensor performance use real data already collected or extrapolated information from the sensor datasheets.
• Produce a written report documenting: the choice of sensors, sensor evaluation, the developed processor/measurement system, and overall system performance.
arrow_forward
Answer the following questions, to test your understanding of sampling frequency and bit depth.
1. You are part of new automobile design team, and are responsible for designing the sensor data
collection system. The specification of the data collection system is that is must be capable of
receiving data with a resolution down to 0.1% of full scale (1 part in 1000) for any given sensor.
For example, suppose the driver pushes the gas pedal, the motion of which is read by an
electronic sensor such that the range of motion is defined from 0 (not pressed) to 1 (fully
pressed). If you want 0.1 % accuracy, you need 1000 possible data values between 0 and 1.
How many bits do you need to represent data to 0.1% accuracy?
Insert a picture of your work.
arrow_forward
magnitudes F₁
A scissors truss supports three forces at joints B, C, and D as shown in the figure below. The forces have
35 kip, F₂ = 10 kip, and F3 = 25 kip. The truss is held in equilibrium by a pin at point A
and a roller at point E. Note that sides ABC, CDE, AFD, and BFE are straight lines, and member CF is vertical.
Joint F lies s = 12 ft to the right and h = 4 ft above joint A, and joint C lies h = 4 ft above joint F. Use the
method of joints to determine the force in each member of the truss, and indicate whether they are in
tension or compression.
Note: Express tension forces as positive (+) and compression forces as negative (-).
=
A.
HA
B
S
F₁
F₂
2
F
C
F3
D
S
E
A
h
h
arrow_forward
The equation for the line drawn in between In((T-
Tm)/(TO-Tm)) and time t is y=0.7x+5 for a
temperature sensor.
Find the time constant of a sensor.
Time constant in seconds
arrow_forward
For a 20x 1.0 NA objective with 300 nm resolution, Nyquist sampling is achieved by capturing image with [__how many_] nm pixels?
arrow_forward
Answer all parts show work
arrow_forward
For a 1-degree-of-freedom robot arm, it is needed to use a DC motor. Draw a blockdiagram for a mechatronic system that controls the position of this robotic arm forgripping objects. Suggest a sensor system and clarify the flow and nature of signals inyour block diagram.
arrow_forward
Please show step by step work
arrow_forward
) Explain the procedure adopted to arrive at the specification of piezo electric sensor charge amplifiercrank angle encoder and AD convener with data storage for heat release analysis of a given IC engine.
(b) Discuss the method of obtaining pressure crank angle diagram. List down the parameters that can bestudied from the pressure crank angle diagram.
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you

Elements Of Electromagnetics
Mechanical Engineering
ISBN:9780190698614
Author:Sadiku, Matthew N. O.
Publisher:Oxford University Press

Mechanics of Materials (10th Edition)
Mechanical Engineering
ISBN:9780134319650
Author:Russell C. Hibbeler
Publisher:PEARSON

Thermodynamics: An Engineering Approach
Mechanical Engineering
ISBN:9781259822674
Author:Yunus A. Cengel Dr., Michael A. Boles
Publisher:McGraw-Hill Education

Control Systems Engineering
Mechanical Engineering
ISBN:9781118170519
Author:Norman S. Nise
Publisher:WILEY

Mechanics of Materials (MindTap Course List)
Mechanical Engineering
ISBN:9781337093347
Author:Barry J. Goodno, James M. Gere
Publisher:Cengage Learning

Engineering Mechanics: Statics
Mechanical Engineering
ISBN:9781118807330
Author:James L. Meriam, L. G. Kraige, J. N. Bolton
Publisher:WILEY
Related Questions
- Subject: Mechanical Measurements Do not copy other online answersarrow_forwardSubject: Mechanical Measurementsarrow_forwardDesign and develop a suitable processor-based Data Acquisition (DAQ) system and external hardware to interface, measure, display and store the responses from the selected sensors.arrow_forward
- Sensor systems for obstacle detection and avoidance in mobile robots. • Produce a written report documenting: the choice of sensors, sensor evaluation, the developed processor/measurement system, and overall system performance.arrow_forwardSensor systems for obstacle detection and avoidance in mobile robots. • Design and develop a suitable processor-based Data Acquisition (DAQ) system and external hardware to interface, measure, display and store the responses from the selected sensors.arrow_forwardi need a explanation about this picture and what it's work the system of DCV In detail and briefly pleasearrow_forward
- • Characterize and evaluate the sensor performance use real data already collected or extrapolated information from the sensor datasheets. • Produce a written report documenting: the choice of sensors, sensor evaluation, the developed processor/measurement system, and overall system performance.arrow_forwardAnswer the following questions, to test your understanding of sampling frequency and bit depth. 1. You are part of new automobile design team, and are responsible for designing the sensor data collection system. The specification of the data collection system is that is must be capable of receiving data with a resolution down to 0.1% of full scale (1 part in 1000) for any given sensor. For example, suppose the driver pushes the gas pedal, the motion of which is read by an electronic sensor such that the range of motion is defined from 0 (not pressed) to 1 (fully pressed). If you want 0.1 % accuracy, you need 1000 possible data values between 0 and 1. How many bits do you need to represent data to 0.1% accuracy? Insert a picture of your work.arrow_forwardmagnitudes F₁ A scissors truss supports three forces at joints B, C, and D as shown in the figure below. The forces have 35 kip, F₂ = 10 kip, and F3 = 25 kip. The truss is held in equilibrium by a pin at point A and a roller at point E. Note that sides ABC, CDE, AFD, and BFE are straight lines, and member CF is vertical. Joint F lies s = 12 ft to the right and h = 4 ft above joint A, and joint C lies h = 4 ft above joint F. Use the method of joints to determine the force in each member of the truss, and indicate whether they are in tension or compression. Note: Express tension forces as positive (+) and compression forces as negative (-). = A. HA B S F₁ F₂ 2 F C F3 D S E A h harrow_forward
- The equation for the line drawn in between In((T- Tm)/(TO-Tm)) and time t is y=0.7x+5 for a temperature sensor. Find the time constant of a sensor. Time constant in secondsarrow_forwardFor a 20x 1.0 NA objective with 300 nm resolution, Nyquist sampling is achieved by capturing image with [__how many_] nm pixels?arrow_forwardAnswer all parts show workarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Elements Of ElectromagneticsMechanical EngineeringISBN:9780190698614Author:Sadiku, Matthew N. O.Publisher:Oxford University PressMechanics of Materials (10th Edition)Mechanical EngineeringISBN:9780134319650Author:Russell C. HibbelerPublisher:PEARSONThermodynamics: An Engineering ApproachMechanical EngineeringISBN:9781259822674Author:Yunus A. Cengel Dr., Michael A. BolesPublisher:McGraw-Hill Education
- Control Systems EngineeringMechanical EngineeringISBN:9781118170519Author:Norman S. NisePublisher:WILEYMechanics of Materials (MindTap Course List)Mechanical EngineeringISBN:9781337093347Author:Barry J. Goodno, James M. GerePublisher:Cengage LearningEngineering Mechanics: StaticsMechanical EngineeringISBN:9781118807330Author:James L. Meriam, L. G. Kraige, J. N. BoltonPublisher:WILEY

Elements Of Electromagnetics
Mechanical Engineering
ISBN:9780190698614
Author:Sadiku, Matthew N. O.
Publisher:Oxford University Press

Mechanics of Materials (10th Edition)
Mechanical Engineering
ISBN:9780134319650
Author:Russell C. Hibbeler
Publisher:PEARSON

Thermodynamics: An Engineering Approach
Mechanical Engineering
ISBN:9781259822674
Author:Yunus A. Cengel Dr., Michael A. Boles
Publisher:McGraw-Hill Education

Control Systems Engineering
Mechanical Engineering
ISBN:9781118170519
Author:Norman S. Nise
Publisher:WILEY

Mechanics of Materials (MindTap Course List)
Mechanical Engineering
ISBN:9781337093347
Author:Barry J. Goodno, James M. Gere
Publisher:Cengage Learning

Engineering Mechanics: Statics
Mechanical Engineering
ISBN:9781118807330
Author:James L. Meriam, L. G. Kraige, J. N. Bolton
Publisher:WILEY