当前位置:网站首页>[single chip microcomputer] [make buzzer sound] know the buzzer and let it make the sound you want
[single chip microcomputer] [make buzzer sound] know the buzzer and let it make the sound you want
2022-06-22 15:48:00 【sinat_ forty-one million seven hundred and fifty-two thousand t】
The buzzer in the single chip microcomputer
1. triode
Triode is a semiconductor device that controls current , The function is to amplify the weak signal into an electrical signal with large amplitude value ( Radio frequency method ), Also used as contactless switch ( Used as a switch ).
Simply speaking , Triode has the function of current amplification .
Triode is called semiconductor triode , Or bipolar transistor 、 Crystal triode , There are two packaging methods : Plug in and chip mount .
The working principle of triode : There are two kinds of circuit arrangement inside the triode , One is PNP type , One is NPN type , The only difference between the two is that the current flows in different directions .
The triode has three pins , Namely BASE( The base )、EMITTER( The emitter )、COLLECTOR( Collector ). The internal circuit of the triode is as follows , On the left is NPN type , On the right is PNP type .

PNP type : When B extremely ( The base ) The current is greater than 1mA when , Or when the base voltage is less than the emitter voltage , Conduction between collector and emitter , There's electricity going through .
NPN type : When the base potential is a few tenths of a volt higher than the emitter , The emitter junction is in a positive bias state , When the collector potential is several volts higher than the base potential , The collector junction is in the reverse bias state , The collector power supply should be higher than the base power supply .
about NPN tube , It is from 2 block N There is a piece of semiconductor in the middle P Composed of semiconductor , Formed between the emission region and the base region PN A knot is called a launch knot , The collector area and the base area form PN A junction is called a collector junction ,
2. Know the buzzer
The buzzer on the single chip microcomputer is as follows , The green circuit board on the left is the active buzzer , The passive buzzer is sealed with black glue on the right .

According to whether it contains Oscillating circuit , Buzzer can be divided into active buzzer and passive buzzer .
The active buzzer is directly controlled by the high and low levels , The passive buzzer needs a certain frequency of pulse to trigger sound .
The electromagnetic buzzer consists of an oscillator 、 Electromagnetic coil 、 Magnets 、 It is composed of vibrating diaphragm and shell . How it works : When the power is on , The current of the audio signal generated by the oscillator passes through the electromagnetic coil , Make the electromagnetic coil produce a magnetic field , The vibrating diaphragm is under the interaction of electromagnetic coil and magnet , Periodically vibrate and sound . The buzzer has an oscillation circuit , It belongs to active buzzer .
Piezoelectric buzzer is mainly composed of multivibrator 、 Piezoelectric buzzer 、 Impedance matchers and resonators 、 The enclosure lamp consists of . How it works : A multivibrator consists of a transistor or an integrated circuit , When the power is on (1.5V~15V DC operating voltage ), The multivibrator starts , Output 1.5~2.5kHz The audio signal , The impedance matching device pushes the piezoelectric buzzer to sound . The buzzer belongs to a passive buzzer .
The buzzer can only work by amplifying the driving current through the amplifying circuit .
For passive buzzers ,
Change the frequency of the output waveform of the MCU pin , The control buzzer tone can be adjusted , Produce a variety of different timbres 、 The sound of tone ;
The high and low level duty cycle of the Centennial output level , It can control the sound level of the buzzer .
3. ULN2003 A brief introduction to the chip
As mentioned earlier, the buzzer needs to pass the amplifying circuit to make sound , stay 【 Puzhong 51- Single core -A2 The board 】 On , Use ULN2003 The chip amplifies the current .
ULN2003 High voltage resistance 、 High Current Darlington display , It's made of seven silicon NON Darlington tube composition .
ULN2003 It's a high current drive array , It is mostly used for single chip microcomputer 、 Smart meters 、PLC、 Digital output card lamp control circuit , The buzzer can be driven directly 、 Relay and other loads .
4. Buzzer related circuit

The buzzer is connected to through an amplifying circuit P1^5, By controlling P1^5 The high and low levels of the port form a pulse , Trigger the buzzer to sound .
sbit beep = P1^5;
void ring_buzzer()
{
beep = 0;
while(1)
{
beep = ~beep;
delay_ms(100);
}
}Integrated application with running water lamp , Make a running water lamp , The light is on and the buzzer makes a sound
/************************************************************
P1 Mouth to mouth 8 individual LED, Co anode ,P37 Connected to buzzer
Make a running water lamp , The light is on and the buzzer makes a sound
************************************************************/
#define LEDP1 P1
sbit beep = P3^7;
void led_p1_beep_p37()
{
u8 i=0;
u16 delay_times = 10000; // 200ms
// The initial state
P1 = ~0x01;
delay_ms(delay_times);
while(1)
{
for(i=0;i<7;i++)
{
P1 = _crol_(P1,1); // The left one
beep = ~beep;
delay_ms(delay_times);
}
for(i=0;i<7;i++)
{
P1 = _cror_(P1,1); // The left one
beep = ~beep;
delay_ms(delay_times);
}
}
}Proteus Simulation display results :

5. Use the buzzer to make music
Reference resources :STC89C52 MCU buzzer introduction and 《 Lone brave 》 Song code example _ Avocado loves to eat piglets -CSDN Blog _51 MCU buzzer music code
边栏推荐
- What are the five characteristics of network security? What are the five attributes?
- 【VTK】模型旋转平移
- Are there many unemployed people in 2022? Is it particularly difficult to find a job this year?
- DevSecOps: CI/CD 流水线安全的最佳实践
- Exploration and practice of dewu app data simulation platform
- 我靠副业一年全款买房:那个你看不起的行业,未来十年很赚钱!
- 快速玩转CI/CD图形化编排
- The bank card identification function of Huawei machine learning service enables bank card identification and binding with one click
- After 100 days, Xiaoyu built a robot communication community!! Now invite moderators!
- 高精度计算
猜你喜欢
![[Newman] postman generates beautiful test reports](/img/5c/b95c1c475e69d69acad75215ea9565.png)
[Newman] postman generates beautiful test reports

C language learning -18-makefile file writing examples and how to generate and call dynamic libraries

How to use the concat() function of MySQL

晒晒我这两年的私活单,业余时间月入6k,有份副业也太香啦

Devsecops: best practices for ci/cd pipeline security

C# 实现插入排序

MongoDB在腾讯零售优码中的应用

UK considers listing arm in London based on national security

Scala语言学习-05-递归和尾递归效率对比

Ultimate efficiency is the foundation for the cloud native database tdsql-c to settle down
随机推荐
A simple understanding of hill ordering
Hello, big guys. Error reporting when using MySQL CDC for the first time
【一起上水硕系列】Day Three - video
乱解码nlp
C # implements insertion sorting
推进兼容适配,使能协同发展 GBase 5月适配速递
Wallys/DR7915-wifi6-MT7915-MT7975-2T2R-support-OpenWRT-802.11AX-supporting-MiniPCIe
快速排序quick_sort
New hybrid architecture iformer! Flexible migration of convolution and maximum pooling to transformer
Scala language learning-06-differences between name passing parameters, value passing parameters and function passing parameters
向量3(静态成员)
加密市场进入寒冬,是“天灾”还是“人祸”?
还整成这样
Runmaide medical passed the hearing: Ping An capital was a shareholder with a loss of 630million during the year
【单片机】【让蜂鸣器发声】认识蜂鸣器,让蜂鸣器发出你想要的声音
Development status of full color LED display
SDVO:LDSO+语义,直接法语义SLAM(RAL 2022)
ROS2前置基础教程 | 使用CMakeLists.txt编译ROS2节点
How MySQL modifies a field to not null
How MySQL modifies the storage engine to InnoDB