LM386 simple audio amplifier circuit diagram Music player design based on LM386 amplifier chip

Publisher:一条属马的龙Latest update time:2023-07-21 Source: elecfansKeywords:LM386 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1. Introduction to LM386 power amplifier chip

LM386 is an audio integrated amplifier with the advantages of low power consumption, adjustable voltage gain, wide power supply voltage range, few external components and low total harmonic distortion. It is widely used in tape recorders and radios.


The chip operating voltage is 4-12V or 5-18V (LM386N-4); the static current consumption is 4mA; the voltage gain is 20-200dB; when pins 1 and 8 are open, the gain is 20DB; the bandwidth is 300KHz; the input impedance is 50K: the audio power is 0.5W.

The LM386 chip pins are as shown in the figure:

picture

(1) Pin 2 is the inverting input terminal.

(2) Pin 3 is the common-mode input pin

(3) Pin 5 is the output terminal:

(4) Pins 6 and 4 are power and ground respectively;

(5) Pins 1 and 8 are the voltage gain setting terminals;

(6) Connect a bypass capacitor between pin 7 and ground, usually 10pF.

2. Supplementary knowledge on voltage gain

Amplifier gain is the logarithm of the ratio of output power to input power, which is used to express the degree of power amplification. It also refers to the amplification factor of voltage or current. Decibel is the unit of amplifier gain.

(1) Voltage gain: Av (dB) = 20log (|Av|)

The voltage gain value is expressed in decibels and is equal to 20 times the absolute value of the base 10 logarithm, or

Current gain (dB): Ai(dB)=20log(|Ai|);

The current gain value (in decibels) is equal to 20 times the absolute value of the base 10 logarithm of that multiple.

(2) For example, the LM386 open-loop gain is 20DB, which means the voltage gain is 10, or the power gain is 10.

As can be seen from the circuit diagram, five-wire four-phase means that the motor has four coils and five terminals, of which pin 5 is the common terminal.

3. Application circuit:

picture

(1) Potentiometer RT1 is used to adjust the volume.

(2) C2 is a bypass capacitor used to reduce audio noise.

(3) The filter circuit composed of R1 and C1 is used to filter and adjust the input impedance.

(4) C6 and C7 are chip power decoupling capacitors.

(5) BEEP is 8 ohm, 0.25W speaker;

(6) Connect 10uF capacitors to LM386 gain pins 1 and 8, and the gain is 200DB.

Note: This circuit is used for PWM audio and requires an appropriate resistor in series.

IV. Application Examples

Here is a simple music player using microcontroller PWM audio output.

First, the power amplifier circuit uses the above circuit. The difference is that a 10k resistor (R2) is connected in series to the input pin of the circuit. Its main function is to reduce the input current (another way is to reduce the gain of the power amplifier circuit).

picture

Then the microcontroller pin P1.0 outputs a series of PWM that changes the frequency with the audio signal, which can drive the speaker to play a piece of music through the power amplifier circuit.

program:


//《The Most Romantic Thing》

unsigned char code song8[]={

5,1,1, 6,1,1, 1,2,1, 6,1,2, 6,1,1, 5,1,1, 6,1,1, 5,1,1, 3, 1,1, 5,1,5,

5,1,1, 6,1,1, 1,2,1, 6,1,2, 6,1,1, 5,1,1, 6,1,1, 5,1,1, 6, 1,1, 1,1,5,

1,1,1, 2,1,1, 3,1,1, 2,1,1, 2,1,1, 2,1,1, 1,1,1, 2,1,1, 1, 1,1, 6,1,1,

3,1,2, 2,1,3, 5,1,1, 6,1,1, 1,2,1, 6,1,2, 6,1,1, 5,1,1, 6, 1,1, 5,1,1,

6,1,1, 1,1,5, 1,1,1, 2,1,1, 3,1,1, 4,1,2, 4,1,1, 5,1,1, 6, 1,1, 6,1,1,

5,1,1, 6,1,2, 1,2,1, 6,1,3, 1,2,1, 6,1,1, 5,1,1, 5,1,4, 1, 1,1, 6,1,1,

5,1,5, 5,1,1, 6,1,1, 1,2,1, 3,1,1, 2,1,1, 3,1,1, 1,1,6, 0, 0,0};



// The high eight bits of the frequency-half-period data table store a total of 28 frequency data of four octaves

unsigned char code FREQH[]={

0xF2, 0xF3, 0xF5, 0xF5, 0xF6, 0xF7, 0xF8, //Bass 1234567

0xF9, 0xF9, 0xFA, 0xFA, 0xFB, 0xFB, 0xFC, 0xFC,//1,2,3,4,5,6,7,i

0xFC, 0xFD, 0xFD, 0xFD, 0xFD, 0xFE, //Treble 234567

0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFF}; //Super high pitch 1234567



// Frequency-half-period data table lower eight bits

unsigned char code FREQL[]={

0x42, 0xC1, 0x17, 0xB6, 0xD0, 0xD1, 0xB6, //Bass 1234567

0x21, 0xE1, 0x8C, 0xD8, 0x68, 0xE9, 0x5B, 0x8F, //1,2,3,4,5,6,7,i

0xEE, 0x44, 0x6B, 0xB4, 0xF4, 0x2D, ​​// high pitch 234567

0x47, 0x77, 0xA2, 0xB6, 0xDA, 0xFA, 0x16}; //Super high pitch 1234567



void main(void)

{

TMOD=0x11; //T0 T1 are both in working mode 1

ET0=1; //T0 opens interrupt

EA=1; //CPU interrupt

while(1)

{

music_play(); //Play a note of the corresponding song according to the current state



if(!pause) //Pause key processing

{

delayms(5);

if(!pause)

{

if(music_num==0) //music_num=0 only exists when the device is just powered on and the pause button is not pressed, indicating the state when the device is just powered on. Press the button to start playing from the first song.

{

music_num=1; //Set the song number to 1

num=0; //play from the beginning

play_enable=1; //Allow playback

}

else

{

play_enable=~play_enable;

speaker=1;

}

while(!pause) //What to do if you hold down the pause button

{

if(play_enable==0){} //If it is paused, the display time remains unchanged //(play_enable==0 when paused)

}



}//Pause key processing ends

}//while ends



if((!play_up)&&(music_num!=0)) //Previous song button

{

delayms(5);

if((!play_up)&&(music_num!=0))

{ speaker=1;

music_num-=1; // song number minus one

if(music_num<=0)

music_num=8;

num=0; //Start playing from the beginning



if(music_num==(sound_amount+1))

music_num=1;

delayms(500); // song switching delay 0.5S

}

}



if((!play_down)&&(music_num!=0))

{

delayms(5);

if((!play_down)&&(music_num!=0))

{ speaker=1;

music_num+=1; //Song number plus one

if(music_num >=9)

music_num=1;

num=0; //Start playing from the beginning



if(music_num==0)

music_num=sound_amount;

delayms(500); // song switching delay 0.5S

}

}



}

}


Keywords:LM386 Reference address:LM386 simple audio amplifier circuit diagram Music player design based on LM386 amplifier chip

Previous article:LM386 audio power amplifier circuit diagram LM386 typical application circuit
Next article:USB Type-C PD power chip LDR6328S introduction

Recommended ReadingLatest update time:2024-11-16 16:32

Design of a radio receiver based on the LM386 audio amplifier
Although the ubiquitous LM386 IC was designed for use as an audio amplifier, it has a number of undocumented properties that can be used to create simple radio receiver circuits that provide surprisingly high performance. These circuits can be used to receive AM, CW, and SSB RF transmissions in the medium wave and s
[Embedded]
Design of a radio receiver based on the LM386 audio amplifier
Latest Embedded Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号