Digital Acquisition of Analog Signals – A Practical Guide

Slides:



Advertisements
Similar presentations
Lecture Notes Part 2Lecture Notes Part 2 ET 438 b Digital Control and Data Acquisition et438b-2.pptx1.
Advertisements

What is Arduino?  Arduino is a ATMEL 168 micro-controller kit designed specially for small projects  User friendly IDE(Integrated Development Environment)
Analog-to-Digital Converter (ADC) And
Lecture 17: Analog to Digital Converters Lecturers: Professor John Devlin Mr Robert Ross.
Sensors Interfacing.
Data Acquisition ET 228 Chapter
Analog-to-digital Conversion and Digital-to-analog Conversion (with DSP) ES-3.
Analog to Digital Conversion. Introduction  An analog-to-digital converter (ADC, A/D, or A to D) is a device that converts continuous signals to discrete.
Data Acquisition Concepts Data Translation, Inc. Basics of Data Acquisition.
5/4/2006BAE Analog to Digital (A/D) Conversion An overview of A/D techniques.
Analog to Digital Converters (ADC) 2 ©Paul Godin Created April 2008.
Lecture 9: D/A and A/D Converters
Analogue to Digital Conversion
Interfacing Analog and Digital Circuits
Data acquisition and manipulation
1 Dr. Un-ki Yang Particle Physics Group or Shuster 5.15 Amplifiers and Feedback: 3.
Analogue to Digital Conversion
Introduction to Data Conversion
Discussion #25 – ADCECEN 3011 Conversion Mosiah 5:2 2 And they all cried with one voice, saying: Yea, we believe all the words which though has spoken.
Chapter 9 Data Acquisition A/D Conversion Introduction
COMP3221: Microprocessors and Embedded Systems Lecture 20: Analog Output Lecturer: Hui Wu Session 2, 2004.
Chapter 2: Fundamentals of Data and Signals. 2 Objectives After reading this chapter, you should be able to: Distinguish between data and signals, and.
PH4705/ET4305: A/D: Analogue to Digital Conversion
Data Acquisition. Data Acquisition System Analog Signal Signal Conditioner ADC Digital Processing Communication.
Lock-in amplifiers
Analogue Electronics II EMT 212/4
11 Lecture Slides ME 3222 Kinematics and Control Lab Lab 2 AD DA and Sampling Theory By Dr. Debao Zhou.
Ni.com Data Analysis: Time and Frequency Domain. ni.com Typical Data Acquisition System.
Lecture 1 Signals in the Time and Frequency Domains
DATA ACQUISITION Today’s Topics Define DAQ and DAQ systems Signals (digital and analogue types) Transducers Signal Conditioning - Importance of grounding.
EE 319K Introduction to Microcontrollers
Understanding ADC Specifications September Definition of Terms 000 Analogue Input Voltage Digital Output Code FS1/2.
SIGMA-DELTA ADC SD16_A Sigma-Delta ADC Shruthi Sujendra.
Suleyman Demirel University CSS340 Microprocessor Systems – Lecture 2 ATMEGA328P ARCHITECTURE ANALOG INPUTS.
Analog-to-Digital and Digital-to-Analog Conversion
Analog Capture- Port E. Digital to Analog and Analog to Digital Conversion D/A or DAC and A/D or ADC.
Digital Control CSE 421.
Analog/Digital Conversion
ECE 2799 Electrical and Computer Engineering Design ANALOG to DIGITAL CONVERSION Prof. Bitar Last Update:
Introduction to Data Conversion EE174 – SJSU Tan Nguyen.
Microcontroller basics Embedded systems for mortals.
EKT 314/4 WEEK 5 : CHAPTER 3 SIGNAL CONDITIONING ELECTRONIC INSTRUMENTATION.
W.J.E.C. Electronics ET4 – Communication Systems Solutions to Sample Questions Jan 2010.
Electronic instrumentation Digitization of Analog Signal in TD
Application Case Study Christmas Lights Controller
MECH 373 Instrumentation and Measurements
EKT124 Digital Electronics 1 Introduction to Digital Electronics
Data Acquisition ET 228 Chapter
Digital Control CSE 421.
Operational Amplifier
COMPUTER NETWORKS and INTERNETS
Analog Comparator An analog comparator is available on pins PE2(AIN0), PE3(AIN1) The comparator operates like any other comparator. -when (+) exceeds (-)
Analogue Electronics Circuit II EKT 214/4
Analogue Electronic 2 EMT 212
Microcontroller basics
Analog to digital conversion
Analog-to-Digital Converter
Topics discussed in this section:
Fri. Oct 13 Announcements Lab practical next week
Lock-in amplifiers
Aliasing and Anti-aliasing Filters TIPL 4304 TI Precision Labs – ADCs
Introduction to Frequency Domain TIPL 4301 TI Precision Labs – ADCs
Lecture 9: Sampling & PAM 1st semester By: Elham Sunbu.
Lesson 7: Anti-Aliasing Filtering
Lesson 8: Analog Signal Conversion
CSCI1600: Embedded and Real Time Software
Conversation between Analogue and Digital System
Digital Fundamentals Floyd Chapter 1 Tenth Edition
9.3 Analog-to-Digital Conversion
CSCI1600: Embedded and Real Time Software
Presentation transcript:

Digital Acquisition of Analog Signals – A Practical Guide Nathan M. Neihart Senior Design Presentation

Motivation A common task for many senior design projects is to interface an analog signal with a digital system The digital system will typically be a microcontroller MSP430 Arduino Mega There are several important considerations that need to be made when performing this type of interface Voltage levels Interface circuits Sampling rates

Outline Resolution and Dynamic Range Sampling Rate Some Common Applications

Interfacing with the ADC The analog-to-digital converter takes an analog signal as an input and generates a digital number as the output The ADC has 3 important characteristics Reference Voltage – The maximum voltage that can be converted Resolution – The minimum voltage change that can be detected Sampling Rate – The time interval between consecutive samples We will discuss each of these in detail

Interfacing with the ADC All voltages are measured w.r.t. some reference point Usually the reference point is “ground” or “common” Sometimes the reference point can be another voltage “Earth ground” is a direct connection to the physical earth “Common” is simply a reference point that is common to the entire circuit Some power supplies use earth ground as the reference and others use a common terminal as the reference Earth Ground

Resolution and Dynamic Range

Resolution and Voltage Levels The reference voltage is the maximum voltage that the ADC can convert The minimum voltage is typically 0 V The resolution of the ADC is the smallest voltage change that can be measured 𝑉 𝑟𝑒𝑓 – Reference voltage in V 𝑁 – Word width of ADC output 𝑽 𝑳𝑺𝑩 = 𝑽 𝒓𝒆𝒇 𝟐 𝑵 −𝟏

Resolution and Voltage Levels 𝑹𝒆𝒔𝒐𝒍𝒖𝒕𝒊𝒐𝒏 𝒐𝒇 𝒕𝒉𝒆 𝑨𝑫𝑪 𝑺𝒚𝒔𝒕𝒆𝒎 𝑽𝒐𝒍𝒕𝒂𝒈𝒆 = 𝑨𝑫𝑪 𝑹𝒆𝒂𝒅𝒊𝒏𝒈 𝑨𝒏𝒂𝒍𝒐𝒈 𝑽𝒐𝒍𝒕𝒂𝒈𝒆 𝑴𝒆𝒂𝒔𝒖𝒓𝒆𝒅 Given an analog voltage, we can compute the expected digital output 𝑫 𝑵 = 𝑽 𝒊𝒏 𝟐 𝑵 −𝟏 𝑽 𝒓𝒆𝒇 Given the ADC digital output, we can compute the expected analog input 𝑽 𝒊𝒏 = 𝑽 𝒓𝒆𝒇 𝟐 𝑵 −𝟏 𝑫 𝑵 If 𝑽 𝒊𝒏 ≥ 𝑽 𝒓𝒆𝒇 then 𝑫 𝑵 is all ONEs If 𝑽 𝒊𝒏 ≤𝟎 then 𝑫 𝑵 is all ZEROs 𝐷 𝑁 is an N-bit digital word 𝑉 𝑖𝑛 is the analog input voltage

Resolution and Voltage Levels In order for your ADC to function properly, your analog input signal must be within range of the ADC reference voltage Pay attention to circuits that require dual-polarity power supplies

Resolution and Voltage Levels

Resolution and Voltage Levels You may not always have the ability to control the DC offset of your analog source You can shift the average value (or DC offset) of your input signal externally using an op-amp 𝑉 𝑂𝑈𝑇 =− 𝑉 𝐼𝑁 𝑅 2 𝑅 1 + 𝑉 𝐷𝐶 𝑅 2 𝑅 1 +1 To avoid saturating the output: 𝑉 𝑆𝑆 + 𝑉 𝑖𝑛,𝑚𝑎𝑥 𝑅 2 𝑅 1 1+ 𝑅 2 𝑅 1 ≤ 𝑉 𝐷𝐶 ≤ 𝑉 𝐷𝐷 − 𝑉 𝑖𝑛,𝑚𝑎𝑥 𝑅 2 𝑅 1 1+ 𝑅 2 𝑅 1

Resolution and Voltage Levels Maximum resolution will only be achieved with full-scale input For inputs with fixed amplitude Increase gain before ADC Set the correct 𝑉 𝑅𝐸𝐹 1-bit Resolution MSP432 ATmega328 1.2 V Avcc (5 V) 1.45 V 1.1 V 2.5 V Externally Set 3-bit Resolution

Resolution and Voltage Levels For inputs with large dynamic range Variable gain block will provide best resolution Gain is controlled by ADC output ADC output is now dependent on the gain The MCU must know the current value of gain 𝑫 𝟖 ≥𝟎𝒃𝟏𝟏𝟏𝟏𝟏𝒙𝒙𝒙 then decrease gain 𝑫 𝟖 ≤𝟎𝒃𝟎𝟎𝟎𝟎𝟎𝒙𝒙𝒙 then increase gain 𝟎.𝟎𝟑 𝑽 𝒓𝒆𝒇 ≤ 𝑽 𝒊𝒏 𝑮≤𝟎.𝟗𝟕 𝑽 𝒓𝒆𝒇 𝑹 𝑨 < 𝑹 𝑩 <…< 𝑹 𝑵 𝑮⋅ 𝑽 𝒊𝒏 = 𝑽 𝒓𝒆𝒇 𝟐 𝑵 −𝟏 𝑫 𝑵

Resolution and Voltage Levels The analog supply voltage may be larger than the ADC supply voltage This is okay if the analog signal is still within safe operating limits of the ADC During power up or for invalid inputs the analog signal may exceed safe operating voltages for the ADC You should limit (or clamp) the analog input signal The output is limited to: 𝑽 𝑳 ≤ 𝑽 𝑶𝑼𝑻 ≤ 𝑽 𝑯 𝑹 is required to limit the current flowing into the output of the op-amps

Resolution and Voltage Levels

Sampling

ADC Sampling Rate One of the most important characteristics of the ADC is the sampling rate The sampling rate must be at least twice the highest frequency of interest If the sampling rate is too low you will get aliasing Aliasing is an effect that causes signals with different frequencies to become indistinguishable

ADC Sampling Rate Video taken from: https://www.youtube.com/watch?v=vLL-T4Z_TNo

ADC Sampling Rate Sweep the frequency of a sinusoidal signal from 𝟐𝟎 𝑯𝒛 to 𝟏𝟓 𝒌𝑯𝒛 Sine wave sampled at 𝒇 𝑺 =𝟒𝟒.𝟏 𝒌𝑯𝒛 No aliasing Sine wave sampled at 𝒇 𝒔 =𝟏𝟎 𝒌𝑯𝒛 Aliasing at high frequencies Saw tooth wave sampled with 𝒇 𝑺 =𝟑𝟎 𝒌𝑯𝒛 Why is there still aliasing at high frequencies?

ADC Sampling Rate The Fourier series expansion for the Saw tooth wave: 𝒇 𝒕 =− 𝟐 𝝅 𝒎=𝟏 ∞ 𝒔𝒊𝒏 𝒎𝝎𝒕 𝒎

ADC Sampling Rate When choosing a sampling rate you must know something about the frequency content of your signal An anti-aliasing filter should be used to limit the bandwidth

ADC Sampling Rate Often you will need to sample signals very close to the Nyquist rate Care must be taken when using low sampling rates 𝑽 𝒊𝒏 𝒕 =𝒔𝒊𝒏 𝟖𝝅×𝟏 𝟎 𝟑 𝒕

ADC Sampling Rate So how do we control the sampling rate? Default Arduino ADC clock rate is 𝒇 𝑨𝑫𝑪 =𝟏𝟐𝟓 𝒌𝑯𝒛 Normal conversion requires 13 clock cycles or 𝟏𝟎𝟒 𝝁𝒔 Maximum sampling rate is 9,615 Hz The actual sampling rate depends on your implementation

ADC Sampling Rate The serial monitor is a very useful debugging tool for Arduino It is common to embed the ADC conversion function into the main loop Takes approximately 284 𝝁𝒔 to execute this loop Actual sampling rate is 3,521 Hz! Sample Arduino Code int analogPin = 3; int val = 0; void setup() { Serial.begin(9600); } void loop() { val = analogRead(analogPin); Serial.print(“Value is: “); Serial.println(val);

ADC Sampling Rate A much better way is to use timers and interrupts Sample Arduino Code #include “TimerOne.h” int analogPin = 3; int val = 0; void setup() { Timer1.initialize(1000); Timer1.attachInterrupt(callback); } void callback() { val = analogRead(analogPin); void loop() { // Do something with val A much better way is to use timers and interrupts Sampling rate is now tightly controlled by the timer Sampling rate is still limited by other code and resolution of timer

Common Applications

Measuring Amplitude Measuring the amplitude of an unknown AC signal with respect to ground 𝑽 𝒕 = 𝑽 𝑫𝑪 +𝑨𝒔𝒊𝒏 𝝎𝒕+𝜽 𝒗 𝒏 = 𝒗 𝑫𝑪 +𝑨𝒔𝒊𝒏 𝟐𝝅 𝒇 𝒇 𝑺 𝒏+𝜽 A common method for finding amplitude is to find the maximum value of 𝒗 𝒏 Do not forget the DC offset Does sampling rate matter?

Measuring Amplitude Accuracy can be improved by taking at least 5 samples per period Measuring RMS voltage is a bit more accurate 𝑹𝑴𝑺 𝒗 𝒏 = 𝟏 𝑵 𝒏 𝒗 𝒏 − 𝑽 𝑫𝑪 𝟐

Digitizing Multiple Signal Sources Four Modes of Operation Single-Channel Single Conversion Sequence-of-Channels Repeat Single-Channel Repeat Sequence-of-Channels

Digitizing Multiple Signal Sources IDEAL REALISTIC

Summary Make sure that your analog input signal is within the valid range of the ADC For maximum resolution, you want the input signal to be close to 𝑽 𝒓𝒆𝒇 Variable amplification may be necessary Make sure that you are sampling above the Nyquist rate Watch out where you place your conversion enable code You should always low-pass filter your input signal before digitization Avoid unwanted aliasing Minimize noise contribution from any gain blocks