首页 > > 详细

辅导 MENG10005 Signals and Dynamics讲解 Python编程

MENG10005 – Lab Guidelines

Signals and Dynamics

Lab overview

Executive summary

For your fourth, and summative, at-home lab, the focus will be on the digital acquisition of time-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, and submission will be blocked until this is complete. 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 demonstrate 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.

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 videos from session 16 content.

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

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 guide of the circuit construction. There are also videos 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 environment that you have been using during the Pico programming. You can then use your set-up to capture 2 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.

2.2. Plotting and processing signals using Python

To view and analyse the test signals, you will need to write some Python code. This should be written in Spyder (not Thonny) and executed on your computer. This code (.py file and .csv files) will be used to develop your final code and check your data acquired from the Pico. A list of the main steps your code should follow are found below:-

1. Read the signal data from .csv file

2. Plot the time history (time on x-axis and Analog to Digital Converter (ADC) output on the y-axis (n.b. think carefully about what this entity is and what units (if any) might be appropriate)

3. Calculate the number of times the signal crosses the x-axis by counting the crossing points of the wave (see Figure 1) with the DC component removed. i.e. Your data will not be centred around zero, because of the DC component, so think carefully about how you could adjust it in your analysis.

4. Calculate the frequency of your signal using the number of times the signal crosses the axis and in what time period

Use the data collected from the 2 test signals described in section 2.1 and your newly written Python script. to test and verify the circuit and ADC process. This will help you establish whether your data acquisition and signal processing is functioning as expected before running through the rest of the experiment.

Figure 1 - Graph of amplitude versus time, showing the signal data with DC component removed (red line and points) with line between points before and after crossing point (black line) and crossing point (black cross). Showing the signal has crossed the x-axis 10 times during the sampling period of 10 milliseconds

2.3. Developing your python code for experimental data

The python code will need to be extended and modified to be able to handle the experimental data collected from ruler.

The python code will need to include the following additional processes:-

1. Crop the data so that only the period when the sound from the ruler is significantly large enough above the noise is visible, as shown in Figure 2(a/b).

2. Filter the data, to limit the effect of background noise on your signal analysed, as shown in Figure 2(b/c). A cut-off frequency should be selected by a combination of engineering estimation and trial and error.

3. Calculate the frequency for each overhang length.

4. Calculate and output the Young’s modulus for the ruler.

n.b. Aspects of the technical detail of steps 1-4 are described in section 3.

3. Estimate the Young’s modulus of the material

3.1. Context

In a disaster relief situation, you need to make emergency repairs to an ambulance’s suspension. After consulting the design specification, 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.

3.2. Advised approach

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.

where, f is the fundamental frequency in Hz, E is the Young’s Modulus, I is the second moment of area, q is the mass per unit length, L the free overhang length of the cantilever. N.B. use SI units to avoid dimensional errors (take care to use mass per unit length, i.e. in units of kg/m). You will have considered how best to design your experiment during Session 17, and should follow the process that you have designed. A very rough outline for an example procedure is provided in the following steps:

1. Place the microphone close to the ruler.

2. Clamp the ruler with a known overhang length (e.g. by clamping it between a hardback book and a table edge, as shown in Figure 3). Use the overhang value you chose during Session 17.

3. Run DataAcquisition.py in Thonny and ‘twang’ the ruler (see video HERE). Repeat this measurement at least 3 times in total.

4. Repeat steps 3 and 4 for overhangs of different lengths.

Figure 3 - Experimental setup for an example 120 mm overhang. Note that the board and circuit pictured are not the same ones you are using, and this image has not been presented to the standard expected in a lab report (i.e. it is not labelled and is just intended to give a possible set up approach).

Report your estimated Young’s modulus and comment on the limitations and range of probable values, sensitivity to errors in the various measurements, and whether the material is likely to be appropriate.





联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!