Real time digital audio processing with Arduino

Similar documents
Digital Signal Processing. VO Embedded Systems Engineering Armin Wasicek WS 2009/10

Discrete Fourier Transform (DFT)

EE 109 Midterm Review

Microcontroller: Timers, ADC

AN AT89C52 MICROCONTROLLER BASED HIGH RESOLUTION PWM CONTROLLER FOR 3-PHASE VOLTAGE SOURCE INVERTERS

Timer/Counter with PWM

EECS 452 Midterm Exam Winter 2012

Data Acquisition Systems. Signal DAQ System The Answer?

Digital Receiver Experiment or Reality. Harry Schultz AOC Aardvark Roost Conference Pretoria 13 November 2008

FFT Analyzer. Gianfranco Miele, Ph.D

8-bit Microcontroller with 512/1024 Bytes In-System Programmable Flash. ATtiny4/5/9/10

Frequency Domain Representation of Signals

Hardware Platforms and Sensors

Hideo Okawara s Mixed Signal Lecture Series. DSP-Based Testing Fundamentals 14 FIR Filter

Grundlagen Microcontroller Counter/Timer. Günther Gridling Bettina Weiss

Embedded Systems and Software. Analog to Digital Conversion

REAL TIME DIGITAL SIGNAL PROCESSING. Introduction

CSCI1600 Lab 4: Sound

EECS 452 Midterm Closed book part Winter 2013

Design and Implementation of AT Mega 328 microcontroller based firing control for a tri-phase thyristor control rectifier

Terminology (1) Chapter 3. Terminology (3) Terminology (2) Transmitter Receiver Medium. Data Transmission. Direct link. Point-to-point.

EE 215 Semester Project SPECTRAL ANALYSIS USING FOURIER TRANSFORM

Department of Electronic Engineering NED University of Engineering & Technology. LABORATORY WORKBOOK For the Course SIGNALS & SYSTEMS (TC-202)

6 Sampling. Sampling. The principles of sampling, especially the benefits of coherent sampling

Application Note: Using the Motor Driver on the 3pi Robot and Orangutan Robot Controllers

8-bit Microcontroller with 2K Bytes In-System Programmable Flash. ATtiny20

Qäf) Newnes f-s^j^s. Digital Signal Processing. A Practical Guide for Engineers and Scientists. by Steven W. Smith

Generating DTMF Tones Using Z8 Encore! MCU

International Journal of Advances in Science and Technology (IJAST)

The Discrete Fourier Transform. Claudia Feregrino-Uribe, Alicia Morales-Reyes Original material: Dr. René Cumplido

32-bit ARM Cortex-M0, Cortex-M3 and Cortex-M4F microcontrollers

Lab 0: Introduction to TIMS AND MATLAB

H e s s o. Laboratory Experiments

Analog/Digital Guitar Synthesizer. Erin Browning Matthew Mohn Michael Senejoa

THE PERFORMANCE TEST OF THE AD CONVERTERS EMBEDDED ON SOME MICROCONTROLLERS

Linear Time-Invariant Systems

Chapter 7. Introduction. Analog Signal and Discrete Time Series. Sampling, Digital Devices, and Data Acquisition

Section 1. Fundamentals of DDS Technology

Measuring Distance Using Sound

Grid Power Quality Analysis of 3-Phase System Using Low Cost Digital Signal Processor

Capacitive MEMS accelerometer for condition monitoring

Data acquisition and instrumentation. Data acquisition

Mel Spectrum Analysis of Speech Recognition using Single Microphone

Electrical & Computer Engineering Technology

ELCT 912: Advanced Embedded Systems

Hideo Okawara s Mixed Signal Lecture Series. DSP-Based Testing Fundamentals 6 Spectrum Analysis -- FFT

Current Rebuilding Concept Applied to Boost CCM for PF Correction

Using the Freescale MMA9550L for High Resolution Spectral Estimation of Vibration Data by: Mark Pedley

Coming to Grips with the Frequency Domain

Signals. Periodic vs. Aperiodic. Signals

Implementation of Multiquadrant D.C. Drive Using Microcontroller

8-bit Microcontroller with 2/4/8K Bytes In-System Programmable Flash. ATtiny24/44/84. Preliminary

y(n)= Aa n u(n)+bu(n) b m sin(2πmt)= b 1 sin(2πt)+b 2 sin(4πt)+b 3 sin(6πt)+ m=1 x(t)= x = 2 ( b b b b

CHAPTER 4 CONTROL ALGORITHM FOR PROPOSED H-BRIDGE MULTILEVEL INVERTER

The Scientist and Engineer's Guide to Digital Signal Processing By Steven W. Smith, Ph.D.

8-bit Microcontroller with 2K/4K/8K Bytes In-System Programmable Flash. ATtiny24A ATtiny44A ATtiny84A

Lab 4 Digital Scope and Spectrum Analyzer

CHAPTER 5 HARDWARE IMPLEMENTATION AND PERFORMANCE ANALYSIS OF CUK CONVERTER-BASED MPPT SYSTEM

The Fundamentals of Mixed Signal Testing

EE445L Fall 2012 Final Version B Page 1 of 7

Spectrum Analysis - Elektronikpraktikum

SAMPLING THEORY. Representing continuous signals with discrete numbers

CHAPTER III THE FPGA IMPLEMENTATION OF PULSE WIDTH MODULATION

Logistics. Kinetic Art. Embedded Systems. Embedded Systems and Kinetic Art. Jim Campbell s Algorithm

Embedded Systems and Kinetic Art. CS5968: Erik Brunvand School of Computing. Art4455: Paul Stout Department of Art and Art History.

ATtiny102 / ATtiny104. Introduction. Feature. 8-bit AVR Microcontroller DATASHEET COMPLETE

Physics 115 Lecture 13. Fourier Analysis February 22, 2018

8-bit Microcontroller with 16K Bytes In-System Programmable Flash. ATtiny1634

ELEC3104: Digital Signal Processing Session 1, 2013

8-bit Microcontroller with 4K Bytes In-System Programmable Flash and Boost Converter. ATtiny43U. Preliminary

Orthogonal frequency division multiplexing (OFDM)

DISCRETE FOURIER TRANSFORM AND FILTER DESIGN

From Digital to RF Debugging in the Time and Frequency Domain. Embedded Systems Conference 2015 May 6-7, 2015

Using Z8 Encore! XP MCU for RMS Calculation

AN2182 Application note

The quality of the transmission signal The characteristics of the transmission medium. Some type of transmission medium is required for transmission:

Signal Processing Toolbox

Outline. Discrete time signals. Impulse sampling z-transform Frequency response Stability INF4420. Jørgen Andreas Michaelsen Spring / 37 2 / 37

B.Tech III Year II Semester (R13) Regular & Supplementary Examinations May/June 2017 DIGITAL SIGNAL PROCESSING (Common to ECE and EIE)

Electronic Counters. Sistemi Virtuali di Acquisizione Dati Prof. Alessandro Pesatori

AN1567 APPLICATION NOTE

Abstract Over the last decade, impelled bby the huge open source software community support, the low cost Arduino

PROJECT NOTES/ENGINEERING BRIEFS

Introduction. In the frequency domain, complex signals are separated into their frequency components, and the level at each frequency is displayed

8-bit Atmel tinyavr Microcontroller with 16K Bytes In-System Programmable Flash. ATtiny1634

Spectrum. The basic idea of measurement. Instrumentation for spectral measurements Ján Šaliga 2017

A digital method to determine the transmissibility of a MEMS device

Hardware Flags. and the RTI system. Microcomputer Architecture and Interfacing Colorado School of Mines Professor William Hoff

DASL 120 Introduction to Microcontrollers

AC to AC STEP DOWN CYCLOCONVERTER

Lab 3 SPECTRUM ANALYSIS OF THE PERIODIC RECTANGULAR AND TRIANGULAR SIGNALS 3.A. OBJECTIVES 3.B. THEORY

CHAPTER 2 VSI FED INDUCTION MOTOR DRIVE

8-bit Microcontroller with 2/4/8K Bytes In-System Programmable Flash. Atmel ATtiny24/44/84. Automotive. Preliminary

High performance, low power AVR 8-bit microcontroller Advanced RISC architecture. Non-volatile program and data memories. Peripheral features

8-bit Microcontroller with 1K Bytes In-System Programmable Flash. ATtiny13A

Sampling and Reconstruction of Analog Signals

Advanced Digital Signal Processing Part 2: Digital Processing of Continuous-Time Signals

Audio Visualiser using Field Programmable Gate Array(FPGA)

26.8: A 1.9GHz Single-Chip CMOS PHS Cellphone

Digital Waveform Recorders

Transcription:

Real time digital audio processing with Arduino André J. Bianchi ajb@ime.usp.br Marcelo Queiroz mqz@ime.usp.br Departament of Computer Science Institute of Mathematics and Statistics University of São Paulo SMC 213, July 3th - August 3rd

Real time digital signal processing Digital audio signal processing includes: Acquiring samples. Processing. Outputting results. Real time restriction: Block processing: N samples. Sampling frequency: R Hz. DSP cycle period: T DSP = N R s.

Real time DSP with Arduino http://interface.khm.de/index.php/lab/experiments/arduino-realtime-audio-processing/

Atmel AVR microcontroller (ATmega328P) Microcontroller s characteristics: CPU: ALU and registers (16 MHz - 8 bits). Memory: Flash (32 KB), SRAM (2 KB) e EEPROM (1 KB). Digital I/O ports: Audio input: analog to digital converter. Audio output: counters capable of doing PWM.

Arduino performance for real time digital audio processing Questions: What is the maximum number of operations feasible in real-time? Which implementation details make a difference? What is the quality of the resulting audio signal? DSP algorithms implemented: Additive synthesis. Time-domain convolution. FFT.

Audio input: analog to digital converter 6 Arduino ADC maximum conversion frequencies Advertised ADC frequency Measured ADC frequency 5 4 Frequency (KHz) 3 2 1 44.1 2 4 8 16 32 64 128 Prescaler value

Pulse Width Modulation 1 counter overflow original signal 8-bit counter 1 PWM output

Audio output: Pulse Width Modulation 8-bit counter frequencies for different prescaler values: prescaler f incr (KHz) f overflow (Hz) 1 16 625 8 2 7812 32 5 1953 64 25 976 128 125 488 256 62.5 244 124 15.625 61 PWM overflow interrupt allow for periodically triggering: ADC conversion. Signal manipulation. PWM mechanism value set.

Additive synthesis 5 Additive Synthesis on Arduino (loop) 5 Additive Synthesis on Arduino (inline) Synth time (ms) 4 3 2 1 Synth time (ms) 4 3 2 1 1 2 3 4 5 6 7 8 9 1 11 12 13 14 15 Number of oscilators 1 2 3 4 5 6 7 8 9 1 11 12 13 14 15 Number of oscilators bl. size 32 bl. size 64 bl. size 128 bl. size 32 bl. size 64 bl. size 128

Additive synthesis Example Sum of harmonics with f =2 Hz: y[n] =? k=1 ( sin 2πk2 n ). R

Time-domain convolution Synth time (ms) Time-domain convolution on Arduino (mult/div) 9 8 7 6 5 4 3 2 1 1 2 3 4 5 6 7 8 9 1 11 12 13 14 15 bl. size 32 rt per. 32 bl. size 64 rt per. 64 Order of the filter bl. size 128 rt per. 128 bl. size 256 rt per. 256 Synth time (ms) Time-domain convolution on Arduino (bit-shifting) 9 8 7 6 5 4 3 2 1 1 2 3 4 5 6 7 8 9 1 11 12 13 14 15 bl. size 32 rt per. 32 bl. size 64 rt per. 64 Order of the filter bl. size 128 rt per. 128 bl. size 256 rt per. 256

Time-domain convolution Example: moving average 1 Moving Average Frequency Response Amplitude 1 2 3 order 2 order 4 Frequency order 8 order 16

The above figure illustrates the aforementioned process. An N-point time record [x(t ), x(t 1 ),, x(t N-1 )] will generate N points [X(-f N/2 ), X(f ),, X(f N/2 )] in the frequency domain containing both negative and positive frequency parts. The positive and negative frequency parts can be combined to produce N/2+1 points [X(f ), X(f 1 ), X(f N/2 )] at real frequencies in the amplitude/power spectrum. These points are located at frequencies:, f used to convert the discrete signal (discrete in time) in the time domain to its counterpart (discrete in frequency) in the frequency domain. DFT can be computed efficiently in practice using a Fast Fourier Transform (FFT) algorithm, which is generally N/log(N)-1 times faster than DFT, where N is called DFT or FFT size, which is the number of data points used in the computation. To achieve maximum efficiency of computation in FFT, N is generally constrained to an integer power of two, e.g. 124, 248, 496, 8192, etc.. Fast Fourier Transform x(t) x(t) X(f) ADC DFT/FFT t t t N-1 t -f N/2 f = f f N/2 1) continuous signal in time domain 2) N points in time domain 3) N points in frequency domain containing both negative and positive frequency parts X(f) f f = f N/2 4) N/2+1 points in amplitude/power spectrum

Fast Fourier Transform Analysis time (ms) 3 25 2 15 1 5 FFT on Arduino (at 1953 Hz)... 64 128 256 512 fft sin() fft table Block size rt period Maximum frequency for block size 256: Mean calculation time 428,15 µs per sample. Maximum frequency 2.335 Hz. PWM prescaler value 32 R = 1.953 Hz.

Conclusions Many implementation details make a difference: Types used (byte, unsigned long, int, float, etc). Type of operations: integer (multiplication, division, sum) and bitwise. Presence of loops. Use of variables and vectors. Families of algorithms can be found to make it feasible to use the Arduino in real time audio processing.

Thank you for your attention! Contact: Email: {ajb,mqz}@ime.usp.br This presentation: http://www.ime.usp.br/~ajb/ CM at IME: http://compmus.ime.usp.br/ Attribution of figures taken from wikipedia: PWM: Zurecs (zureks@gmail.com). Additive synthesis: Chrisjonson. FFT: Virens.