What Is Digital? (Part 2) Prof. Chung-Ta King Department of Computer Science National Tsing Hua...

36
What Is Digital? (Part 2) Prof. Chung-Ta King Department of Computer Science National Tsing Hua University CS1103 電電電電電電電電 (Contents from MIT EECS 6.01/6.02, Wikipedia, U. of Indiana K361, www.arrl.org, www.sounderpro.com.tw/Digital)

Transcript of What Is Digital? (Part 2) Prof. Chung-Ta King Department of Computer Science National Tsing Hua...

Page 1: What Is Digital? (Part 2) Prof. Chung-Ta King Department of Computer Science National Tsing Hua University CS1103 電機資訊工程實習 (Contents from MIT EECS 6.01/6.02,

What Is Digital?(Part 2)

Prof. Chung-Ta KingDepartment of Computer

ScienceNational Tsing Hua University

CS1103 電機資訊工程實習

(Contents from MIT EECS 6.01/6.02, Wikipedia, U. of Indiana K361,www.arrl.org, www.sounderpro.com.tw/Digital)

Page 2: What Is Digital? (Part 2) Prof. Chung-Ta King Department of Computer Science National Tsing Hua University CS1103 電機資訊工程實習 (Contents from MIT EECS 6.01/6.02,

自然界的現象多為連續性的自然界的現象多為連續性的

如何將連續性的信號轉為數位信號,讓電腦可以處理?如何將連續性的信號轉為數位信號,讓電腦可以處理?

Page 3: What Is Digital? (Part 2) Prof. Chung-Ta King Department of Computer Science National Tsing Hua University CS1103 電機資訊工程實習 (Contents from MIT EECS 6.01/6.02,

3

Outline

Continuous versus discrete Problems with “continuous” Going into discrete/digital

Building digital devices IC to digital logic to computing devices

Transforming analog inputs into digital Transforming digital to analog outputs

Page 4: What Is Digital? (Part 2) Prof. Chung-Ta King Department of Computer Science National Tsing Hua University CS1103 電機資訊工程實習 (Contents from MIT EECS 6.01/6.02,

4

彩虹有幾種顏色?

真的只有七種顏色嗎?真的只有七種顏色嗎?

Page 5: What Is Digital? (Part 2) Prof. Chung-Ta King Department of Computer Science National Tsing Hua University CS1103 電機資訊工程實習 (Contents from MIT EECS 6.01/6.02,

5

我們實際上是運用了 Sampling的技巧

Digital representations of analog waveforms

Continuous timeContinuous valuesContinuous time

Continuous values

Discrete timeDiscrete valuesDiscrete time

Discrete values

Page 6: What Is Digital? (Part 2) Prof. Chung-Ta King Department of Computer Science National Tsing Hua University CS1103 電機資訊工程實習 (Contents from MIT EECS 6.01/6.02,

6

Sampling

The value of the analog signal is measured at certain intervals in time. Each measurement is referred to as a sample.

A series of “snapshots”

Page 7: What Is Digital? (Part 2) Prof. Chung-Ta King Department of Computer Science National Tsing Hua University CS1103 電機資訊工程實習 (Contents from MIT EECS 6.01/6.02,

7

Sampling in Space

Page 8: What Is Digital? (Part 2) Prof. Chung-Ta King Department of Computer Science National Tsing Hua University CS1103 電機資訊工程實習 (Contents from MIT EECS 6.01/6.02,

8

Terminologies in Sampling

Sampling rate: How often analog signal is measured

[samples per second, Hz], e.g. 44,100 Hz Sampling resolution:

Number of bits to represent each sample [“sample word length,” “bit depth”], e.g. 16 bit Analog

Input

4 Samples/cycle 8 Samples/cycle 16 Samples/cycle

Page 9: What Is Digital? (Part 2) Prof. Chung-Ta King Department of Computer Science National Tsing Hua University CS1103 電機資訊工程實習 (Contents from MIT EECS 6.01/6.02,

9

Note: Sampling Used Widely

民意調查

檢查奶精產品中的三聚氰胺

全台灣的降雨量分佈

動畫 (24 格 /秒 )

CD 音效格式 (44.1 Khz)

Page 10: What Is Digital? (Part 2) Prof. Chung-Ta King Department of Computer Science National Tsing Hua University CS1103 電機資訊工程實習 (Contents from MIT EECS 6.01/6.02,

10

Problem with Sampling

The analog signal is sampled at discrete intervals of time The digital output is an incomplete picture

of the behavior of the input There is no way of knowing, by looking at

the output, what the input was doing between one sampling instant and the next

Page 11: What Is Digital? (Part 2) Prof. Chung-Ta King Department of Computer Science National Tsing Hua University CS1103 電機資訊工程實習 (Contents from MIT EECS 6.01/6.02,

11

How Many Samples Are Enough?

Reconstruction: Is it possible to reconstruct the original waveform using only the discrete time samples?

Page 12: What Is Digital? (Part 2) Prof. Chung-Ta King Department of Computer Science National Tsing Hua University CS1103 電機資訊工程實習 (Contents from MIT EECS 6.01/6.02,

12

Shannon-Nyquist Sampling Theorem

How many samples are necessary to preserve the information contained in the signal? If signal contains high frequency

components, need to sample at even higher rate to avoid losing information in the signal

How much faster? Sampling Theorem: A signal can be exactly

reproduced if it is sampled at a frequency that is greater than twice max. frequency in the signal

http://www2.egr.uh.edu/~glover/applets/Sampling/Sampling.htmlhttp://www2.egr.uh.edu/~glover/applets/Sampling/Sampling.html

Page 13: What Is Digital? (Part 2) Prof. Chung-Ta King Department of Computer Science National Tsing Hua University CS1103 電機資訊工程實習 (Contents from MIT EECS 6.01/6.02,

13

Sampling at Same Frequency

Page 14: What Is Digital? (Part 2) Prof. Chung-Ta King Department of Computer Science National Tsing Hua University CS1103 電機資訊工程實習 (Contents from MIT EECS 6.01/6.02,

14

Sampling at Twice Frequency

Page 15: What Is Digital? (Part 2) Prof. Chung-Ta King Department of Computer Science National Tsing Hua University CS1103 電機資訊工程實習 (Contents from MIT EECS 6.01/6.02,

15

Implications

人能聽取的音頻大概是 20 Hz ~ 20 KHz 我們只要用 40 kHz 以上的取樣率 (sampling

rate) 就可以完整紀錄 20 kHz 以下的訊號

人的聲音可以用 8kHz 來取樣 8kHz: telephone quality 44.1kHz: CD quality 48kHz: radio/TV broadcast, DV, DVD video

問題是,我們不一定知道類比信號的最高頻率,因此無法確定取樣頻率。而且往往高頻信號為雜訊

Page 16: What Is Digital? (Part 2) Prof. Chung-Ta King Department of Computer Science National Tsing Hua University CS1103 電機資訊工程實習 (Contents from MIT EECS 6.01/6.02,

16

Aliasing

If sampling rate not high enough New frequencies appear in reconstructed

signals Need circuits to eliminate (anti-aliasing

filter) A high frequency signal

sampled at a lower rate

looks like …

… a lower frequency signal

Page 17: What Is Digital? (Part 2) Prof. Chung-Ta King Department of Computer Science National Tsing Hua University CS1103 電機資訊工程實習 (Contents from MIT EECS 6.01/6.02,

17

Encoding of Discrete Signals

If we use N bits to encode the magnitude of one of the discrete-time samples, we can capture 2N possible values

Page 18: What Is Digital? (Part 2) Prof. Chung-Ta King Department of Computer Science National Tsing Hua University CS1103 電機資訊工程實習 (Contents from MIT EECS 6.01/6.02,

18

3-bit Quantization

A 3-bit binary number has 23 = 8 values

0

1

2

3

4

5

6

7

Am

plit

ud

e

Time — measure amplitude at each tick of sample clock

Page 19: What Is Digital? (Part 2) Prof. Chung-Ta King Department of Computer Science National Tsing Hua University CS1103 電機資訊工程實習 (Contents from MIT EECS 6.01/6.02,

19

4-bit Quantization

A 4-bit binary number has 24 = 16 values

Time — measure amplitude at each tick of sample clock

0

2

4

6

8

10

12

14

Am

plit

ud

e

Page 20: What Is Digital? (Part 2) Prof. Chung-Ta King Department of Computer Science National Tsing Hua University CS1103 電機資訊工程實習 (Contents from MIT EECS 6.01/6.02,

20

The Digital Audio Stream

A series of sample numbers, to be interpreted as instantaneous amplitudes, one for every tick of the sample clock. This is what appears in a sound file, along

with a header that indicates the sampling rate, bit depth and other things.11 13 15 13 10 9 6 1 4 9 15 11 13 9

0

2

4

6

8

10

12

14

Am

plit

ude

Page 21: What Is Digital? (Part 2) Prof. Chung-Ta King Department of Computer Science National Tsing Hua University CS1103 電機資訊工程實習 (Contents from MIT EECS 6.01/6.02,

21

Audio File Size

CD characteristics… Sampling rate:

44,100 samples per second (44.1 kHz) Sample word length:

16 bits (i.e., 2 bytes) per sample Number of channels:

2 (stereo) How big is a 5-minute CD-quality sound

file?

Page 22: What Is Digital? (Part 2) Prof. Chung-Ta King Department of Computer Science National Tsing Hua University CS1103 電機資訊工程實習 (Contents from MIT EECS 6.01/6.02,

22

Quantization Error

When we quantize the scaled sample values, we may be off by up to ±1/2 step from the true sampled values Round-off error: difference between actual

signal and quantization to integer values…

Random errors: sounds like low-amplitude noise

Page 23: What Is Digital? (Part 2) Prof. Chung-Ta King Department of Computer Science National Tsing Hua University CS1103 電機資訊工程實習 (Contents from MIT EECS 6.01/6.02,

23

Sampling Rate and Encoding Bits

Page 24: What Is Digital? (Part 2) Prof. Chung-Ta King Department of Computer Science National Tsing Hua University CS1103 電機資訊工程實習 (Contents from MIT EECS 6.01/6.02,

24

Resolution Trade-offs

Bit Resolution

High Bit Count

Good Duplication

Slow

Low Bit Count

Poor Duplication

Fast

Sample Rate

High Sample Rate

Good Duplication

Slow

Low Sample Rate

Poor Duplication

Fast

 

Page 25: What Is Digital? (Part 2) Prof. Chung-Ta King Department of Computer Science National Tsing Hua University CS1103 電機資訊工程實習 (Contents from MIT EECS 6.01/6.02,

25

ADC

Continuously varying electrical energy is an analog of the sound pressure wave.

Microphone converts acoustic to electrical energy. It’s a transducer.

ADC (Analog to Digital Converter) converts analog to digital electrical signal.Digital signal transmits binary numbers.

DAC (Digital to Analog Converter) converts digital signal in computer to analog for your headphones.

Analog to Digital Recording Chain

Page 26: What Is Digital? (Part 2) Prof. Chung-Ta King Department of Computer Science National Tsing Hua University CS1103 電機資訊工程實習 (Contents from MIT EECS 6.01/6.02,

26

ADC and DAC

http://www.dspguide.com/ch3/4.htm http://www.dspguide.com/ch3/4.htm

Page 27: What Is Digital? (Part 2) Prof. Chung-Ta King Department of Computer Science National Tsing Hua University CS1103 電機資訊工程實習 (Contents from MIT EECS 6.01/6.02,

27

ADC in Digital Camera

http://www.tasi.ac.uk/advice/creating/camera.htmlhttp://www.tasi.ac.uk/advice/creating/camera.html

Page 28: What Is Digital? (Part 2) Prof. Chung-Ta King Department of Computer Science National Tsing Hua University CS1103 電機資訊工程實習 (Contents from MIT EECS 6.01/6.02,

28

Converting Analog into Digital

The simplest form of ADCuses a resistance ladderto switch in the appropriatenumber of resistors in seriesto create the desiredvoltage that is compared to the input(unknown) voltage

V-7

V-6

V-low

V-1

V-2

V-3

V-4

V-5

V-high

SW-8

SW-7

SW-6

SW-5

SW-4

SW-3

SW-2

SW-1

Output

Page 29: What Is Digital? (Part 2) Prof. Chung-Ta King Department of Computer Science National Tsing Hua University CS1103 電機資訊工程實習 (Contents from MIT EECS 6.01/6.02,

29

Converting Analog into Digital

The resistance ladder changes its configuration systematically and the output voltage is compared to the analog voltage in a comparator

When there is a match, the digital equivalent (switch configuration) is captured

Analog Voltage

ResistanceLadder Voltage

ComparatorOutput Higher

EqualLower

Page 30: What Is Digital? (Part 2) Prof. Chung-Ta King Department of Computer Science National Tsing Hua University CS1103 電機資訊工程實習 (Contents from MIT EECS 6.01/6.02,

30

How? Binary Search

Initial conditions Expected high 5

volts Expected low 0

volts 5 volts 256 0 volts 0

Voltage to be converted 3.42 volts Equates to 175

Analog Digital

5-volts 256

0-volts 0

2.5-volts 128

3.42-volts Unknown (175)

Page 31: What Is Digital? (Part 2) Prof. Chung-Ta King Department of Computer Science National Tsing Hua University CS1103 電機資訊工程實習 (Contents from MIT EECS 6.01/6.02,

31

What to Do with Digital Signals?

液晶面板廠,玻璃基板在輸送過程因震動導致的危機 基板破裂、液晶位移傾斜、發生面板亮點或暗點等不良或報廢品

若能防止震動過大,面板良率可由 85 %提升至 90% 以上

Page 32: What Is Digital? (Part 2) Prof. Chung-Ta King Department of Computer Science National Tsing Hua University CS1103 電機資訊工程實習 (Contents from MIT EECS 6.01/6.02,

32

輸送帶震動監測 方法:

將無線感測器佈建於玻璃基板上,以全程偵測玻璃基板於移動過程中所發生的震動及噪音

Gla

ss C

onve

yer

DB Server

Data Receive Server

AP Server

Glass

mote mote

mote mote

User

User

Glass

mote mote

mote mote

Glass

mote mote

mote mote

Glass Buffer

Page 33: What Is Digital? (Part 2) Prof. Chung-Ta King Department of Computer Science National Tsing Hua University CS1103 電機資訊工程實習 (Contents from MIT EECS 6.01/6.02,

33

震動振幅範圍 : ± 2G 震動解析度 : ± 0.1G 防共振結構

震動振幅範圍 : ± 2G 震動解析度 : ± 0.05G 防共振結構

微震動無線感測平台Eco

震動無線感測平台 Eco

Eco Ethernet Base Station

無線感測平台

Page 34: What Is Digital? (Part 2) Prof. Chung-Ta King Department of Computer Science National Tsing Hua University CS1103 電機資訊工程實習 (Contents from MIT EECS 6.01/6.02,

無線感測平台

34

The World SmallestWireless Sensing

Eco Node

Platform,

Page 35: What Is Digital? (Part 2) Prof. Chung-Ta King Department of Computer Science National Tsing Hua University CS1103 電機資訊工程實習 (Contents from MIT EECS 6.01/6.02,

36

震動資料時域分析

如何知道有不正常的震動?如何知道有不正常的震動?

Page 36: What Is Digital? (Part 2) Prof. Chung-Ta King Department of Computer Science National Tsing Hua University CS1103 電機資訊工程實習 (Contents from MIT EECS 6.01/6.02,

37

Summary

Digitization of analog signals by sampling Sampling rate and resolution Problems with sampling: aliasing,

quantization errors

Analog to digital conversion

Analysis of digital signals: FFT