python代写-Digital Signal processing

Assignment 3, Digital Signal processing: IIR filters

This assignment covers IIR filters which as before can be low/high/band or stopband filters.

Your task is to measure a (noisy) physical quantity and use realtime IIR filtering to turn the raw noisy signal into a smooth, tidy signal.

We have 25 Arduinos, 2 Attys DAQ boards ( and 6 USB-DUX boards ( All can operate in realtime under Python. Links to the APIs and examples are provided on moodle.

  • The Arduinos are the standard option and work under both Windows and Linux. They have a sampling rate of 100 Hz.
  • The USB-DUX boards run under Linux only and offer sampling rates of up to 8 kHz.

    They are also electrically isolated and can be used for biomedical applications.

  • We also have two wireless biomedical bluetooth DAQs called “Attys” which run under both Linux and Windows.

    Examples of noisy signals you can measure:

  • Temperature using the voltage drop over a diode
  • Temperature using a thermocouple (i.e. two different metals)
  • Pulse detection using an light dependent resistor
  • Atmospheric pressure changes
  • Distance sensing via a capacitor
  • Mechanical strain measurements with a piezo sensor
  • IR remote with a flashing IR light
  • Realtime ECG heartbeat detection during exercise using a bandpass/highpass (biomed team)
  • Displaying EEG alpha/beta waves (biomeds team)


  • Detecting the small oscillometric pressure changes in the blood pressure cuff (biomed team)

Hackaday has a lot of good examples and other Maker pages. You can create your circuit on a breadboard, matrix board, etc. Feel free to use any component which is in the electronic component store on level 7 and you can also order components (within a sensible budget!).

Every team needs to measure something differnet. Add your topic to the wiki provided on moodle as soon as possible.

Again you work in teams of two students and one report is submitted per team.

This task requires planning/initiative before you come to the lab. Think of a scenario before the lab starts. It’s not the task of the lab demonstrators / technicians to come up with ideas here and they need to come genuinely from you. I’d like to see different ideas from every team. Enter you project ideas on the WIKI on moodle so that others can see what’s already taken. Feel free to discuss it with us.

  1. Present a measurement problem which requires realtime filtering. Marks are given for initiative, inventiveness and originality (= ideas which haven’t come straight from the lecturer, lab demonstrators or other groups). Document the experiment with:
    • photos of the setup
    • dataflow diagrams
    • YouTube clip(s)

      in addition to your report. How would you like to present the results? Just as a plot or perhaps a bar graph? QT for Python might be an option to look into. [20%]

  2. Design a simple analogue circuit for your measurement. This could be as simple as two/three components on breadboard or more complex with an instrumentation / op- erational amplifier. Generally the aim is to be simple but effective. [10%]
  3. Determine the filter response(s) which are required and justify them. Generate the sos coefficients for the filter(s) either with the help of Python’s high level functions or solutions shown in the lecture. [20%]
  4. Write two classes:
    1. IIR2Filter which implements a 2nd order IIR filter which takes the coefficients in the constructor and has a method called:


      where y and x are simple scalars (no arrays) as usual. Optimise this class that it won’t need any arrays for its buffers and coefficients.

    2. a class IIRFilter which directly takes the sos array from the high level IIR design commands as its constructor argument and which then creates a chain of 2nd order filter instances of IIR2Filter classes. Thus they form an array of instances of IIR2Filter. Again implement a function which then filters the signal:


    and then internally processes the data x by sending it through the chain of 2nd order IIR2Filter classes.


  5. Compare your filtered results with the original recordings, show both signals in the realtime demo (YouTube clip) and discuss if you have been successful. Do a critical analysis. [20%]

High level design commands are allowed but the actual IIR filtering operations need be written from scratch as outlined above. Any use of lfilter or other high level python filter operation will result again in zero marks. Proof of realtime processing in form of a video needs to be given and the video needs to show clearly what it’s about. If you don’t like speaking you can also use subtitles or graphics. Please add your link to the wiki.

The report can also be written purely on github which should then contain the software, the report itself as a README/WIKI and the video clip. In this case please submit a single page to the teaching office containing the link to github and add the link to github to the WIKI.

As before I expect sharp figures in vector format in the report. The complete code needs to be in the appendix and also uploaded to moodle.

Deadline for the report is 17th Dec 3pm. If you leave earlier for the Christmas break make sure to submit the paper report before you leave.