30
Analog/Digital and Sampling Alexander Nelson October 7, 2019 University of Arkansas - Department of Computer Science and Computer Engineering

Analog/Digital and Samplingcsce.uark.edu/~ahnelson/CSCE4114/lectures/lecture11.pdf · 2019-10-14 · Process them as digital signals Analog { Continuous in time and amplitude Digital

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Analog/Digital and Samplingcsce.uark.edu/~ahnelson/CSCE4114/lectures/lecture11.pdf · 2019-10-14 · Process them as digital signals Analog { Continuous in time and amplitude Digital

Analog/Digital and Sampling

Alexander Nelson

October 7, 2019

University of Arkansas - Department of Computer Science and Computer Engineering

Page 2: Analog/Digital and Samplingcsce.uark.edu/~ahnelson/CSCE4114/lectures/lecture11.pdf · 2019-10-14 · Process them as digital signals Analog { Continuous in time and amplitude Digital

Analog

Signals in the real world are analog signals

Process them as digital signals

Analog – Continuous in time and amplitude

Digital – Discrete in time and amplitude

1

Page 3: Analog/Digital and Samplingcsce.uark.edu/~ahnelson/CSCE4114/lectures/lecture11.pdf · 2019-10-14 · Process them as digital signals Analog { Continuous in time and amplitude Digital

Conversion

To work with sensor data, analog signals must be converted to

digital

Analog to Digital Conversion (A to D)2

Page 4: Analog/Digital and Samplingcsce.uark.edu/~ahnelson/CSCE4114/lectures/lecture11.pdf · 2019-10-14 · Process them as digital signals Analog { Continuous in time and amplitude Digital

Sampling

Sampling – Converting Analog to Digital Values

Sample – Single Measurement in time

Nyquist Rate – Minimum rate at which periodic signal can be

sampled without introducing aliasing errors

3

Page 5: Analog/Digital and Samplingcsce.uark.edu/~ahnelson/CSCE4114/lectures/lecture11.pdf · 2019-10-14 · Process them as digital signals Analog { Continuous in time and amplitude Digital

Sampling

Green – Analog signal Blue – Digital samples 4

Page 6: Analog/Digital and Samplingcsce.uark.edu/~ahnelson/CSCE4114/lectures/lecture11.pdf · 2019-10-14 · Process them as digital signals Analog { Continuous in time and amplitude Digital

Error Sources

Measurement Error – Instantaneous value measurement error

e.g. Voltage measurement within ± 0.05V

Quantization Error – Difference between measured value and

discrete value

Aliasing Errors – Missing signals by sampling too slowly

5

Page 7: Analog/Digital and Samplingcsce.uark.edu/~ahnelson/CSCE4114/lectures/lecture11.pdf · 2019-10-14 · Process them as digital signals Analog { Continuous in time and amplitude Digital

Digital Representation

How do you represent a real number in a given number of bits?

6

Page 8: Analog/Digital and Samplingcsce.uark.edu/~ahnelson/CSCE4114/lectures/lecture11.pdf · 2019-10-14 · Process them as digital signals Analog { Continuous in time and amplitude Digital

Digital Representation

Quantization – representing a real number in a given number of

bits?

Choosing Quantization Levels:

• Assume you want to represent 0V-5V given a 10-bit value

• 0V = 0b0; 5V = 0b1111111111 = 1023

• How much is each bit worth?

7

Page 9: Analog/Digital and Samplingcsce.uark.edu/~ahnelson/CSCE4114/lectures/lecture11.pdf · 2019-10-14 · Process them as digital signals Analog { Continuous in time and amplitude Digital

Digital Representation

Quantization – representing a real number in a given number of

bits?

Choosing Quantization Levels:

• Assume you want to represent 0V-5V given a 10-bit value

• 0V = 0b0; 5V = 0b1111111111 = 1023

• 5V ÷ 1023 ≈ 0.00488V – LSB

• LSB ∗ 512 = 2.502V – MSB

Any measurement difference from a multiple of 0.00488 is

quantization error

8

Page 10: Analog/Digital and Samplingcsce.uark.edu/~ahnelson/CSCE4114/lectures/lecture11.pdf · 2019-10-14 · Process them as digital signals Analog { Continuous in time and amplitude Digital

Quantization Error Example

Assume a 10-bit ADC measuring a 0-5V signal:

A sample is measured when instantaneous value is 2.83V

Assume measurement error is 0

What is the quantization error?

9

Page 11: Analog/Digital and Samplingcsce.uark.edu/~ahnelson/CSCE4114/lectures/lecture11.pdf · 2019-10-14 · Process them as digital signals Analog { Continuous in time and amplitude Digital

Quantization Error Example

Assume a 10-bit ADC measuring a 0-5V signal:

A sample is measured when instantaneous value is 2.83V

Assume measurement error is 0

What is the quantization error?

2.83V ÷ 5V = 0.566

0.566 ∗ 1023 = 579.018 – 579 is the ADC value

0.018× 0.00488V (LSB) ≈ 0.000088V

10

Page 12: Analog/Digital and Samplingcsce.uark.edu/~ahnelson/CSCE4114/lectures/lecture11.pdf · 2019-10-14 · Process them as digital signals Analog { Continuous in time and amplitude Digital

Sampling Theorem

Bridge between continuous-time and discrete-time signals (i.e.

analog and digital)

Meaning that Analog→Digital→Analog can reproduce the original

signal

11

Page 13: Analog/Digital and Samplingcsce.uark.edu/~ahnelson/CSCE4114/lectures/lecture11.pdf · 2019-10-14 · Process them as digital signals Analog { Continuous in time and amplitude Digital

Shannon’s Theorem

“If a function x(t) contains no frequencies higher than B hertz, it

is completely determined by giving its ordinates at a series of

points spaced 1/(2B) seconds apart.”

If a sampling rate is 2 times faster than fastest analog signal, the

original signal can be reconstructed from the sampled signal

12

Page 14: Analog/Digital and Samplingcsce.uark.edu/~ahnelson/CSCE4114/lectures/lecture11.pdf · 2019-10-14 · Process them as digital signals Analog { Continuous in time and amplitude Digital

Aliasing Error

1

1http://www.bb-elec.com/Learning-Center/All-White-Papers/Data-

Aquisition-and-IO/The-Fine-Art-of-Analog-Signal-Sampling.aspx

13

Page 15: Analog/Digital and Samplingcsce.uark.edu/~ahnelson/CSCE4114/lectures/lecture11.pdf · 2019-10-14 · Process them as digital signals Analog { Continuous in time and amplitude Digital

Analog to Digital Converters

Analog to Digital Converter – A2D/ADC/(A/D), A to D – Device

to convert physical quantity (voltage) to a discrete (digital) value

Multiple types of ADC architectures:

• Parallel/Serial stages

• Single/Multiple conversion steps

• One or more clock cycles

Each architecture has trade-offs

e.g. Power/size/speed/accuracy/etc...

14

Page 16: Analog/Digital and Samplingcsce.uark.edu/~ahnelson/CSCE4114/lectures/lecture11.pdf · 2019-10-14 · Process them as digital signals Analog { Continuous in time and amplitude Digital

ADC Features

15

Page 17: Analog/Digital and Samplingcsce.uark.edu/~ahnelson/CSCE4114/lectures/lecture11.pdf · 2019-10-14 · Process them as digital signals Analog { Continuous in time and amplitude Digital

ADC Circuit

16

Page 18: Analog/Digital and Samplingcsce.uark.edu/~ahnelson/CSCE4114/lectures/lecture11.pdf · 2019-10-14 · Process them as digital signals Analog { Continuous in time and amplitude Digital

Successive Approximation ADC

2

2By White Flye - Own work, CC BY-SA 2.5,

https://commons.wikimedia.org/w/index.php?curid=37953205 17

Page 19: Analog/Digital and Samplingcsce.uark.edu/~ahnelson/CSCE4114/lectures/lecture11.pdf · 2019-10-14 · Process them as digital signals Analog { Continuous in time and amplitude Digital

Successive Approximation ADC

Components:

• Successive Approximation Register

• Digital to Analog Converter

• Comparator

• Sample and Hold Amplifier

18

Page 20: Analog/Digital and Samplingcsce.uark.edu/~ahnelson/CSCE4114/lectures/lecture11.pdf · 2019-10-14 · Process them as digital signals Analog { Continuous in time and amplitude Digital

Sample and Hold

For serialized ADC circuits, the S/H circuit is important

Composed of two amplifiers, a switch, and a hold capacitor

19

Page 21: Analog/Digital and Samplingcsce.uark.edu/~ahnelson/CSCE4114/lectures/lecture11.pdf · 2019-10-14 · Process them as digital signals Analog { Continuous in time and amplitude Digital

Sample and Hold

Sample and hold maintains

voltage for a length of time

Top: Samples at given time

Bottom: Samples held until start

of next sample

20

Page 22: Analog/Digital and Samplingcsce.uark.edu/~ahnelson/CSCE4114/lectures/lecture11.pdf · 2019-10-14 · Process them as digital signals Analog { Continuous in time and amplitude Digital

Sample and Hold

“Hold” command sent → switch is opened

Hc maintains the voltage on output terminal

Charge on output terminal should change < 1 LSB during

conversion

Hc should have low leakage and dielectric absorption

21

Page 23: Analog/Digital and Samplingcsce.uark.edu/~ahnelson/CSCE4114/lectures/lecture11.pdf · 2019-10-14 · Process them as digital signals Analog { Continuous in time and amplitude Digital

Digital to Analog Converter (DAC)

Convert a digital value to an analog voltage

Different methods:

• Pulse Width Modulation with low pass filter

• Oversampling/Interpolating DACs (sigma-delta)

• Binary-weighted DAC (switched resistor, switched capacitor,

switched current source)

• Successive-Approximation/Cyclic DAC

22

Page 24: Analog/Digital and Samplingcsce.uark.edu/~ahnelson/CSCE4114/lectures/lecture11.pdf · 2019-10-14 · Process them as digital signals Analog { Continuous in time and amplitude Digital

PWM DAC

More filtering = better approximation, longer settle time

23

Page 25: Analog/Digital and Samplingcsce.uark.edu/~ahnelson/CSCE4114/lectures/lecture11.pdf · 2019-10-14 · Process them as digital signals Analog { Continuous in time and amplitude Digital

Analog Comparator

Circuit that produces a digital signal determining which of two

inputs is higher

V0 =

1 V+ ≥ V−

0 V+ < V−

In other words: Voltage out = Vdd if analog input greater than

reference; GND if input less than reference

24

Page 26: Analog/Digital and Samplingcsce.uark.edu/~ahnelson/CSCE4114/lectures/lecture11.pdf · 2019-10-14 · Process them as digital signals Analog { Continuous in time and amplitude Digital

Analog Comparator

3

3By Rakesh310 - Own work, CC BY-SA 4.0,

https://commons.wikimedia.org/w/index.php?curid=63899027

25

Page 27: Analog/Digital and Samplingcsce.uark.edu/~ahnelson/CSCE4114/lectures/lecture11.pdf · 2019-10-14 · Process them as digital signals Analog { Continuous in time and amplitude Digital

Successive Approximation Algorithm

Algorithm:

1. Compare against half of

range

2. Continue narrowing until

limited by LSB

3. Error upper bounded by 1LSB

• Assuming value just less

than next LSB, and no

nearest bit comparison

26

Page 28: Analog/Digital and Samplingcsce.uark.edu/~ahnelson/CSCE4114/lectures/lecture11.pdf · 2019-10-14 · Process them as digital signals Analog { Continuous in time and amplitude Digital

Successive Approximation Timing

Assuming DAC can obtain stable comparison voltage in < 1 cycle

How many clock cycles to convert Successive Approximation for a

10-bit ADC?

27

Page 29: Analog/Digital and Samplingcsce.uark.edu/~ahnelson/CSCE4114/lectures/lecture11.pdf · 2019-10-14 · Process them as digital signals Analog { Continuous in time and amplitude Digital

Successive Approximation Timing

Assuming DAC can obtain stable comparison voltage in < 1 cycle

How many clock cycles to convert Successive Approximation for a

10-bit ADC?

Binary Search Tree – N-bit conversion takes N-steps

e.g. 10-bit ADC = 10 clock cycles

28

Page 30: Analog/Digital and Samplingcsce.uark.edu/~ahnelson/CSCE4114/lectures/lecture11.pdf · 2019-10-14 · Process them as digital signals Analog { Continuous in time and amplitude Digital

What about 16 bits?

29