MENG10005 – Lab Guidelines
Executive summary
For your fourth, and summative, at-home lab, the focus will be on the digital acquisition of time_xFFFE_varying signals and their application to a simple dynamic system to estimate material properties.
You will need to read and engage with the associated signals and dynamics risk assessment before
carrying out any experiments. This home lab revises the use of op amps to amplify small signals that
we previously used in the strain lab. You will also need to use some of the skills learnt in the
computing and programming sessions of this course. This document introduces the lab and gives
some of the techniques that you will use to carry out the experiments and collect the data.
Signals and Dynamics
Lab overview
2
MENG10005 – Lab Guidelines
1. Introduction
As discussed during Session 17, there are multiple ways of calculating the Young’s modulus of a
material. For this lab, you will be measuring the natural frequency of a vibrating metal ruler. You will
take this measurement multiple times and for multiple lengths of ruler to estimate the Young’s
modulus of the material.
To complete this lab, you will need to work through the following four activities:
Development of the electronics required to take a measurement of time varying air pressure
(i.e. sound);
Evaluation of the influence of sample rate on signal capture;
Creation of Python code to plot signals and extract an estimate of their frequency content;
Use of the system (electronics and code) to evaluate the natural frequency of a simple, single
degree of freedom oscillator, and estimate the Young’s modulus of the material.
1.1.Time varying signals
In addition to the topics covered during Session 17,, more supporting taught content is provided in
the asynchronous video associated with the laboratory. It covers the following core principles:
Quantisation error
Nyquist frequency
Aliasing
These principles have been covered in the video HERE by Sean. You will have already watched this
video and completed the associated Blackboard quiz to be able to access this document.
1.2. Microphone Circuit Safety and Advice
Safety is a critical concern during the building of the circuit, and after reading this overview document
you must read the full risk assessment and complete the associated test. As a reminder, ensure you
wear the safety glasses provided to avoid small bits of wire pinging into your eyes and ensure that
others in your household are not working in a proximity that could cause them harm. Once you have
finished, vacuuming the area is an appropriate precaution as the small wire trimmings may still be
scattered and are a risk to pets, small children and others using the space.
2. Evaluation of known signals and aliasing
Before collecting any data, you will need to build an electronic circuit to allow you to amplify the
output from the microphone to a voltage signal that is large enough for your Raspberry Pi Pico to
detect and record. The Blackboard folder for this lab contains information about the electronics
required to take measurements and a step-by-step video of the circuit construction. There are also
videos by Sean supporting this content, which can be found HERE on BB. This content will only
become available to you after you have read the risk assessment and completed the associated
test.
2.1. Acquiring signals
Once you have built the circuit, download the provided data acquisition code (DataAcquisition.py)
from BB HERE and watch the associated video to learn how to use it to sample from the ADC pin of
your Pico and download the recording to your computer. You will be doing this in the Thonny
3
MENG10005 – Lab Guidelines
environment that you have been using during the programming sessions with Ian Laird. You can
then use your set-up to capture 3 test signals:
1. A vocal hum (from your own voice) which produces a reasonably sinusoidal profile when
sampled at 5 kHz.
2. A 500 Hz tone produced by
the online tool HERE when sampled at 5 kHz. You will need to
adjust the frequency of the tone generated, and remember to start with a low volume as
advised in the risk assessment to avoid damaging your hearing.
3. A 1 kHz tone produced by the online tool HERE when sampled at 1.5 kHz.
2.2. Plotting and processing signals using Python
To view and analyse these data, you will need to write some Python code. This should be written in
Spyder (not Thonny) and executed on your computer. Your code should achieve the following:
1. Read in the signal from its .csv file and convert it to a numpy array.
2. Plot the time history (time on the x-axis and the Analog to Digital Converter (ADC) output on
the y-axis) of ~4 complete wave cycles. Matplotlib will be useful for this, as covered in
Session 4.
3. Calculate the frequency of vibration by counting the crossing points of the wave with the DC
component of your signal (see Figure 1 for a crude example) over a set time period.
Note, if you have set your potentiometer (POT) correctly, the DC component should be at half the
full range scale which, because the data is stored as 16-bit integers, is 65535
2
(see the example Figure
1 which shows the DC component at approximately 32800). However, you may wish to estimate this
as the mean of your signal, so you aren’t reliant on precise tuning of the POT.
Figure 1 – Audio signal from 500Hz tone, sampled at 5kHz to illustrate crossing points with the DC
component from the POT.
There are many ways to calculate the location of crossing points. One suggested method would be
to:
Subtract the DC component from the signal;
Use the numpy.sign function to set the outcome of the subtraction to -1 where it is negative
and 1 where it is positive;
Iterate through this signal in a for loop, comparing each entry to the previous one using an if
statement to record its location in the list if the values are different.
Use the data collected from these 3 tests and your newly written Python script to discuss the
advantages and limitations of ADC and reference 1 method to avoid the collection of erroneous data
as a result of insufficient sampling frequency. This will help to inform the discussion section in your
lab report.
4
MENG10005 – Lab Guidelines
3. Estimate the Young’s modulus of the material
In a disaster relief situation, you need to make emergency repairs to an ambulance’s suspension.
After consulting the manual, you discover that a material with properties close to the Young’s
modulus of steel would be a suitable replacement to the vehicle’s leaf spring. As a result of the
emergency, access to sophisticated material testing facilities are not available. You have a basic
microphone, a low-cost microcontroller, and an offcut of some material found in the disaster site.
Using an offcut (which is your lab kit ruler (imagination required)) you perform a rudimentary test to
establish the order of magnitude of its Young’s modulus using the following steps and equations.
Using the same circuit and Python scripts as before, measure the natural frequency of the ruler.
Note, to avoid noise effecting your crossing point location too much you may need to crop the signal
around the sound of the ruler and filter it. To filter the signal you can use the Butterworth (or any
other appropriate) filter, as described in section 5 of the BB page for this lab, with a cut-off frequency
selected by a combination of engineering estimation and trial and error. An example signal, cropped
and then filtered, is given in Figure 2.
Figure 2 – An example of a signal captured from a ruler ‘twang’ a) in full, b) cropped and c) cropped and
filtered using a Butterworth filter.
As we discussed in Session 17,, the first mode of vibration (fundamental frequency) can be related
to the mechanical properties of the oscillator, use Eq. (1) to estimate the Young’s modulus of the
beam once you have established the fundamental frequency from the data.
= 0.56√