Escolar Documentos
Profissional Documentos
Cultura Documentos
MCUs
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 2
Agenda
Understanding Audio Amplifier
Specs
Class A/B/AB/D overview
OpAmp Based Design
PIC16 Subwoofer Amp Design
dsPIC33 Subwoofer Amp Design
Summary
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 3
Reading Audio Specs
Basic Measurements
Power
Frequency Response
THD+N
Phase
SNR
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 4
Power
Specifying Power you must
define
Average continuous power
Load (8ohm, 4ohm)
Maximum THD+N
Frequency Range
Example: 100W average continuous
power into 8 at less than
1%THD+N, from 20 to 20KHz
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 5
Frequency Response
Defined as the amplitude of
device output over a frequency
range for a constant amplitude
input. Can be a graph or
statement
Example:
+0,-0.4dB, 20Hz to 20KHz at 3dB
below rated power
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 6
THD + N
Specifying total harmonic
distortion plus noise you must
define
Output level
Test frequency
Bandwidth
% THD +N
Example 1%THD+N, 1KHz at
rated power, 10KHz BW
2 2
4
2
3
2
2
2
1
2 2
4
2
3
2
2
..
.. * 100
N
N
H H H H H
H H H H
THD
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 7
THD + N
The human ears sensitivity to sound
varies with frequency, level and
duration
Fletcher-Munson Loudness Curve
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 8
Equal Loudness Actual Test
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 9
THD + N
Harmonic distortion is a non linear
distortion. Essentially we put 1 freq on
input and get multiple freq on output
Even and odd harmonics
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 10
Phase
Phase measurements are used to
describe the time offset in a cycle
of periodic waveform. It is usually
defined over a few frequencies
Not an issue on single channel
single speaker but does become
important on multichannel multi
speaker / multi driver systems
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 11
Signal To Noise Ratio
SNR is the ratio of nominal
output level to noise usually
stated in dB
If done at max output it is
called dynamic range
Important to know reference
level of signal
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 12
What About the Loudspeaker?
The capability of speaker will have huge
effect on sound. Watch which harmonics
are generated
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 13
Class A, B and AB Amplifiers
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 14
Linear Amplifiers
There are essentially 3 types of linear audio
amps: Class A, Class B and Class AB.
The focus on each design was to
minimize crossover distortion.
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 15
Efficiencies
Linear amplifiers while being
incredibly linear and can be very
low in distortion have efficiency
draw backs
Theoretical max efficiency on
Class AB is 78% practically seems
to be in 50% region
50 watt amp throws out approx 25
watts of heat!!!
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 16
MCP6HXX OpAmp
Input Offset Voltage: 0.7 mV (typical)
Quiescent Current: 135 A (typical)
Common Mode Rejection Ratio: 100 dB
(typical)
Power Supply Rejection Ratio: 102 dB
(typical)
Rail-to-Rail Output
Supply Voltage Range:
- Single-Supply Operation: 3.5V to 16V
- Dual-Supply Operation: 1.75V to 8V
Gain Bandwidth Product: 1.2 MHz
(typical)
Slew Rate: 0.8V/s (typical)
Unity Gain Stable
Extended Temperature Range: -40C to
+125C
No Phase Reversal
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 17
Class AB OpAmp Design
Very simple circuit. Using a OpAmp
for feedback and 2 BJTs for power
amplification
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 18
Class AB Demo
Demo Amplifier with simple
audio (music)
Measurements
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 19
Audio Measurement Tools
Diagnostic System for Sound Fields
(DSSF) Software
Frequency Response
THD
Real Time Analyzer
Impulse Response
Signal Generator
Oscilloscope
www.ymec.com
M-Audio External Sound Card
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 20
Test Setup
Amplifier PC
External
Sound
Interface
OUT
IN
IN
OUT
OUT
LOAD
ATTENUATION
Oscilloscope
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 21
Test Setup Loopback
Frequency Response
THD vs. Frequency
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 22
Test Setup
Dummy
Load
Signal
Generator
PC
Sound
Card
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 23
Linear Amp Freq Response
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 24
Linear Amp THD vs Freq
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 25
Lessons Learned
Very simple to design and make
Large bulk caps are required
470uF to 1000uF on each of the +/-
power rails
Input amplifier must be clean of
noise, other wise it will be
amplified
50/60Hz hum can be present, if so
larger bulk caps or linear
regulators
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 26
Linear Amplifiers
Any Questions
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 27
Class D Amplifiers
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 28
Class D Basics
Why go to a class D amplifier
Efficiency
As mentioned earlier a class AB is
approx 50% efficient
Theoretically a class D can be 100%
efficient
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 29
Class D Basics
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 30
Class D Topologies
Bridge Drive
Full Bridge Drive
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 31
Class D, Single and Split
Supply
Split supply
bridge dont need large caps, for low
frequency response
Full bridge no advantage
Single supply
bridge need large caps to create
virtual rail, power on pop when
charging caps
Full bridge only need one rail
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 32
Class D, Output Filter
R2
494m
C1
150u
R1
8
AC 8 0
V1
330u
L1
R3
100m
=OUT/IN
OUT IN
F = 1/(2*PI()*SQRT(L*C))
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 33
Overview of New PIC16
Devices
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 34
PIC16F15XX Family
Internal Voltage Ref
2 Comparators
10bit ADC, Cap Sense Module
4 10-bit PWM Channels
Numerically Controlled Oscillator
(NCO)
Complementary Waveform
Generator (CWG)
Configurable Logic Cell (CLC)
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 35
PIC16F178X Family
Internal Voltage Ref
3 Comparators
2-3 OpAmps
12-bit ADC
8-bit DAC
16-bit PSMC PWM
16nsec edge resolution
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 36
PIC16F182X Family
Internal Voltage Ref
2 Comparators
10-bit ADC, Cap Sense Module
Multiple PWM Channels including
ECCP
Data Signal Modulator
5-bit DAC
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 37
Lets Make A
Subwoofer Amp
with a PIC16
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 38
SubWoofer Design
Design goal
Low THD
10-20Watt output
Freq Response 20-200Hz.
Use PIC16 with 10-bit ADC, 10-bit
PWM
Allow for open and closed loop
operation
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 39
Class D PIC16 Block
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 40
Level Shift Circuitry
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 41
Class D, Open Loop
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 42
ISR ADC/PWM Code
// *************************************************************************//
// this routine is the interrupt service routine Timer 2 //
// *************************************************************************//
void interrupt Timer2ISR(void){
// check if its a timer 2 flag
if(TMR2IF == 1)
TMR2IF = 0;
CaptureADC();
UpdatePWM(input);
// turn interrupt on again
GIE = 1;
}
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 43
Bus Pumping
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 44
Class D, Closed Loop
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 45
PID Code
// ********************************************
// calculate the PI control loop
// ********************************************
void CalcPI(void)
{
Error = Input - Feedback;
//*********************************************
// calculate integral with bounded limits
// *********************************************
if(SatFlag !=1){
Integral = Integral + Error;
if(Integral > 1023)
Integral = 1023;
else if (Integral < -1023)
Integral = -1023;
}
//*********************************************
// calculate integral with bounded limits
// *********************************************
Differential = Error - PreviousError;
if(Differential > 1023)
Differential = 1023;
else if (Differential < -1023)
Differential = -1023;
PreviousError = Error;
// *********************************************
// calculate output and scale it
// *********************************************
Output = KP*Error + KI*Integral + KD*Differential;
Output = Output>>10;
// *********************************************
// write output with bounded limits
// *********************************************
if(Output > OUTMAX){
Output = OUTMAX;
SatFlag = 1;
}
else if (Output < OUTMIN){
Output = OUTMIN;
SatFlag = 1;
}
else{
Output = Output;
SatFlag = 0;
}
}
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 46
Amplifier Output
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 47
Lessons Learned
Just like class B it was easy via layout and
components to amplify noise
Separate rail for preamp, PIC ADC
Just like class B it was easy via layout and
components to amplify noise
Ensure 470-1000uF per rail
Synchronize ADC with PWM
Half bridge needs FB and big caps to ensure no
bus pumping
Closed loop troublesome
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 48
Bass Shaker App.
What is a Bass Shaker.
Adding a new level to gaming
industry or home theaters
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 49
Using dsPIC33 Devices for a
Class D SubWoofer Amp
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 50
Design Goals
>30W output @ 8 ohms
20-500Hz Frequency Response
Closed loop design
< 1% THD in B/W of interest
Achieve transparent bass audio
quality with peripherals available
to us on the dsPIC33 devices
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 51
dsPIC33 Device Families
dsPIC33FJXXMCXXX Family
500KSPS 12-bit or 1.1MSPS 10-bit
ADC
Motor Control PWM (MCPWM)
dsPIC33FJXXGSXXX Family
2 or 4MSPS 10-bit ADC
SMPS PWM
2012 Microchip Technology Incorporated. All Rights Reserved. 1675 AMP Slide 52
dsPIC