You Are Here: Home » Game – Entertainment Project Ideas » Intelligent Multimedia System Atmel mega32

Intelligent Multimedia System Atmel mega32


This project implements a multi-function multimedia system that allows the user to sing with the music video and generate some fancy sound effects.

Intelligent Multimedia System Atmel mega32

In recent decades, multimedia becomes quite popular in our daily life. In fact, multimedia system has existed for a long time. People enjoy the time viewing photos, listening to music, and watching movies. With the development of technology, we are able to create, modify and edit multimedia data. Also, thanks to the emergence of the digital era, we have more tools that help us to achieve these goals. For example, we could store the analog data in digital format to make it more robust and lasting. Besides, we are able to synthesize the data and generate some amazing effects.

Our final project is to design an intelligent multimedia system. This system allows users to use the microphone as the analog input to speak and sing. Besides, since it is not only a multimedia system but an intelligent multimedia system, we have implemented several features that help the users to modify, synthesize, and create a multimedia record. For example, we could adjust the volume of the voice and music. Besides, we could generate the echo of our voice as if we are in a theatre. Furthermore, since we could transform the analog signal into digital format, we are able to manipulate the audio data. In this project, we used several popular mathematical models in the field of Audio Signal Processing that help us to simulate specific sound effects. All the audio data could be recorded in real time by passing to the PC via the RS232 COM Port.

The kernel of the system is controlled by the ATMega32 microcontroller, same as the one we used in the regular lab sections. The voice signal input is generated from the microphone, and the music signal is generated from any music application such as a MP3 player or PC. We passed both of the audio signals through a pre-amplifier to boost its signal strength. Then, we used an analog-to-digital converter chip (ADC0801)  to transform the analog signal into digital data. The digital data can then be propagated to the microcontroller. Besides, we use the RS232 serial port to communicate between the microcontroller and the PC. This design allows us to transfer the music data to the PC from this multimedia system in real time.  In the microcontroller, we could capture both of the voice signal and music signal and mix them to generate special effects. The output signal can then be propagated to a digital-to-analog chip (DAC0808) to transform the digital data to analog signal. Finally, the signal will be passed to the speaker and generate a wonderful melody. In order to provide user with a friendly graphic user interface (GUI), we integrate the technology of JAVA and Visual C++ in Windows programming. User could apply the featured effects to the voice signal via this GUI.

High Level Design

The final project is a good experience for us to integrate all the knowledge that we gained in this course and some other related courses. We chose this topic because we are all interested in multimedia signal processing. Also, we thought that this topic would be a good chance for us to combine our knowledge in various fields. For example, we applied the knowledge that we gained in this course to process the voice and music signal utilizing the optimal capacity of all the components to generate the amazing effects. Also, we could understand more about the analog circuit when we integrated all the hardware components. Furthermore, we had integrated various programming languages such as C, C++ in Windows programming, and Java into our multimedia system. During the process of development, we overcame the challenge of incompatibility between C++ and JAVA. Finally, to process the audio signal, we did some research in the field of Digital Signal Processing and combined some mathematical models to generate proper effects that we applied in this project.

The overall design block of this system is shows as follows. In this project , we used two different channels for our audio signal inputs: one is a microphone and the other is a music application such as MP3 player or PC. Initially both of the signals are in analog format, so we needed two analog-to-digital converters to transform the analog signal into digital format before feeding into the microcontroller. Since there is only one analog-to-digital converter embedded in ATMega32, we used the internal analog-to-digital converter for the voice channel and an external analog-to-digital converter chip (ADC0801) for the music channel. The signal could be manipulated in the microcontroller. The signal will be propagated to the digital-to-analog converter chip (DAC0808) to be transferred into analog format. Finally, the processed signal is passed to a speaker to generate the sound. In this project, we use the GUI in Windows XP as our system control. It provides a user-friendly graphical interface to allow the users to control the system by a mouse click. The mouse click is then turned into a command to the microcontroller via the COM Port.

There were so some minor changes we made in the system architecture while we were working on this project. Some of the changes were made since we encountered some limitation in the hardware. For example, in a common karaoke system, we need at least two channels for one voice input and one music input. However, there is only one internal analog-to-digital converter in ATMega32. If we use it for both voice and music signals alternatively, the sample rate will be reduced to less than half of the original one. This would lower the sound quality. In order to solve this problem, we decided to use an external analog-to-digital converter chip (ADC0801) for the music channel. In this way, the microcontroller can sample both the voice and music signals in 8KHz in maximum concurrently which the produces a higher sound quality. Besides, initially we decided to output the processed signal to the speaker in the same approach that we learned in Lab 2. However, we found that the sound quality was pretty bad since this approach used PWM mode of the microcontroller to generate an approximate signal and hence the accuracy of signal output was lowered. To cope with this problem, we used a digital-to-analog chip (DAC0808) to transform the digital output to an analog output that makes the sound more dulcet. For the choice of user interface, we initially decided to use the buttons on the STK-500 board as the control panel. However, we found that using a PC can provide a much flexible and user-friendly control interface. Hence, we decided to use a GUI running on the PC as the software control panel. All the changes we made help improving the performance of the multimedia system on the whole.

Since all of our team members are ECE MEng students, Cornell University owns all copyrights and potential, patents related to this project. Since the ideas and implementation of our project hardware are solely our own, there should not be any trademark, patent, or copyright infringement issues.

Embedded System Side

In our multimedia system, we used UART of RS232 standard to receive command from PC and send mixed signal output back to PC. Also we used the timers to control the sampling frequency of voice and music signals as well as mixed signal output.

Features/effects supported by the microcontroller firmware



Implementation Concept

No EffectThe multimedia system simply outputs the mixed signalsThe mixed signal is the combination of the voice signal and the music signal
Frequency ControlUsers can choose within the range of 1 ~ 8 KHz as the sampling frequency where 8KHz is of best qualityThe sampling frequency is controlled by the timer interrupt of the microcontroller
Volume ControlUsers can adjust volume of voice and music signals within the range of 0 ~ 10 scale where 10 is of highest volumeThe voice and music signals are scaled according to the selected scale before combination
EchoUsers can select echo effect within the range of 1 ~ 15 scale where 15 is of most noticeable echo effectThe voice output is the combination of 75% of current voice signal and 25% of previous voice signal
Distortion – PatientVoice output sounds like a patient speaking softlyThe high magnitude of voice input signal is filtered and replaced by the upper bound and lower bound
Distortion – Walki-TalkiVoice output sounds like speaking through a walki-talki with distortionThe voice output signal is the square of the voice input signal
Distortion – RobotVoice output sounds like a robot voiceA high frequency sine wave signal is added to the voice signal
Distortion – Gaussian NoiseVoice output consists of additive white Gaussian noiseA random signal is added to the voice signal
Distortion – Lower Pitch Voice output sounds like lowering the pitch a bitThe voice output signal is generated by averaging 16 previous voice input signals

PC Software

In order to facilitate the communication between a PC and the microcontroller, we make use of the high speed serial port. The console program configures the COM Port to run at a baud rate of 115.2kbps. The program gets the command from the graphical user interface and transmits it to the microcontroller, and at the same time receives the real time digital audio data from the microcontroller. The Java application on top of the console program is to provide graphical user interface for the multimedia system and the useful operations such as displaying the voice waveform, recording the voice in a wave file and sending an email attached with the wave file. The following diagram demonstrates the general data flow between the microcontroller, the console program and the Java application.

The following is the user interface of our program. The left panel is to display the waveform of the audio signal. The right panel is effect control and volume control panel.  All the buttons on the bottom are to control the operations of the multimedia system.

Program / Hardware Design

Software Design – Embedded System Side



In our multimedia system, we implemented a Graphical User Interface written in Java running on the PC to control the whole embedded system.  The UART Receive Complete Interrupt is enabled to allow the program jump to the interrupt service routine to receive the command packets.  The received data is then passed to processCommandPacket() to be saved into the command packet buffer. A state machine is implemented in the packet reception. The code is as follows.


//UART RX Complete ISR

interrupt [USART_RXC] void uart_receive(void)


    //Process the char received from serial port




//Process command packet received from serial port

void processCommandPacket(unsigned char data)


    switch (commandState)


    case CMD_B1:

            //First byte of command

            commandPacket.command = data;

            //Change command state

            commandState = CMD_B2;


    case CMD_B2:

            //Second byte of command

            commandPacket.command |= (((unsigned int)data)<<8);

            //Change command state

            commandState = LEN_B1;


    case LEN_B1:

            //First byte of packet length

            commandPacket.dataLen = data;

            //Change command state

            commandState = LEN_B2;


    case LEN_B2:

            //Second byte of packet length

            commandPacket.dataLen |= (((unsigned int)data)<<8);

            //Change command state

            commandState = DATA_SEC;

            //Disable RX complete interrupt

            UCSRB.7 = 0;





There are 7 different commands the PC can send to the microcontroller. They are listed as below.


//enum for commands

typedef enum {








} Command;


The packet structure for command packet has 4 bytes.  The first 2 bytes are for 16 bits command. The second 2 bytes are for 16 bits payload length of the command packet. The command packet is stored to the variable commandPacket and processed by the checkCommand() function later. The checkCommand() function handles the command packet sent from the PC software. The code is shown as follows.
//enum for command state

typedef enum {






} CommandState;

//Command packet structure

typedef struct CommandPacketTag {

    Command command;

    unsigned int dataLen;

} CommandPacket;

//Check the command and execute it

void checkCommand()


    switch (commandPacket.command)


            //Turn on the multimedia system

            case TURN_ON:




            //turn off the multimedia system

            case TURN_OFF:




            //Set the music volume

            case SET_MUSIC_VOLUME:




            //Set the voice volume

            case SET_VOICE_VOLUME:




            //Set the sampling frequency

            case SET_SAMPLE_FREQUENCY:                     




            //Perform the echo effect

            case SET_ECHO:





            //Set distortion effect

            case SET_DISTORTION:





    //Enable serial communication receive interrupt



The sampled audio signal is sent to the PC in the timer interrupt. The code is as follows.

//Send the mixed signal to PC via the serial port

while (!(UCSRA & (1<<5)));

UDR = mixedSignal;


Signal Sample Buffer

In the multimedia system, we have designed some special effects for voice processing. Therefore we implemented a sample buffer of size 1500 bytes to store the signal samples and reuse the buffer continuously. The implementation is as follows.

//Number of byte in SRAM used for sample buffer


unsigned char sample[SAMPLE_BUFFER_SIZE]; //Sample data array

Internal ADC

Our program used the internal Analog-to-Digital Converter of ATMega32 microcontroller to obtain the voice signal from a microphone via an Op-Amp circuit to amplify the signal strength. The conversion rate is up to 15,000 samples at maximum per second. Our systems sampling rate is 8000 Hz. So the internal ADC suits for our system requirement. The reference voltage is 5V. The Op-Amp circuit has a 2.5V DC-offset. Therefore, for no signal, the digital representation is theoretically 128. But in our tests, we found that the sample data of the voice signal was in fact 120. This is because the DC-offset is not exactly 2.5V and the circuit is imperfect due to interference and impedance.

Intelligent Multimedia System Atmel mega32 Diagram

In the function processSignal(), the following code is to get the voice signal from ADC, store the signal to a sample buffer and then start another conversion.

//Get the voice signal from the ATMega32’s on-chip ADC

voiceSignal = ADCH;

//Store the voice signal in the sample buffer

sample[sampleIndex] = voiceSignal;

//Start another voice ADC conversion

ADMUX = 0b11100000;  


Parts List:

ATMega321$8Lab equipment
Breadboard1$0From trash bin
LM358 Operational Amplifier2$0Lab equipment
LM7111 Operational Amplifier1$0Lab equipment
Speaker1$0Sheng-Yi Shih’s
PC1$0Ah Yud Chan’s
Microphone1$0Borrowed from Jimmy Chen


For more detail: Intelligent Multimedia System Atmel mega32

Leave a Comment

You must be logged in to post a comment.

Read previous post:
Ultrasonic spotlight tracker using Atmel mega32

Introduction A spotlight that follows you on its own! The ultrasonic spotlight tracker is a system that uses a wireless...

Scroll to top