29
1 MICRO CONTROLLER BASED AUDIO RECORDING/PLAYBACK SYSTEM Chapter-1 INTRODUCTION The main objective of our project is to generate different tunes having different frequencies using an advanced micro controller family. So we have selected 16F877A PIC for this purpose to achieve our requirements. It includes keyboard having 8 micro switches, frequency synthesizer, a low wattage audio power amplifier and a 10 watt speaker. All these sections are controlled by a micro controller namely 16F877A. Power requirements for all these sections are controlled by a five volt and nine volt regulated ICs namely LM7805 and LM7809. The input micro key depressions are monitored at every instant by micro controller , based on stored programs written in assembly language that are stored in internal flash of PIC. The program consists of key depression monitoring, activation and deactivation of play back and recording. First four keys of the keyboard are meant for recording and the rest for playback. When a key is pressed the micro controller receives a high signal through its port. Activation signals are produced which govern the APR9600 chip. In respond to the signal the APR9600 either records a message or plays a message. It produces a message signal of 60 seconds, 40 seconds and 32 seconds duration according to Dept of ECE Govt. Engg. College, Sreekrishnapuram

Micro Controller Based Record-playback System

Embed Size (px)

Citation preview

Page 1: Micro Controller Based Record-playback System

1MICRO CONTROLLER BASED AUDIO RECORDING/PLAYBACK SYSTEM

Chapter-1

INTRODUCTION

The main objective of our project is to generate different

tunes having different frequencies using an advanced micro controller family. So we have

selected 16F877A PIC for this purpose to achieve our requirements. It includes keyboard

having 8 micro switches, frequency synthesizer, a low wattage audio power amplifier and

a 10 watt speaker. All these sections are controlled by a micro controller namely

16F877A. Power requirements for all these sections are controlled by a five volt and nine

volt regulated ICs namely LM7805 and LM7809.

The input micro key depressions are monitored at every

instant by micro controller , based on stored programs written in assembly language that

are stored in internal flash of PIC. The program consists of key depression monitoring,

activation and deactivation of play back and recording. First four keys of the keyboard are

meant for recording and the rest for playback. When a key is pressed the micro controller

receives a high signal through its port. Activation signals are produced which govern the

APR9600 chip. In respond to the signal the APR9600 either records a message or plays a

message. It produces a message signal of 60 seconds, 40 seconds and 32 seconds duration

according to the oscillation frequency selected by the user. It has the feature of selecting 8

messages of fixed duration depending on data bits of message select pin. A condenser

microphone is used for recording the required message. The generated message having

very low wattage activates a loud speaker. In this project we are using an audio power

amplifier for further amplification of the generated APR frequencies. The amplifier is a

dual channel power amplifier based on UTC6283 IC. This IC is commonly used in inbuilt

digital audio systems. The amplified output is given to a speaker which produces the

required acoustic signals.

Dept of ECE Govt. Engg. College, Sreekrishnapuram

Page 2: Micro Controller Based Record-playback System

2MICRO CONTROLLER BASED AUDIO RECORDING/PLAYBACK SYSTEM

Chapter-2

BLOCK DIAGRAM AND DESCRIPTION

2.1 BLOCK DIAGRAM

Dept of ECE Govt. Engg. College, Sreekrishnapuram

KEY BOAR

D

PIC MICRO CONTR-OLLER

FREQU-

ENCY SYNTHESIZ

ER

SPEAKER

5VOLT POWE

R SUPPL

Y

DUAL

AUDIO

POWER

AMPLIF-IER

9VOLT POWE

R SUPPL

Y

MIC

Page 3: Micro Controller Based Record-playback System

3MICRO CONTROLLER BASED AUDIO RECORDING/PLAYBACK SYSTEM

2.2 BLOCK DIAGRAM DESCRIPTION

2.2.1 MIC

A condenser MIC is used. The condenser MIC converts acoustic

signals into electrical signals. The condenser MIC is connected to the frequency

synthesizer so that acoustic signals can be recorded.

2.2.2 POWER SUPPLY

We used two voltage levels here i.e. +5 V & +9 V. +5 V power

supply is fed to PIC and frequency synthesizer. +9 V power supply is fed to dual

audio power amplifier.

2.2.3 SWITCH ARRAY

Switch array contains eight switches, four switches for play back

and remaining for recording. For play back a high to low transition is needed and

for recording a continuous low is needed.

2.2.4 PIC MICRO CONTROLLER

In this Peripheral Interface Controller (PIC) IC, PORT B is

selected as input ports and PORT C as output ports. We used PIC 16F877A, which

has got EPROM, RAM and a FLASH memory of 8K. The depression produced by

the key is monitored by this PIC. Its output is fed to the input of the frequency

synthesizer. PIC 16F877A is a 40 pin IC, and have a clock frequency of 20MHz.

The program for this PIC is done in assembly language. Instead of general purpose

registers in micro processors, there are working register W in PIC and also has

user-defined registers.

2.2.5 VOICE RECORDING AND PLAYBACK

We use an IC named APR9600 which has 28 pins as a high quality

voice recording and playback solution. It also has storage capacity. It can store

almost eight messages and can store messages of maximum sixty second duration.

Dept of ECE Govt. Engg. College, Sreekrishnapuram

Page 4: Micro Controller Based Record-playback System

4MICRO CONTROLLER BASED AUDIO RECORDING/PLAYBACK SYSTEM

2.2.6 POWER AMPLIFER

Dual channel power amplifier based on the UTC 6283 is used in

this. This is commonly used in inbuilt digital audio systems. It amplifies the output

from APR 9600.

2.2.7 SPEAKER

It is a simple speaker which converts the electrical signals into

acoustic signals.

Dept of ECE Govt. Engg. College, Sreekrishnapuram

Page 5: Micro Controller Based Record-playback System

5MICRO CONTROLLER BASED AUDIO RECORDING/PLAYBACK SYSTEM

Chapter-3

CIRCUIT DIAGRAM & EXPLANATION

3.1 POWER SUPPLY SECTION

Figure 3.1 FIVE VOLT REGULATED POWER SUPPLY

Power supply section contains three sections i.e. rectifier section, filter

section, voltage regulator section to produce +5 V from 9 V / 1 A transformer. In regulator

section two capacitors of 0.1 µF can be used to maintain the spikes during the voltage

variation. LM-7805 is used as voltage regulator IC. This +5 V is fed to PIC and APR

9600. A +9 V supply is fed to the dual audio power amplifier.

3.2 PIC MICRO CONTROLLER SECTION

Keyboard containing eight switches in which four switches for play back

and remaining for recording is interfaced with PIC 16F877A microcontroller IC having 8

K flash memory. In that PORT B is set as input port. PORT B is set as input, and PORT C

as output port. PORT B has got internal pull up resistors which are normally at +5 V

MCLR/VPP (32nd pin) is meant for memory clear and VPP will get directly from burner

kit.

Dept of ECE Govt. Engg. College, Sreekrishnapuram

Page 6: Micro Controller Based Record-playback System

6

RESET

1 KΩ1 KΩ

1 KΩ

+ 5 V

22 p F

22 p F 20 MHz

MICRO CONTROLLER BASED AUDIO RECORDING/PLAYBACK SYSTEM

Figure 3.2 PIC- KEYBOARD INTERFACE

In this mini- project we made use of PIC 16F877A there are only 35 single word

instruction to learn in microcontroller. It is a 40 pin IC the data memory is partitioned in to

multiple banks which contain the general purpose registers and the special function

registers. Bits RP1 and RP0 are the bank select bits.

TABLE 3.2 BANK SELECTING

RP1:RP0 BANK

00 0

01 1

10 2

11 3

Thus there are four banks; each extends up to 128 bytes. All implemented

banks contain special function registers. All banks contain status registers contain the

arithmetic status of the ALU, the RESET status and the bank select bits for the data

memory.

PIC contains five PORTS, i.e. PORT A (6 bit), PORT B (8 bit), PORT C

(8 bit), PORT D (8 bit) and PORT E (3 bit) which are confined to BANK0. The

Dept of ECE Govt. Engg. College, Sreekrishnapuram

To APR 9600

Page 7: Micro Controller Based Record-playback System

7MICRO CONTROLLER BASED AUDIO RECORDING/PLAYBACK SYSTEM

corresponding data direction registers TRIS A, TRIS B, TRIS C, TRIS D and TRIS E are

confined to BANK1. Clearing this data direction register will make corresponding port pin

as output.

Here we made PORT B as input by setting its corresponding bits to 1 and

PORT C as output by clearing corresponding bits. PORT B has got internal pull up

resistors which are normally at + 5 V.

When a key is pressed, the corresponding key depression is monitored by

the PIC. Accordingly an output is generated after executing the program and output is

generated in PORT C. The 27th pin in APR9600 IC is connected to a manual switch by

which we can control the record-playback mode.

In recording mode, we have to press recording switch continuously, the

corresponding PORT C bit is pulled to low and it remains in low state as long as we press

the switch. This continuous low output is fed to next stage which leads to recording.

In playback mode, we have to disconnect the 27th pin of APR9600 IC

from ground. This enables the playback switches and disables the recording switches.

Through programming, we have made the pull up resistors disabled.

Hence RB’s are in zero state. When key is pressed, corresponding PORTB bit becomes 1,

hence it outs a low and is fed to the input of the APR9600 IC. Then the current will sink to

PORT C bit in APR9600 which causes a high to low transition in APR9600. Thus

recorded message is played.

3.3 FREQUENCY SYNTHESIZER SECTION

APR9600 is used as a high quality voice recording and playback solution.

User selectable messaging options one present in this IC. Level activated recording and

edge activated play back switches makes its operation easy. It has got low power

consumption and a play back capability of 40 – 60 seconds. The device supports both

random and sequential access of multiple messages

Dept of ECE Govt. Engg. College, Sreekrishnapuram

Page 8: Micro Controller Based Record-playback System

8MICRO CONTROLLER BASED AUDIO RECORDING/PLAYBACK SYSTEM

Figure 3.3 VOICE RECORDING/PLAYBACK USING APR9600

The amplified microphone signal is fed into the device by connecting the

Ana-out pin to the Ana-In pin through in external dc block capacitor. Recording can be fed

directly into the Ana-in pin through a dc blocking capacitor. However the connection

between Ana-In and Ana-out is still required for playback. When playback is desire the

previously stored recording is retrieved from memory, low pass filtered and amplified for

playback.

Random access mode supports two, four or eight messages segments of

fixed duration. Sequential access mode messages sequentially. We used sequential mode

access in this. APR has an internal memory of 256 k.

3.3.1 Function Description of Playback in Tape Mode

On power-up, the device is ready to record or play back, starting at

the first address in the memory array. Before you can begin playback, the /CE

input must be set to low to enable the device and /RE must be set to high to disable

recording and enable playback. The first high to low going pulse of the

/M1_Message pin initiates playback from the beginning of the current message; on

Dept of ECE Govt. Engg. College, Sreekrishnapuram

Page 9: Micro Controller Based Record-playback System

9MICRO CONTROLLER BASED AUDIO RECORDING/PLAYBACK SYSTEM

power up the first message is the current message. When the /M1_Message pin

pulses low the second time, playback of the current message stops immediately.

When the /M1_Message pin pulses low a third time, playback of the current

message starts again from its beginning. If you hold the /M1_Message pin low

continuously the same message will play continuously in a looping fashion. A

1,530 ms period of silence is inserted during looping as an indicator to the user of

the transition between the beginning and end of the message.

Note that in auto rewind mode the device always rewinds to the

beginning of the current message. To listen to a subsequent message the device

must be fast forwarded past the current message to the next message. This function

is accomplished by toggling the /M2_Next pin from high to low. The pulse must

be low for least 400 cycles of the sampling clock. After the device is incremented

to the desired message the user can initiate playback of the message with the

playback sequence described above. A special case exists when the /M2_Next pin

goes low during playback. Playback of the current message will stop, the device

will beep, advance to the next message and initiate playback of the next message.

(Note that if /M2_Next goes low when not in playback mode, the device will

prepare to play the next message, but will not actually initiate playback). If the /CE

pin goes low during playback, playback of the current message will stop, the

device will beep, reset to the beginning of the first message, and wait for a

subsequent playback command. When you reach the end of the memory array, any

subsequent pulsing of /M1_Message or /M2_Next will only result in a double

beep. To proceed from this state the user must rewind the device to the beginning

of the memory array. This can be accomplished by toggling the /CE pin low or

cycling power.

If the 27th pin /RE is grounded it refers to record mode, and if that

is connected to the VCC, then play back mode. It can store up to eight messages

corresponding to configuration of message select pins MSEL1(24 th pin) and

MSEL2 (25th pin).

Dept of ECE Govt. Engg. College, Sreekrishnapuram

Page 10: Micro Controller Based Record-playback System

10MICRO CONTROLLER BASED AUDIO RECORDING/PLAYBACK SYSTEM

TABLE 3.3.1 MESSAGE SELECTON

MSEL1 MSEL2 Output

0 0 Only one message for

record/play back

0 1 2

1 0 4

1 1 8

For 8 messages, M8 must be disconnected from ground. We set

MSEL1 and MSEL2 as 0, hence 4 message outputs. An internal oscillator provides

the APR 9600 sampling clock.

Oscillator frequency can be changed by changing the resistance

from the OscR pin to GND. Table 4.3.2 summarizes resistance values and the

corresponding sampling frequencies, as well as the resulting input bandwidth and

duration.

TABLE 3.3.2 REFERENCE ROSC VALUE & SAMPLING FREQUENCY

Ref Rosc SamplingFrequency

Input Bandwidth Duration

84K 4.2KHz 2.1KHz 60sec

38K 6.4KHz 3.2KHz 40sec

24K 8.0KHz 4.0KHz 32sec

More simply and clearly, the PORT C outputs of PIC IC is fed to

input line M1-M8 of APR IC. In recording mode, /RE pin has to be grounded

which enables the recording keys in the switch arrays. PIC’s continuous low output

is fed into the APR’s in-out lines which are normally at high state. At that time

current will sink from that corresponding PORT C bit. Thus corresponding input

bits of the APR is pulled to low allowing recording a message.

In playback mode we have to disconnect the 27th pin of APR IC

from ground which enables the playback switch has a corresponding fixed memory

slot in the APR IC where the recording messages are stored. When playback

switch is pressed, the corresponding PORT C bit will out zero which is fed to the

APR input, current will sink to the PORT C producing a high low transition

causing playback of recorded messages.

Dept of ECE Govt. Engg. College, Sreekrishnapuram

Page 11: Micro Controller Based Record-playback System

11MICRO CONTROLLER BASED AUDIO RECORDING/PLAYBACK SYSTEM

3.4 POWER AMPLIFIER SECTION

We used UTC 6283 dual channel audio amplifier in the amplifier section.

It contains internally two Operational Amplifiers since it’s a low voltage amplifier. It is

used as inbuilt amplifier in CD Players and DVD Players. The output of amplifiers is

connected to the 10 W speaker it can be connected to speakers having further more

wattage.

The output from APR 9600 is amplified by this dual channel amplifier.

It’s important to note that the output is mono.

Figure 3.4 POWER AMPLIFIER

Chapter-4

Dept of ECE Govt. Engg. College, Sreekrishnapuram

Page 12: Micro Controller Based Record-playback System

12MICRO CONTROLLER BASED AUDIO RECORDING/PLAYBACK SYSTEM

SOFTWARE SECTION

;starting play/rec activation program in asm

;header file declaration of processor 16F877A

************************************************************************

******

LIST P = 16F877A

#include "P16F877A.inc"

************************************************************************

***********

;declare temporary registers from addrr:20H

************************************************************************

***********

cblock h'20'

counta

endc

org 0*00

************************************************************************

*****

;intialisation of PORTS…….

;PORTB for key inputs…..

;PORTC for output

************************************************************************

******

bsf STATUS,RP0

movlw b'11111111'

movwf TRISB

movlw b'00000000'

movwf TRISC

bcf STATUS,RP0

LOOP : clrf PORTB

Dept of ECE Govt. Engg. College, Sreekrishnapuram

Page 13: Micro Controller Based Record-playback System

13MICRO CONTROLLER BASED AUDIO RECORDING/PLAYBACK SYSTEM

************************************************************************

*********

;disable pull up in PORTB

************************************************************************

********

banksel OPTION_REG

movlw 0*80

movwf OPTION_REG

************************************************************************

*************

;start checking of key status

************************************************************************

*********

banksel PORTB

movlw h'01'

xorlw PORTB

btfsc STATUS,Z

call PLAY_MESSG1

movlw h'02'

xorlw PORTB

btfsc STATUS,Z

call PLAY_MESSG2

movlw h'04'

xorlw PORTB

btfsc STATUS,Z

call PLAY_MESSG3

movlw h'08'

xorlw PORTB

btfsc STATUS,Z

call PLAY_MESSG4

movlw h'10'

xorlw PORTB

btfsc STATUS,Z

call REC_MESSG1

Dept of ECE Govt. Engg. College, Sreekrishnapuram

Page 14: Micro Controller Based Record-playback System

14MICRO CONTROLLER BASED AUDIO RECORDING/PLAYBACK SYSTEM

movlw h'20'

xorlw PORTB

btfsc STATUS,Z

call REC_MESSG2

movlw h'40'

xorlw PORTB

btfsc STATUS,Z

call REC_MESSG3

movlw h'80'

xorlw PORTB

btfsc STATUS,Z

call REC_MESSG4

goto LOOP

PLAY_MESSG1

Banksel PORTC

Movlw 0*FF

Movwf PORTC

Call DELAY_TRANS

Movlw h’FE’

movwf PORTC

return

PLAY_MESSG2

Banksel PORTC

Movlw 0*FF

Movwf PORTC

Call DELAY_TRANS

Movlw h’FD’

movwf PORTC

return

PLAY_MESSG3

Banksel PORTC

Dept of ECE Govt. Engg. College, Sreekrishnapuram

Page 15: Micro Controller Based Record-playback System

15MICRO CONTROLLER BASED AUDIO RECORDING/PLAYBACK SYSTEM

Movlw 0*FF

Movwf PORTC

Call DELAY_TRANS

Movlw h’FB’

movwf PORTC

return

PLAY_MESSG4

Banksel PORTC

Movlw 0*FF

Movwf PORTC

Call DELAY_TRANS

Movlw h’F7’

movwf PORTC

return

REC_MESSG1

Movlw 0*FE

Movwf PORTC

Return

REC_MESSG2

Movlw 0*FD

Movwf PORTC

return

REC_MESSG3

Movlw 0*FB

Movwf PORTC

return

REC_MESSG4

Movlw 0*F7

Movwf PORTC

Return

************************************************************************

*****************

;delay for playback transition

Dept of ECE Govt. Engg. College, Sreekrishnapuram

Page 16: Micro Controller Based Record-playback System

16MICRO CONTROLLER BASED AUDIO RECORDING/PLAYBACK SYSTEM

************************************************************************

**************

DELAY_TRANS

Movlw 0*ff

Movwf counta

Decfsz counta,f

Goto$-1

Return

end

;end of the play/rec activation program

Dept of ECE Govt. Engg. College, Sreekrishnapuram

Page 17: Micro Controller Based Record-playback System

17MICRO CONTROLLER BASED AUDIO RECORDING/PLAYBACK SYSTEM

Chapter-5

APPLICATIONS AND FUTURE SCOPE

5.1 APPLICATIONS

5.1.1 Voice aid

If the stored messages are sounds of alphabets, those who are deaf

and blind can communicate to others.

5.1.2 Electronic organs

If the stored messages are tones of musical notes, it can be used as

a simple micro controller based musical instrument containing 8 notes.

5.1.3 Voice recorder

By arranging it in record mode, we can record any voice given to

the input of a Mic. The play back of the recorded messages is obtained by

changing the mode to play back mode.

5.2 FUTURE SCOPE

5.2.1 Security system

If this product is interfaced with micro controller kit by setting

reference sounds, then the playback sound will be compared with the reference

sounds. If these two sounds are equal, the corresponding will be available to that

user. In locker system, laptop systems this type of security system may find a good

scope. If it is connected to DSP kit, then frequencies are compared with the

reference frequency and desired is selected from the input.

5.2.2 Voice comparison

By setting a reference voice, any voice given to the Mic input of

our product can be compared.

Chapter-6

Dept of ECE Govt. Engg. College, Sreekrishnapuram

Page 18: Micro Controller Based Record-playback System

18MICRO CONTROLLER BASED AUDIO RECORDING/PLAYBACK SYSTEM

ADVANTAGES AND DISADVANTAGES

6.1 ADVANTAGES

No other recording system is required

As it has inbuilt memory of 256 K, no other recording and storage system

is required.

Cheap

All the components in this record and play back system is very cheap and

easily available

Programming and development systems are not required for the frequency

synthesizer separately

Low power consumption

Minimum external components are required

6.2 DISADVANTAGES

Time limitation

The maximum message duration capacity of this product is limited to 60

seconds. It doesn’t have any applications in projects requiring more

duration.

Message limitation

This product can handle at most 8 messages by changing the configuration

of message select pins APR9600. if more number of messages are

required , it will fail.

Introduction of distortion

APR eliminates the need for encoding and compression. This property

introduces distortions in the circuit.

Chapter-7

Dept of ECE Govt. Engg. College, Sreekrishnapuram

Page 19: Micro Controller Based Record-playback System

19MICRO CONTROLLER BASED AUDIO RECORDING/PLAYBACK SYSTEM

CONCLUSION AND RESULT

Features of ICs PIC16F877A, APR9600 and UTC6283 are studied.

Assembly language program for our product is analyzed and implemented to

PIC IC using MPLAB software.

All parts are combined and obtained our desired product.

Figure 7.1 INTERNAL PICTURE OF THE FINAL PRODUCT

Dept of ECE Govt. Engg. College, Sreekrishnapuram

Page 20: Micro Controller Based Record-playback System

20MICRO CONTROLLER BASED AUDIO RECORDING/PLAYBACK SYSTEM

Figure 7.2 EXTERNAL PICTURE OF THE FINAL PRODUCT

Figure 7.3 OUTPUT WAVEFORM FROM THE AMPLIFIER

Dept of ECE Govt. Engg. College, Sreekrishnapuram

Page 21: Micro Controller Based Record-playback System

21MICRO CONTROLLER BASED AUDIO RECORDING/PLAYBACK SYSTEM

Chapter-8

REFERENCES

www.electronicsforyou.com

www.google.com

www.wikipedia.com

www.hobbyprojects.com

Dept of ECE Govt. Engg. College, Sreekrishnapuram

Page 22: Micro Controller Based Record-playback System

22MICRO CONTROLLER BASED AUDIO RECORDING/PLAYBACK SYSTEM

Chapter-9

APPENDIX

Dept of ECE Govt. Engg. College, Sreekrishnapuram