Analog to Digital Conversion of Sound with the MSP430F2013



Similar documents
Voltage Measurement with A PIC Microcontroller

Conversion Between Analog and Digital Signals

Using Arduino Microcontrollers to Sense DC Motor Speed and Position

Application Report. 1 Introduction. 2 Resolution of an A-D Converter. 2.1 Signal-to-Noise Ratio (SNR) Harman Grewal... ABSTRACT

LM 358 Op Amp. If you have small signals and need a more useful reading we could amplify it using the op amp, this is commonly used in sensors.

Digital To Analog Converter with Sine Wave Output

Simple 1.5-V Boost Converter for MSP430

Interfacing Analog to Digital Data Converters

Section 3. Sensor to ADC Design Example

Tire pressure monitoring

DIGITAL-TO-ANALOGUE AND ANALOGUE-TO-DIGITAL CONVERSION

Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science Electronic Circuits Spring 2007

Analog and Digital Filters Anthony Garvert November 13, 2015

MAS.836 HOW TO BIAS AN OP-AMP

QUICK START GUIDE FOR DEMONSTRATION CIRCUIT BIT DIFFERENTIAL ADC WITH I2C LTC2485 DESCRIPTION

DAC Digital To Analog Converter

AVR127: Understanding ADC Parameters. Introduction. Features. Atmel 8-bit and 32-bit Microcontrollers APPLICATION NOTE

Display Board Pulse Width Modulation (PWM) Power/Speed Controller Module

POCKET SCOPE 2. The idea 2. Design criteria 3

ETEC Digital Controls PIC Lab 10 Pulse Width Modulation

Computer Aided Design of Home Medical Alert System

AVR125: ADC of tinyavr in Single Ended Mode. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

Atmel Norway XMEGA Introduction

Timer A (0 and 1) and PWM EE3376

Analog Signal Conditioning

Evaluating AC Current Sensor Options for Power Delivery Systems

AVR126: ADC of megaavr in Single Ended Mode. Introduction. Features. AVR 8-bit Microcontrollers APPLICATION NOTE

Lesson 16 Analog-to-Digital Converter (ADC)

Pressure Transducer to ADC Application

HANDLING SUSPEND MODE ON A USB MOUSE

Microcomputers. Analog-to-Digital and Digital-to-Analog Conversion

A Differential Op-Amp Circuit Collection

Lab 7: Operational Amplifiers Part I

PS 29M DUAL CHANNEL BELTPACK IN METAL CASE

A Digital Timer Implementation using 7 Segment Displays

Lab 5 Operational Amplifiers

Designing an Induction Cooker Using the S08PT Family

Buffer Op Amp to ADC Circuit Collection

W a d i a D i g i t a l

Microcontroller to Sensor Interfacing Techniques

LEVERAGING FPGA AND CPLD DIGITAL LOGIC TO IMPLEMENT ANALOG TO DIGITAL CONVERTERS

Analog Devices Welcomes Hittite Microwave Corporation NO CONTENT ON THE ATTACHED DOCUMENT HAS CHANGED

1. Learn about the 555 timer integrated circuit and applications 2. Apply the 555 timer to build an infrared (IR) transmitter and receiver

Signal Processing in So.ware and Electric Field Sensing

Use and Application of Output Limiting Amplifiers (HFA1115, HFA1130, HFA1135)

Wireless In-Ear Audio Monitor

CHAPTER 11: Flip Flops

Micro-Step Driving for Stepper Motors: A Case Study

Three-Level PWM DC/AC Inverter Using a Microcontroller

Designing Gain and Offset in Thirty Seconds

STEPPER MOTOR SPEED AND POSITION CONTROL

The 2N3393 Bipolar Junction Transistor

Analog Representations of Sound

Voice Dialer Speech Recognition Dialing IC

PC BASED PID TEMPERATURE CONTROLLER

Digital Guitar Effects Pedal

Getting Started with PIC24F/PIC24H Programming and Interfacing in C

Digital Sampling Oscilloscope

WICE-SPI Hardware Operation Manual

Supply voltage Supervisor TL77xx Series. Author: Eilhard Haseloff

How To Close The Loop On A Fully Differential Op Amp

4. Optical position sensor, photo-current measurement

A Differential Op-Amp Circuit Collection

Audio Tone Control Using The TLC074 Operational Amplifier

11: AUDIO AMPLIFIER I. INTRODUCTION

How To Use A Watt Saver On A Microcontroller (Watt Saver) On A Cell Phone Or Mp3 Player

Wireless Security Camera

Section 19. Voltage Reference

Arbeitskreis Hardware. Prof. Dr. Michael Rohs, Dipl.-Inform. Sven Kratz MHCI Lab, LMU München

Microcontroller-based experiments for a control systems course in electrical engineering technology

Secure My-d TM and Mifare TM RFID reader system by using a security access module Erich Englbrecht (info@eonline.de) V0.1draft

Analog Servo Drive 25A8

Digital to Analog Converter. Raghu Tumati

Having read this workbook you should be able to: recognise the arrangement of NAND gates used to form an S-R flip-flop.

Energy Harvesting Device

Chapter 19 Operational Amplifiers

PLL frequency synthesizer

Analog-to-Digital Converters. Transducers

Single Phase Two-Channel Interleaved PFC Operating in CrM

Application Note, V 2.2, Nov AP32091 TC1766. Design Guideline for TC1766 Microcontroller Board Layout. Microcontrollers. Never stop thinking.

Bipolar Transistor Amplifiers

Single Phase Two-Channel Interleaved PFC Operating in CrM Using the MC56F82xxx Family of Digital Signal Controllers

AN2658 Application note

Hello, and welcome to this presentation of the STM32L4 reset and clock controller.

NTE2053 Integrated Circuit 8 Bit MPU Compatible A/D Converter

WHY DIFFERENTIAL? instruments connected to the circuit under test and results in V COMMON.

Pulse Width Modulation (PWM) LED Dimmer Circuit. Using a 555 Timer Chip

The Study and Design Of a Wireless ECG Monitoring System

US-SPI New generation of High performances Ultrasonic device

Lab Experiment 1: The LPC 2148 Education Board

Chapter 12. Data Converters. à Read Section 19 of the Data Sheet for PIC18F46K20. Updated: 4/19/15

Chapter 6: From Digital-to-Analog and Back Again

AN3252 Application note

Analog-to-Digital Converters

Electronics. Discrete assembly of an operational amplifier as a transistor circuit. LD Physics Leaflets P

Analog signals are those which are naturally occurring. Any analog signal can be converted to a digital signal.

Section bit A/D Converter

MIDECO 64-outputs MIDI note decoder USER MANUAL. Roman Sowa 2012

ARM Thumb Microcontrollers. Application Note. Software ISO 7816 I/O Line Implementation. Features. Introduction

Transcription:

Analog to Digital Conversion of Sound with the MSP430F2013 Christopher Johnson 4/2/2010 Abstract Several modern-day applications require that analog signals be converted to digital signals in order to be processed by either a computer or microcontroller. Conversion of sound waves to a digital signal with the MSP430F2013 will be examined. The MSP430F2013 analog to digital converter is well documented. However, specific applications are not well explained. Digital sampling with the MSP430 will be outlined. Keywords: MSP430F2013, Analog to Digital Conversion, Sound, Amplifier

Introduction The MSP430F2013 includes a five channel multiplexed sigma delta analog to digital (AD) converter. The AD converter has up to 16 bit resolution as well as an on board reference voltage. This means there are 2 16 levels of resolution, which is very high. Even though all of these features are included on chip, there is not readily available documentation explaining how to initialize and then make an AD conversion with the microcontroller. Objective The following will detail the necessary pre-amp required to boost the audio signal to a usable level. This application note will also provide the necessary supporting circuitry required for AD conversion. In terms of software, initialization of the AD converter on the MSP430F2013, including explanations of necessary registers will be discussed. Source code and schematics are included in order to explicitly show the correct implementation of a simple, continuous AD conversion. Methods Signal Pre-amplifier Before programming the microcontroller begins, the analog input signal needs to be conditioned. A opamp circuit is used for this. In addition to the op-amp, several filters can be added in order to further condition the input. The circuit below in Figure1 shows a possible implementation. The circuit below acts as a simple first order low pass filter, serving the purpose of capping the highest frequency willing to be passed. This is important because excessive input noise can be eliminated. This filter should be set with a cut-off frequency of 2 x f sampling where f sampling is the sampling speed for the intended application. This is in agreement with the nyquist theorem which states that to correctly reconstruct a signal; it must be sampled at twice rate of the highest present frequency. The sampling rate can be determined through software by inserting delays between each sample command. The filter can then be designed to fit this specification.

Figure 1: Pre-amp circuit design. Taken from, Solid State Voice Recorder Using Flash MSP430 (1) by Texas Instruments Several other components must be added to the amplifier circuit in order to accurately acquire the analog signal. A pull-up resistor must be added to the positive terminal of the microphone, R1, a value of 10kΩ should suffice. Figure 1 above shows R1 as 1KΩ, however depending on the microphone being used this is not always a high enough value. C1 acts as a high pass filter to eliminate any DC signal from entering the amplifier. C4 in the feedback loop filters out high frequency noise. C3 can be adjusted to condition the output frequency by the following equation. ( ) The gain of the circuit can also be tuned by adjusting the value of the feedback resistor R5 through the following equation.

The maximum output voltage of the circuit will be from 0 to Vcc. Any input can only be amplified to Vcc. Anything input after amplification resulting in a signal size higher than this will produce a clipped waveform and will not be able to be reproduced effectively. Microcontroller Connections Once the signal conditioning is completed the MSP430F2013 needs to be properly connected. The connections provided will work for the program in the Appendix. First power needs to be supplied to the microcontroller. To do this pin 1 is connected to Vdd and pin 14 is connected to GND. The program will sample through input channel A1. Therefore, pin 4 (A1+) will be the input voltage, and pin 5 (A1-) will be connected to ground. Initialize the AD Converter In order to initialize the ADC several parameters, registers, and bits need to be understood and set to appropriate values. First the reference voltage needs to be set. In the example below, the on chip 1.2V reference source is used. The total resolution is defined over the total voltage range as defined below. With a reference of 1.2V the total voltage range ends up being. The internal voltage reference is activated by setting the SD16REFON bit. An external voltage source can also be used. In order to activate the external voltage source reference, the reference voltage is attached to the Vref pin and SD16REFON and SD16VMIDON are both reset. Next, the analog needs to be configured. The inputs are configured using the SD16CTL0 and SD16AE registers. The MSP430F2013 includes a five channel multiplexed AD converter. Therefor up to five separate inputs can be monitored by the microcontroller. The SD16INCHx bits, where x is the channel (0 4), select the analog input for conversion. The SD16AEx bits, where x is the input pin, enables or disables the input pin. If desired, the input signal can be boosted by setting the SD16GAINx bits, where x is the input channel. The microcontroller has 6 available gain settings. However, if the onboard gain adjustment is used, the settling time required to obtain a signal is altered. This leads to a lower maximum sampling frequency and therefore a lower maximally recorded frequency via the nyquist theorem.

Setting the SD16SNGL bit selects they type of conversion that will be performed. Setting the bit to 1 selects single conversion mode and setting the bit to 0 initiates a continuous conversion. Setting the SD16SC of s specific channel will initiate a conversion. When SD16SNGL is set to 1 and SD16SC is set to one, the AD converter will make a measurement and place the measurement into the SD16MEMO register. It is recommended to read the SD16MEMO register prior to clearing the SD16SC bit to avoid corrupting the measurement. In the example located in the appendix, the SD16SC bit is set to 0 in order to invoke a continuous conversion. Measurements are read when the interrupt is triggered by the _BIS_SR(LPM0_bits + GIE); line. The logic inside of the interrupt can then be modified to suite whatever application is to be completed. Discussion Making AD conversions is a very widely used application for any microcontroller. The MSP430F2013 has a very powerful AD converter that can be used for these applications. The specific application to making samples from an audio signal was discussed here. However, the basic framework provided here can be applied to a variety of other applications. Almost any sensor will return an analog source that needs to be amplified. The amplifier design above can be applied and modified to either enhance gain, or modify the conditioned signal to limit high or low frequency noise further. The parameters that were set in this application note to initialize the AD converter can also be modified to suit the needs of the intended application. For example, the sampling speed could be modified, as well as the AD resolution. This is possible with the flexibility provided by the AD converter on the MSP430F2013. References 1. Solid State Voice Recorder Using Flash MSP430. Texas Instruments. Application Note SLA123. January 2001. Raju, Murugavel. 2. MSP430X2XXX Family User Guide. Texas Instruments. SLAU144E. 2008.

Appendix //This example will continuously sample the source provided at pin4 (A1+) //The on chip referance voltage is used #include <msp430x20x3.h> Static unsigned int sample; void main(void) { WDTCTL = WDTPW + WDTHOLD; SD16CTL = SD16REFON + SD16SSEL_1; SD16INCTL0 = SD16INCH_1; SD16CCTL0 = SD16UNI + SD16IE; SD16AE = SD16AE2; SD16CCTL0 = SD16SC; // Define location to store sample // Stop watchdog timer // 1.2V ref, SMCLK // A1+/- // 256OSR, unipolar, interrupt enable // P1.1 A1+, A1- = VSS // Set bit to start conversion } _BIS_SR(LPM0_bits + GIE); // Enter LPMO with interrupt #pragma vector = SD16_VECTOR interrupt void SD16ISR(void) { if (SD16MEM0!= sample) sample = SD16MEMO; } // Interrupt service routine for // conversion // If the value changes, update sample