In the design of single-chip microcomputer applications, many solutions will use buzzers, most of which use buzzers to make prompts or alarms, such as button pressing, starting work, working at the end or malfunctioning.
1. Drive mode
Since the self-excited buzzer (active buzzer) is driven by DC voltage, there is no need to use AC signal to drive, only need to output the drive level of the drive port and amplify the drive current through the transistor to make the buzzer sound, very simple, here is not the self-excited buzzer explained. Only the other buzzer that must be driven by a 1/2 duty square wave signal is explained here.
There are two ways for the single-chip microcomputer to drive the buzzer (passive buzzer): one is to drive the PWM output port directly, and the other is to use the I/O timing flip level to generate a driving waveform to drive the buzzer.
PWM output port direct drive is the use of PWM output port itself can output a certain square wave to directly drive the buzzer. In the software settings of the single-chip microcomputer, there are several system registers used to set the output of the PWM port, and the duty cycle, period, etc. can be set to generate a frequency that meets the requirements of the buzzer by setting these registers
After the waveform, as long as the PWM output is turned on, the PWM output port can output the square wave of this frequency, and the buzzer can be driven by this waveform. For example, the driver of a buzzer with a frequency of 2000Hz can know that the period is 500μs, so that only the period of PWM needs to be set to 500μs and the duty cycle level is set
At 250μs, a square wave with a frequency of 2000Hz can be generated, and the transistor can be used to drive the bee bee through this square wave. The use of I/O timing flip level to generate a driving waveform will be a little more troublesome, must use a timer to do timing, through the timing flip level to generate a frequency waveform that meets the requirements of the buzzer, this waveform can be used to drive the buzzer. For example, the drive of a buzzer of 2500Hz can know that the period is 400μs, so that only the I/O port of the driver buzzer needs to flip the level every 200μs to generate a square wave with a frequency of 2500Hz and a duty cycle of 1/2duty, and then amplify the buzzer through the transistor.
May 13, 2023Leave a message
Detailed design of single-chip microcomputer drive buzzer
Send Inquiry




