Design of Metronome Based on 89C51 Single Chip Microcomputer

Publisher:yuehuiLatest update time:2011-05-24 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1 Hardware Circuit Principle

The metronome uses the AT89C51 single-chip microcomputer as the control center, and is composed of an LED display module, an adjustment keyboard module, and a sound output module. Figure 1 is the circuit schematic diagram of the metronome. The AT89C51 single-chip microcomputer produced by ATMEL is compatible with the MCS51 instruction system, has a 40-pin structure, and is the control center of the system. The display module is composed of a four-in-one common anode blue LED display, which adopts a dynamic scanning display mode. Q11~Q14 is the LED bit selection switch transistor, and R6~R13 is the current limiting resistor of the digital tube segment light-emitting diode. The four-in-one LED digital tube completes the function of displaying the number of beats, various function codes and parameter values. The keyboard adjustment module is composed of 4 buttons, namely, the function selection key A, the parameter setting selection key B, the parameter increase key C and the parameter decrease key D. The 4 buttons can complete the selection of various functions and the setting of various parameters. The sound output module is composed of a power amplifier circuit centered on Q1, Q2, Q3 and a speaker. Pulses of different frequencies are output from the P2.6 port of the microcontroller. After current limiting and power amplification by R14, the speaker is driven to emit a loud sound. Since the output audio signal is a pulse wave, the triode works in a switching state, with low loss and low heat generation. Q2 and Q3 can use small power tubes C8050 and C8550. The hardware structure of the entire system is simple. 12 V DC is provided externally for direct use by the audio amplifier module, and is stabilized to 5 V by LM7805 for use by the microcontroller and LED display.


(Click to view original image)

2 Software Description

The software system adopts modular structure design, including main program module, metronome module, keyboard recognition and parameter setting module, etc. Each module is composed of several sub-modules. After power-on or reset, enter the adjustment function, and repeatedly press the A key to switch between the adjustment function and the metronome function. After entering the adjustment function, repeatedly press the B key to select different adjustment objects, and then press the C or D key to increase or decrease the parameter value of the adjustment object. The code and parameter value of the adjustment object are displayed during adjustment.

2.1 Main program module

In the main program module, the initialization of the storage unit, the initialization of the timer counter, the initialization of the interrupt, the initialization of the flag bit, the keyboard scanning are completed, and one of the following function modules is started according to the value of the function selection key A: parameter setting function, metronome function.

2.2 Metronome Function Module

The beat speed is adjustable in the range of 24 to 400 beats/min, the beat error is less than 2%, and the beat number is adjustable from 1 to 9. The display shows the beat number, and the speaker emits a beat sound. When the beat number 1 is displayed, a high-frequency sound of 600 Hz is emitted for 0.1 s, and when other beat numbers are displayed, a low-frequency sound of 300 Hz is emitted for 0.1 s. The module consists of a beat delay part, a beat number display part, and an audio pulse forming part. The program flow chart of the beat function module is shown in Figure 2.

2.3 Parameter adjustment module

After pressing the A key to enter the parameter adjustment function module, repeatedly press the B key to select the beat speed and beat division parameter settings in turn. The parameter type code and the number of the parameter are displayed on the LED display. Press the C or B key to increase or decrease a unit value within the value range of the parameter. Code 1 is the beat number, with a value range of 1 to 9. Code 2 is the beat speed, with a value range of 24 to 400 beats/min. The module program consists of keyboard scanning and recognition part, parameter display part, A key processing part, B key processing part and C, D key processing and other subroutines.

Figure 2 Metronome module flow chart [page]

3 Experiments

Test the display, buttons, sound and beat accuracy.

Display observation: When in the beat working state, the 4 digital tubes simultaneously display the beat number in a loop, and the beat number can be seen clearly with the peripheral vision when practicing the piano. When in the adjustment mode, the highest digit displays the parameter code to be adjusted, and the remaining 3 digits display the parameter value. When the highest digit of the parameter is zero, it is not displayed. The display is correct.

Key test: Press the function key A to switch between parameter adjustment and beat mode. When in parameter adjustment mode, press the parameter change key B to switch between beat number and beat speed; press the increase key C or decrease key D to increase or decrease the parameter value by 1 based on the current value, and change cyclically within the parameter adjustment range. When in beat working mode, the BCD keys do not work. The keyboard works normally.

Sound observation: The beat is short and powerful, and the tone of the initial beat is clearly different from that of the remaining beats. It can be clearly heard in the piano playing environment.

Meter accuracy measurement: Use a stopwatch to measure the time it takes for a metronome to beat 500 times. When the beat speeds are 72, 112, and 144 beats/min, the times are 418.1 s, 268.9 s, and 210.5 s, respectively, with errors of 0.29%, 0.35%, and 1.1%, respectively. The beat accuracy meets the design requirements.

4 Conclusion

The sound of the starting beat of the metronome is different from the sounds of other beats, with good auditory and visual effects, high beat accuracy, and easy adjustment. Many piano children have achieved good results in piano practice using this metronome. The hardware cost is low, not easy to damage, and the appearance can be designed into a handicraft. The metronome based on the AT89C51 microcontroller has good application value.

Reference address:Design of Metronome Based on 89C51 Single Chip Microcomputer

Previous article:Design of RFID card reader based on AT89C51CC01 single chip and FM1712 chip
Next article:MCS-51 Single Chip Microcomputer and FPGA

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号