實驗二:生醫信號量測電路之設計cc.ee.ntu.edu.tw/.../02_bio_signal/exp2_108-1.pdf ·...

Post on 23-Sep-2020

8 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

實驗二:生醫信號量測電路之設計

2019/10/09

Experiment Overview

• Part 1• Design ECG and EMG circuit for bio-signal detection

• Digitize (ADC) waveform with a microcontroller (MCU)

• Transmit to the self-designed APP via bluetooth

• APP: Bluetooth connection、waveform display

• Part 2 • Filter the EEG’s alpha 、 beta、theta、delta wave

using a digital filter

Introduction

• Characteristics of ECG, EMG, and EEG waveform• Based on the findings from experiment 1 and published

reports/journals

• Examples: amplitude, frequency and bandwidth

• Design your own detection circuit(s)• Use NI ELVIS II to test the effectiveness of your circuit

• Energy efficient circuit• The trade-off between power

consumption and accuracy

We only consider accuracy when rating

Simplified Layout of Detection Circuit

Signal Inputs

(3 Leads)Pre-Amplification

Filter

(LPF / HPF /

NOTCH / BPF)

Post-Amplification

Signal Output

(0V – 5V)Voltage Level Shifter

ADC

Display

Circuit

問一:為什麼要放大兩次(或多次)?

Signal Inputs

(3 Leads)Pre-Amplification

Filter

(LPF / HPF /

NOTCH / BPF)

Post-Amplification

Signal Output

(0V – 5V)Voltage Level Shifter

ADC

Display

Circuit

答一:Noise Figure

• 如何達成最高的增益、最低的雜訊指數?

(越小越好)Noise Figure:

大 小 小 小

中 中 中 中

G1↑

G1↓

SNR越大越好

問二:信號有三個輸入,怎麼接OPA?

VIN+

VIN-

GND

非反向放大電路

答二:差動放大器 (減法器)

VIN+

VIN-

GND

問三:可以用加法器嗎?

VIN+

VIN-

GND

答三:不行,輸入端的雜訊會被放大

Vn +

Vn +

Vn +

Vn +

Vn +

Pre-Amplification

Input 1 R3

+

+

R1

R5

+

R2

A1

A2

A3 Output

R4

R6

Gain set

Gain set

Input 2

Vin1 + Vcm

RG

Vin2 + Vcm

Vout = Acl(Vin2 - Vin1)

差動放大器 儀表放大器 (INA128)

Filter

• 從頻譜以及文獻看訊號主要的頻帶在哪

• 設計適當的濾波器• 高通濾波器

• 低通濾波器

• 帶通、帶拒濾波器 (60Hz 市電雜訊)

• 濾波器中的R跟C要設多少

How to design a filter?

• https://www.changpuak.ch/electronics/index.php

How to design a filter?

• https://www.changpuak.ch/electronics/index.php

How to design a filter?

• https://www.changpuak.ch/electronics/index.php

How to design a filter?

• https://www.changpuak.ch/electronics/index.php

How to design a filter?

• https://www.changpuak.ch/electronics/index.php

How to design a filter?

• https://www.changpuak.ch/electronics/index.php

Ideal filter

1

2𝜋𝑅𝐶

Feedback = Q

Buffer

• 使前一級電路不受負載影響

R=∞

Post Amplifier

• 基本OP放大器

• non-inverting amplifier

• Gain=1+R2/R1

Level Shifter

• Arduino uno接收電壓範圍0~5V

• 透過分壓讓訊號平移至0V以上

• 𝑉𝑜𝑢𝑡 = 𝑉+ 1 +𝑅2

𝑅1

• 𝑉+ =𝑅3𝑉2

𝑅3+𝑅4+

𝑅4𝑉1

𝑅3+𝑅4

•不能送負的電壓進去Arduino

This detection circuit could be the platform for building your term project

NI ELVIS 電路測試板

• 外觀

NI ELVIS 電路測試板

• 電源供電方式

電源線

NI ELVIS 電路測試板

USB線 電源來源

電源記得打開

NI ELVIS 電路測試板

• 確認是否正常運作

電源記得打開

1. PROTOTYOING BOARDPOWER:綠燈

2. USB READY:橘燈

3. DC Power Supply Indicators:綠燈

NI ELVIS 電路測試板

• NI ELVISmx Instrument Launcher開啟方式

1. 開始+搜尋:NI ELVISmx

2. 點擊NI ELVISmx Instrument Launcher

NI ELVIS 電路測試板

• NI ELVISmx Instrument Launcher開啟樣

DMM (Digital Multimeters):三用電表Scope (Oscilloscope):示波器FGEN (Function generator):訊號產生器VPS (Variable power supply):可調電源供應器Bode (Bode plot):波德圖

NI ELVIS 電路測試板

• DMM (Digital Multimeters) – 量電阻

Step 1

Step 2

NI ELVIS 電路測試板

• DMM (Digital Multimeters) – 量電阻

Step 1

Step 2

Step 4

Step 3

無極性之分

NI ELVIS 電路測試板

• DMM (Digital Multimeters) – 量電容

Step 1

Step 2

NI ELVIS 電路測試板

• DMM (Digital Multimeters) – 量電容

Step 1

Step 2

Step 3

Step 4

有極性之分

NI ELVIS 電路測試板

• VPS (Variable power supply):供電

Step 1 Step 2

NI ELVIS 電路測試板

Vcc +

Vcc -

• VPS (Variable power supply):供電

GND

Step 3

NI ELVIS 電路測試板

• VPS (Variable power supply):供電

Step 1 Step 2

Step 4

NI ELVIS 電路測試板

• DMM (Digital Multimeters) – 量電壓

Step 1

Step 2

Step 3

Step 4

Vcc +

Vcc +

Vcc -

GND

NI ELVIS 電路測試板

• FGEN (Function generator):訊號產生器

Step 1

Step 3

Step 2

NI ELVIS 電路測試板

• Scope (Oscilloscope):示波器

Step 1

Step 2

Step 4

Step 3

NI ELVIS 電路測試板

• FGEN & Scope

NI ELVIS 電路測試板

• FGEN & Scope

NI ELVIS 電路測試板

• FGEN & Scope

垂直一格的寬度

水平一格的寬度

上禮拜三(10/2)在操作上出了甚麼問題?

• 重接就好了

By 助教

By 同學

NI ELVIS 電路測試板

• Bode (Bode plot):波德圖

Step 1

NI ELVIS 電路測試板

• Bode (Bode plot):波德圖

NI ELVIS 電路測試板

• Bode (Bode plot):波德圖

帶拒濾波器:截止頻率60Hz

Input Output

1. FGEN signal to the input of the circuit2. Reference point of the circuit to the GND signal on the prototyping board

GND

Step 1

Step 2

NI ELVIS 電路測試板

• Bode (Bode plot):波德圖

3. FGEN signal to the Stimulus Channel+4. Stimulus Channel- to the GND signal on the prototyping board

Stimulus Channel:AI 0Response Channel:AI 1

NI ELVIS 電路測試板

• Bode (Bode plot):波德圖

3. FGEN signal to the Stimulus Channel+4. Stimulus Channel- to the GND signal on the prototyping board

Stimulus Channel:AI 0Response Channel:AI 1

Step 3Step 4

NI ELVIS 電路測試板

• Bode (Bode plot):波德圖

5. The output of the circuit to the Response Channel+6. Response Channel- to the GND signal on the prototyping board

帶拒濾波器:截止頻率60Hz

Input

GND

Output

Step 5

Stimulus Channel:AI 0Response Channel:AI 1

NI ELVIS 電路測試板

• Bode (Bode plot):波德圖

5. The output of the circuit to the Response Channel+6. Response Channel- to the GND signal on the prototyping board

Stimulus Channel:AI 0Response Channel:AI 1

Step 6

NI ELVIS 電路測試板

• Bode (Bode plot):波德圖

記得電路要供電

NI ELVIS 電路測試板

• Bode (Bode plot):波德圖

NI ELVIS 電路測試板

• Bode (Bode plot):波德圖

NI ELVIS 電路測試板

• Bode (Bode plot):波德圖

CH 0:電路輸入CH 1:電路輸出

NI ELVIS 電路測試板

• Bode (Bode plot):波德圖CH 0 (綠色):電路輸入CH 1 (藍色):電路輸出

Simplified Layout of Detection Circuit

Signal Inputs

(3 Leads)Pre-Amplification

Filter

(LPF / HPF /

NOTCH / BPF)

Post-Amplification

Signal Output

(0V – 5V)Voltage Level Shifter

ADC

Display

~mV

Circuit

Arduino Uno

• Microcontroller evaluation board• ATmega328 microcontroller

• Clock: 16 MHz

• 14 Digital I/O

• 6 Analog inputs

• 10 bits ADC

• Software serial function

https://www.arduino.cc/en/Main/ArduinoBoardUno

避免使用

Analog to Digital Converter

• 如何將0~5V電壓轉換為數位訊號?

• 10 bits ADC

• 2^10=1024 → 0~1023

• 例如輸入電壓3V

• 3*1023/5=614(DEC)=00100110110(BIN)

5V

0V

Arduino IDE

Tool

Please select the correct board and port

• https://www.arduino.cc/en/main/software

Arduino IDE

1. Import Library

2. Define Variables/Constants

1. Setup Pins

2. Initialize Functions

Do…… until power is turned off!

1. Read ADC output

2. Send ADC result via BT module

整理訊號

Analog to Digital Converter

• Nyquist theorem• sampling rate > 2 * wave frequency

HC-05 Bluetooth Module

1. AT

2. AT+NAME?

3. AT+PSWD?

4. AT+UART = Baud Rate , 停止位元 , 同位(parity)位元

Enter AT Mode1. KEY: HIGH2. Push Button DownBefore power up Bluetooth Module

• https://livingtech.education/2018/06/03/arduino%E5%AF%A6%E7%94%A8-hc-05-at-mode%E4%B8%BB%E5%BE%9E%E9%85%8D%E5%B0%8D/

(The default password is 1234)

App Inventor 2

• You need to have a Google Account

• URL: ai2.appinventor.mit.edu

Basic function:1. Bluetooth connection2. Receiving data3. Draw data into waveforms

App Inventor 2

App Inventor 2

Arduino + HC-05 + App Inventor

• https://www.youtube.com/watch?v=xjtxrxVauZg

Arduino + HC-05 + App Inventor

• https://www.youtube.com/watch?v=JQ3tDhpmSFE

Digital filter (EEG)

• MATLAB、Python 、 etc• Built-in functions: butter / besself / cheby1 / maxflat

評分標準

• ECG 30%、EMG 30%、APP 20%、EEG 20%

• Accuracy (Most important)• Regardless of the complexity of the detection circuit

• Compare the detected signal with the results from exp.1• ECG: PR interval / QRS interval / ST intervals … etc.

• EMG: Tonus measurement … etc.

• EEG: Frequency domain

• Teamwork situation實驗一

實驗二

APP

行事曆

週數 日期 內容 報告繳交

5 10/09 實驗二(生醫信號量測電路之設計):簡介

6 10/16 各組自行安排完成實驗二 實驗一報告

7 10/23 實驗二:各組demo (本週任何時間都可,與助教約時間)

8 10/30 期中報告(1),五組報告 期中報告(五組)

9 11/06 期中考週停課 實驗二報告

https://docs.google.com/spreadsheets/d/1kUrHecCTJPx4GCL2CcfWx-pDcfRk4TCM/edit#gid=137118687

108_1_實驗二_時間登記表

實驗二 demo

• 地點:明達304、截止日期:10/26(星期六)晚上6點前

• 每組約10分鐘、Q&A約8分鐘(決定個人成績)、期末專題討論• 介紹電路架構、展示實驗一紀錄的訊號、用示波器(ELVIS)展示電路輸出

的波型、展示APP 、展示EEG數位濾波的結果

• 事先跟我約時間• 10/21(星期一):6:00PM~12:00PM

• 10/22(星期二):6:00PM~12:00PM

• 10/23(星期三):9:00AM~12:00PM

• 10/24(星期四):6:00PM~12:00PM

• 10/25(星期五):9:00AM~3:00PM、6:00PM~12:00PM

• 10/26(星期六):9:00AM~6:00PM

Additional questions (1)

1. 當所欲量測的生理信號頻譜跟60Hz的雜訊有所重疊時,請問應該怎樣去解決這個問題?

2. 要提高信號的SNR,除了使用濾波器之外,是否有其他方法可以改善?

3. 你覺得濾波器用軟體設計比較理想或者用硬體設計較佳?若各有優缺點,請問差別在哪裡?

Additional questions (2)

4. 實驗報告的內容請描述電路的設計(附上電路圖)以及測試的結果。請跟實驗一的量測結果作比較,你覺得兩者的結果有什麼不同?你覺得自己設計的這個量測電路是否可信賴?(請試著拿出臨床的資料一起比較)

5. 請粗略計算所設計之電路的功率。請討論可以降低功率的方法,例如不同的濾波器設計或是使用其他IC (請提供IC的Part Number)等。

器材擺放位置

• 五套 NI ELVIS 電路測試板 (用完要歸位)

器材擺放位置

• 每一組有兩塊麵包板,上面都有標示組別

器材擺放位置

• 每一組有一塊Arduino Uno、一個HC-05、一包杜邦線

器材擺放位置

電容

單芯線 電阻

OPA(OP741、INA128)

器材擺放位置

電阻直接拿庫存的,期末用完後要放回去

電阻

組別位置

電腦使用注意事項

實驗二報告

• 報告繳交期限: 11月06日(三)12:20PM前

• 報告內容• Normal report format: Introduction, Method, Results,

Discussions, Conclusions

• Design/Specification: circuits, Arduino program, App

• Additional questions

• 郵件主旨:【108-1生醫工程實驗】第一組實驗二報告

• 報告名稱:108_1_第一組實驗二報告_20190909.pdf

• 請合併成一個PDF檔案寄到助教的信箱

• 實驗一報告繳交期限: 10月15日(二)晚上11:00PM前

• 報告內容• Complete three experiment reports (三份實驗紀錄表格檔案)

• Complete additional questions

• 郵件主旨:【108-1生醫工程實驗】第一組實驗一報告

• 報告名稱:108_1_第一組實驗一報告_20190909.pdf

• 請合併成一個PDF檔案寄到助教的信箱belab.ntu@gmail.com

注意事項

注意事項

• 下禮拜三(10/16)不用上課

• 要記得填實驗二的時間登記表

• 有問題來前面找我

• 沒問題的同學可以下課

top related