2474 views|2 replies

1

Posts

0

Resources
The OP
 

Zhou Mengqiang Ye Yuting Xiao Yuheng Micro KTV [Copy link]

  This post was last edited by Dumu on 2018-9-2 13:52
Micro KTV
Abstract: This design gives a single-chip microcomputer control system with AT89C52 as the core, equipped with Bluetooth module, LCD display module, LED module and playback module. The single-chip microcomputer is connected to the wireless communication system through Bluetooth. The mobile phone is responsible for sending data, which is sent to the single-chip microcomputer through Bluetooth, so as to realize the control of the audio buttons. The LCD display is realized by transmitting data and instructions through the eight-bit data terminal D0~D7. By making hardware circuits and software design and writing, and then debugging and running the hardware and software, the instrument operation of the designed circuit is finally achieved. This system runs stably, with the advantages of real-time display of team member information, display of lyrics of corresponding playback sentences, simple hardware circuit, perfect software function, reliable control system, and high cost performance.
Keywords: AT89C52, audio power amplifier, Bluetooth remote control, running water small lamp.
Abstract:The system is based on AT89C52 microcontroller as thecore,Bluetooth module,LED control module,liquid-crystal display module as wellas transmit module.Connecting microcomputer to nRF communications systemthrough Bluetooth. The phone in charge of sending data to microcomputer throughBluetooth so that it can control keystoke.Achieving display of LCD byactive-matrix.By making hardware ware and designing software,then debu gging andtroubleshooting so as to succeed in operating musical instrument.The system's operation is stabilized.,has a series of advantages that can display information of team numbers timely,display the libretto of what we play,easy hard wares,complete soft wares as well as perfect cost performance.
Keywords:AT89C42, bluetooth module,active-matrixaddressing,the lamplet of eotic effet .
1System design and demonstration 1.1System overall design
This system is mainly composed of AT89C52 single-chip control system module, Bluetooth module, LCD display module, LED module and playback module. The structural block diagram of this system is shown in Figure 1.
file:///C:/Users/acer/AppData/Local/Temp/msohtmlclip1/01/clip_image002.jpg
Figure 1 System structure block diagram
Among them, the Bluetooth module connects the smart phone and the single-chip computer. The user uses the nine keys 0~9 on the mobile phone keyboard to send the corresponding data to the single-chip computer through Bluetooth. The single-chip computer receives and processes the data, and then executes the corresponding steps according to the program downloaded into the single-chip computer in advance.
The LCD display module transmits data and instructions through the eight-bit data terminal D0~D7. It is connected to the interface in the LCD module on the single-chip computer, which is easy to operate. Through the corresponding program burning, the basic information of the team members is displayed on the display screen.
The LED module is driven and sent by an emitter follower circuit. The digital information is directly modulated and sent, while the audio signal is converted by ADC and then sent by FSK modulation. The LED lights are arranged in a five-pointed star shape, and the brightness is changed by program control as the audio of the electronic piano changes.
The playback module is connected via Bluetooth. After sending a signal to the microcontroller, the corresponding pin of the microcontroller is connected to the speaker. Pressing the keys on the keyboard continuously will continuously emit the corresponding music.
1.2 Design scheme demonstration 1.2.1 Microcontroller main control module
Solution 1: Select STM32 as the main control chip. STM32 contains an ARM Cortex-M3 core, a 12-bit D/A converter, a clock frequency of up to 72MHz, and a processing speed faster than other chips. However, due to its many functions and complex structure, it seems to be a waste of resources for the processing of the electronic piano.
Scheme 2: Choose AT89C52 as the main control chip. AT89C2 is a low-power, high-performance single-chip microcomputer. The chip contains 4k Bytes ISP Flash read-only program memory that can be repeatedly erased and written 1000 times. The device is manufactured using ATMEL's high-density, non-volatile storage technology. The chip integrates a general-purpose 8-bit central processor and ISP Flash storage unit. The powerful microcomputer AT89C52 can provide a cost-effective solution for many embedded control application systems.
Based on the above comparison, choose scheme 2.
1.2.2 Playback module
Scheme 1: Use a buzzer to play music. Use single-chip microcomputer programming technology to set the chip function to play music. At the same time, use the timer interrupt inside the single-chip microcomputer to generate square waves of different frequencies to drive the buzzer to emit music of different tones. The delay function is then used to control the length of the pronunciation time. This control structure is simple, but after preliminary debugging, it was found that its timbre and audio amplification effects are not completely satisfactory and cannot achieve the expected results.
Option 2: Use a speaker amplifier to play music. TELESKY is an audio integrated amplifier with the advantages of low power consumption, low distortion, and reliable performance. The principle is: when a current-carrying conductor passes through a magnetic field, it will be subjected to an electric force. When the voice coil inputs an alternating audio current, the voice coil is subjected to an alternating driving force to produce alternating motion, repeatedly pushing the air to make a sound. This design has been tested many times, and the sound is loud and clear, the beat is normal, and the expected effect has been achieved.
1.2.3 Liquid crystal display module
Option 1: Use TFT liquid crystal display. The resolution of TFT liquid crystal display is 320x240. It is one of the best LCD displays. It has the advantages of high responsiveness, high brightness, high contrast, etc., but the capital investment and technical requirements of TFT liquid crystal display are relatively high.
Option 2: Use 12864 liquid crystal display. LCD12864 can display Chinese characters and graphics, and the display is clear. It has the advantages of relatively low power consumption, small size and no area consumption, ultra-thin and light weight.
Based on the above comparison, option 2 is selected.
2. Theoretical analysis and calculation
Pronunciation principle and conversion of count pulse value and pronunciation frequency
Pronunciation principle: Since this system can generate sounds of various frequencies, the speaker can emit the scale of "DO", "RE"... Timer O in the system works in mode 0. The timing duration can be determined according to the frequency of the sound, and the initial value of the timer count is deduced from the frequency value.
A piece of music is composed of many different scales, and each scale corresponds to a different frequency. The timer T0 of the microcontroller can be used to generate such a square wave frequency signal. If you want to generate an audio pulse, just calculate the period of a certain audio, and then divide this period by 2, which is the time of half a period. Whenever the timing ends, P3.3 is reversed, and then the timing is repeated and reversed, and a pulse of this frequency can be obtained on the P3.3 pin. Using the internal timer of AT89C52D to make it work in counter mode (MODE1), changing the count values TH0 and TL0 to generate different frequencies to generate different scales. For example: the frequency is 523HZ, and its period T=1/523=1912us, so as long as the counter is timed 956us/1us=956, and I/O is reversed every 956 counts, the middle tone DO (523HZ) can be obtained. The relationship between the count pulse value and the frequency is: N = fi/2/fr
In the formula, N is the count value; fi is the machine frequency (when the crystal oscillator is 12MHz, its frequency is 1MHz). Fr is the desired frequency. The method for calculating the initial count value T is as follows:
T=65536-N=65536-fi/2/fr
For example: Let K=65536, fi=1MHz, calculate the count values of bass DO (261Hz), midrange DO (523Hz), and treble DO (1046Hz). T=65536-N=65536-fi/2/fr=65536-500000/fr. Bass DO's T = 65536-500000/262 = 63627. Alto DO's T = 65536-500000/523 = 64580. Treble DO's T = 65536-500000/1046 = 65059.The 12MHZ crystal oscillator of the microcontroller, the high, medium and low notes and the count values related to the count T0 are shown in Figure 2.
Notes
Frequency (HZ)
Simplified musical notation code (T value)
[align= left]note
frequency (HZ)
[/td][td=150 ]
Simplified musical notation code (T value)
Low 1DO
262[/ align]
63628
中5SO
784
[ /align]
64898
Low 2RE
294[/ align]
63835
中6LA
880
[ /align]
64968
low 3M
330[/ align]
64021
[/td][ td=109]
中6LA
880
[/ align]
64968
Low 4FA
349[/ align]
64103
[/td][ td=109]
High 1DO
1046
[/ align]
65058
Low 5SO
392[/ align]
64260
[/td][ td=109]
高2RE
1175
[/ align]
65110
Low 6LA
440[/ align]
64400
[/td][ td=109]
高2RE
1175
[/ align]
65110
Low 7SI
494[/ align]
64524
[/td][ td=109]
High 4FA
1397
[/ align]
65178
中1DO
523[/ al ign]
64580
High 5SO
1568
[/td][td=150 ]
65217
中2RE
587[/ align]
64684
[/td][ td=109]
6LA high
1760
[/ align]
65252
中3M
659[/ align]
64777
[/td][ td=109]
High 7SI
1967
[/ align]
65283
中4FA
698[/ align]
64820
[/td][td= 88]
Figure 2 High, medium and low notes and the count value of count T0
[size=18.0 pt]3. Circuit Design3.1. 1ledFlowing water lighting circuit[/b The positive electrode of the LED is provided with 5V voltage by the power supply, and the negative electrode is connected to the I/O port of the microcontroller through a resistor of about 300 ohms. The P1 and P3 ports of the microcontroller control the output of the display signal, and the high and low frequency are controlled by the program. After the system is powered on, the LEDs from LED1 to LED10, LED9 to LED2 are lit one by one, and then all the lights are on and off. If the microcontroller is powered on, the program will continue to cycle. The moving time between two points of the colored lights is 0.5 seconds. The LED water flow lighting circuit is shown in Figure 3.
Figure 3 LED water flow lighting circuit
[size= 11.0pt]3.1.2TDA2030AAudio power amplifier circuit
This audio amplifier system The circuit uses the TDA2030 audio power amplifier as the core component. It has the advantages of low power consumption, few external components and low total harmonic distortion. Because sound is a wave with different amplitudes and frequencies, that is, AC signal current, the transistor The collector current is always a times the base current. Applying this, if a small signal is injected into the base, the current flowing through the collector will be equal to a times the base current. The electric signal is then isolated by a DC blocking capacitor, and a current (voltage) a times larger than the original current is obtained. This is the amplification effect of the triode. After continuous current and voltage amplification, power amplification is achieved. , thus achieving audio power amplification. The circuit diagram of TDA2030A audio power amplifier is shown in Figure 4 below. 479,430]file:///C:/Users/acer/AppData/Local/Temp/msohtmlclip1/01/clip_image006.jpg[/img]
[font =宋体]Figure 4 TDA2030Aaudio power amplifier circuit
4 . Test plan and test results4.1 Measuring instruments[/ b]
Calculator, multimeter, recording pen, data sheet, etc.
4.2 System test method and test data[/font ]
4.2.1[size= 12.0pt]Hardware Debugging The hardware debugging part is mainly for debugging the single-chip microcomputer. Before powering on, make sure there is no short circuit or open circuit in the circuit. This is the first and most important step in debugging the entire work. The main tool used in this step is a multimeter, which is used to detect whether there is a short circuit or open circuit in the circuit. Pay attention to the solder joints to ensure that the solder joints are not short-circuited together, and pay attention to the appearance of the solder joints. Only when the hardware circuit is normal and there is no abnormality can it be powered on for debugging. The purpose is to detect whether the circuit is connected incorrectly and whether the principle is correct. In this design, power-on debugging is mainly to test the hardware debugging of the single-chip microcomputer control part and the audio conversion circuit. After powering on, press the specific keys on the mobile phone keyboard and find that the pronunciation corresponding to each key is correct. 4.2.2 Software Debugging: Main debugging methods and techniques: Usually a debugging program has at least four functions: tracing, breakpoints, viewing variables, and changing values. We debugged the subprograms of each submodule and found that each subprogram ran correctly and smoothly. Then we modularized each subprogram and found that the entire program could run smoothly. 4.2.3 Simulation Results By simulating and analyzing the circuit, the simulation circuit of the electronic keyboard is shown in the figure below. Since the audio power amplifier circuit adopts the TDA2030 chip, the audio amplification is free of noise and more stable, further achieving the experimental effect. However, there are also certain flaws: after the key is pressed, there is a delay before the sound is heard. The debugging results are basically consistent with expectations. As shown in the figure.
file:///C:/Users/acer/AppData/Local/Temp/msohtmlclip1/01/clip_image008.jpg
Figure 5 Electronic piano circuit simulation diagram
4.2.4 Result analysis
According to the simulation results, it can be seen that the design of this work can accurately meet the expected requirements. Press "0, 1, 2[ respectively. /size]3[/ size],4,5,[/font ]6" seven buttons, the audio amplifier will send out signals respectively "DO[font=九. FA[ SOLASI” and the volume can be adjusted freely.
5. Summary
After intensive debugging in May, the whole work has basically met the expected requirements. We have benefited a lot from the design of this preliminary competition. We have a deeper understanding of many modules in the microcontroller, such as the Bluetooth module and the LCD module, and have a deeper understanding of DXP and Visio.0pt] and other drawing software. Throughout the process, we encountered many problems, big and small. For example, when soldering the corresponding components on the PCB board drawn after a period of exploration, many places had problems such as cold soldering and accidentally dropping the copper soldering on the board when soldering the components, which directly led to the LCD display screen failing to display information during the debugging process. After the team members used the multi-purpose board to check one by one, they finally solved them one by one. After basically completing the software and hardware debugging of the work, we realized that an excellent work should not only achieve the basic functions and internal perfection, but also pay attention to the external image of the work. Therefore, the team independently designed and packaged the appearance of this work in the later stage, making the whole work "both inside and outside". In short, through the production of this work, I realized that our work is a team work, and we must carry forward the spirit of unity and cooperation to solve problems more conveniently. References Guo Tianxiang. 51 Single Chip Microcomputer C Language Tutorial [M]. Electronic Industry Press, 2009. Yang Suxing. A Brief Tutorial on the Basics of Analog Electronic Technology [M]. Higher Education Press, 2001. Kang Huaguang, Qin Zhen. Digital Part of Electronic Technology Foundation [M]. Modern Electronic Technology, 2006. Appendix: Main Program void main() { LCD12864_Init(); //12864Initialization
InitUART();
while(1)
{
if((r_buf=='0'))
{
LCD12864_WriteC md(0x01); //[font=九. Led0();
}
if((r_buf=='1'))
{ [/size ]
PlayMusic();
LCD12864_WriteCmd(0x01);
lcd();
L ed1();
}
if((r_buf=='2'))
{
[ align=left] PlayMusic2();
LCD12864_WriteCmd(0x01);
lcd2();[/align ]
Led2();
}
if((r_buf=='3')) [/align ]
{
PlayMusic3();
LCD12864_WriteCmd(0x01);
lcd3();
[ align=left] Led3();
}[/ size]
if((r_buf=='4'))
[ align=left] {
LCD12864_WriteCmd(0x01);[ /size]
lcd4();
Led0();
[align =left] PlayMusic4();
}[/size ]
if((r_buf=='5'))
[align =left] {
LCD12864_WriteCmd(0x01);[/ size]
lcd5();
Led0();
[align =left] PlayMusic5();
}[/size ]
if((r_buf=='6'))
[align =left] {
LCD12864_WriteCmd(0x01);[/ size]
lcd5();
Led0();
[align =left] PlayMusic6();
}[/size ]
if((r_buf=='7'))
[align =left] {
LCD12864_WriteCmd(0x01);
[align =left] lcd5();
Led0();
PlayMusic7();
[ font="] }
if((r_buf=='a'))
{
LCD12864_WriteCmd(0x01);
[align=left ] lcd();
Led0();[/ size]
PlayMusic();
}
}
}

This post is from Innovation Lab

Latest reply

The idea is very good, practice more, summarize more, and you will be on your way to becoming a great person.  Details Published on 2018-9-4 09:28
 
 

693

Posts

7

Resources
2
 
Not bad, very good.
This post is from Innovation Lab
 
 
 

1368

Posts

6

Resources
3
 
The idea is very good, practice more, summarize more, and you will be on your way to becoming a great person.
This post is from Innovation Lab
Personal signature专注智能产品的研究与开发,专注于电子电路的生产与制造……QQ:2912615383,电子爱好者群: void
 
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list