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:
(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:
(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).
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
}
}
}
}
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
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Discussion on some details of dual independent clock fifo
- ir2110 drives MOS tube. Help
- Counting the number of people around you using ESP32
- Download: Qorvo Internet of Things For Dummies 2nd Edition
- Learn how to use an oscilloscope as a recorder
- [Xingkong Board Python Programming Learning Main Control Board] 2: Burning System Image
- NB module problem
- [EETalk] Outlook for the development of consumer electronics interfaces - Will USB dominate the world?
- What is the difference between embedded and microcontroller?
- Compilation issues