low cost mp3 player using sd card -...

24
LOW COST MP3 PLAYER USING SD CARD KHAIRIL AMRI BIN MUHAMAD UNIVERSITI TEKNIKAL MALAYSIA MELAKA

Upload: nguyenliem

Post on 23-Aug-2019

222 views

Category:

Documents


0 download

TRANSCRIPT

LOW COST MP3 PLAYER USING SD CARD

KHAIRIL AMRI BIN MUHAMAD

UNIVERSITI TEKNIKAL MALAYSIA MELAKA

LOW COST MP3 PLAYER USING SD CARD

KHAIRIL AMRI BIN MUHAMAD

This report is submitted in partial fulfillment of the requirements for the award of

Bachelor of Electronic Engineering (Computer Engineering) With Honours

Faculty of Electronic and Computer Engineering

Universiti Teknikal Malaysia Melaka

April 2009

UNIVERSTI TEKNIKAL MALAYSIA MELAKA FAKULTI KEJURUTERAAN ELEKTRONIK DAN KEJURUTERAAN KOMPUTER

BORANG PENGESAHAN STATUS LAPORAN

PROJEK SARJANA MUDA II

Tajuk Projek : LOW COST MP3 PLAYER USING SD CARD

Sesi Pengajian : 2008/2009

Saya Khairil Amri bin Muhamad mengaku membenarkan Laporan Projek Sarjana Muda ini disimpan di Perpustakaan dengan syarat-syarat kegunaan seperti berikut: 1. Laporan adalah hakmilik Universiti Teknikal Malaysia Melaka.

2. Perpustakaan dibenarkan membuat salinan untuk tujuan pengajian sahaja.

3. Perpustakaan dibenarkan membuat salinan laporan ini sebagai bahan pertukaran antara institusi

pengajian tinggi.

4. Sila tandakan ( √ ) :

SULIT*

(Mengandungi maklumat yang berdarjah keselamatan atau kepentingan Malaysia seperti yang termaktub di dalam AKTA RAHSIA RASMI 1972)

TERHAD*

(Mengandungi maklumat terhad yang telah ditentukan oleh organisasi/badan di mana penyelidikan dijalankan)

TIDAK TERHAD

Disahkan oleh:

__________________________ ___________________________________ (TANDATANGAN PENULIS) (COP DAN TANDATANGAN PENYELIA)

Alamat Tetap: NO. 285,, FELDA TENANG, 85300 LABIS, JOHOR

Tarikh: ……………………….. Tarikh: ………………………..

iii

” I hereby declare that this report is the result of my own work except for quotes as

cited in the reference.”

Signature : ………………………………………...

Author : KHAIRIL AMRI BIN MUHAMAD

Date : ………………………………………...

iv

“I hereby declare that I have read this report and in my opinion this report is

sufficient in terms of the scope and quality for the award of Bachelor of Electronic

Engineering (Computer Engineering) With Honours.”

Signature : ………………………………………

Supervisor’s Name : ……………………………………....

Date : …………………………………….....

v

ACKNOWLEDGEMENT

Alhamdulillah.First of all, all praised and thank you to ALLAH for leading

and giving me strength and guidance to complete in writing this Projek Sarjana Muda

(PSM) report entitled “Low Cost MP3 Player Using SD Card”.

First and foremost, I extend my thanks and appreciation to my supervisor,

Puan Siti Khadijah Binti Idris@Othman for all the willingness to respond my

question and guide me to complete this project. Then, I want to express my special

thank to all the FKEKK staff and lecturer for their time, patience and

professionalism.

Very special thanks to my parent and also my friends who always giving me

full support and motivation. Thanks to all who involved to helping me to complete

my report. Thank You.

vi

ABSTRACT

A portable MP3 player with standard functionality is being designed and

built. The central mission in this project is to create the portable MP3 player with a

low cost and with attributes such as small in size, lightweight, durable, high

performance and long battery life. This player enables a user to play and share music

with friends anytime and anywhere they want. From a hardware perspective, the

major devices include the PIC microcontroller, MP3 decoder chip, SD card or

multimedia card that is function as storage. Microcontroller is the heart of the whole

design. It control how data flows and send the song which is streamed serially from

the SD card to the decoder. The decoder converts the digital stream to the equivalent

analog signal. After being amplified this analog signal is the sound that we can hear.

From software perspective, all components must be programmed to successfully

function with one another to produce the desire output. As for default capabilities,

the product will embody the same default function as other portable MP3 player as

available in the market today. These include creation play list, skipping forward or

backward, pausing and stopping song.

vii

ABSTRAK

Sebuah alat pemain muzik dengan fungsi yang lengkap akan dan direka dan

dibina. Matlamat utama projek ini adalah untuk menghasilkan sebuah alat pemain

muzik dengan menggunakan kos yang rendah serta dilengkapi beberapa kelebihan

seperti saiz yang kecil, ringan, tahan lama, bateri yang tahan lama dan boleh diguna

dalam tempoh yang panjang. Alat pemain ini akan membolehkan seseorang untuk

mendengar muzik di mana-mana pada bila-bila masa sahaja yang mereka mahu

bersama kawan-kawan yang lain. Dari sudut perkakasan dan komponen, ”PIC” serta

”mp3 decoder chip” akan menjadi komponen yang paling penting dalam projek ini.

Kad memori juga menjadi komponen yang harus ada kerana kad memori akan

bertindak sebagai tempat penyimpanan lagu-lagu. ”PIC” akan mengawal semua

pergerakan data dalam litar, manakala pengekod cip pula akan berfungsi untuk

menukar isyarat digital ke dalam bentuk analog. Seterusnya selepas isyarat ini

dikuatkan, ia akan menjadi bunyi yang boleh kita dengar. Dari sudut perisian pula,

setiap komponen haruslah diprogramkan supaya ia dapat berfungsi dan

berkomunikasi antara satu sama lain dengan baik bagi mendapatkan hasil seperti

yang kita inginkan. Alat pemain muzik ini akan mempunyai fungsi yang sama seperti

alat yang sedia ada di pasaran termasuklah beberapa fungsi seperti butang kawalan

untuk main, henti, pergi ke lagu seterusnya atau sebelumnya.

viii

TABLE OF CONTENT

CHAPTER CONTENT PAGE

TITLE i

DECLARATION iii

SUPERVISOR APROVAL iv

ACKNOWLEDGEMENT v

ABSTRACT vi

ABSTRAK vii

TABLE OF CONTENTS viii

LIST OF TABLES xii

LIST OF FIGURES xiii

LIST OF ABBREVIATION xiv

LIST OF APPENDIX xv

ix

I INTRODUCTION 1

1.1 Project Synopsis 1

1.2 Project Objectives 2

1.3 Scope of work 3

1.4 Problem Statement 3

1.5 Thesis Outline 4

II LITERATURE REVIEW 6

2.1 What is MP3 6

2.2 What is SD card 7

2.3 Programmable Integrated Circuit (PIC) 10

2.3.1 Application of PIC 14

2.4 MP3 Decoder Chip 15

2.4.1 STA013 MP3 Decoder Chip 15

2.4.1.1 Features and Descriptions 16

2.5 MAX1674 step-up DC-DC converter 19

2.6 Digital to analog converter 21

2.6.1 CS4330 8 Pin Stereo D/A Converter for

Digital Audio 21

2.6.2 PCM1748 23

x

2.7 Software Simulation of PIC16F88 25

2.7.1 Proteus Virtual System Modeling 25

2.7.2 MPLAB 26

2.7.3 CCS Compiler 26

2.7.3.1Functions and Tools of CCS Compiler 28

III METHODOLOGY 31

3.1 Introduction 31

3.2 Project methodology 32

3.3 Project Flowchart 32

3.4 The explanation of the flowchart 34

3.4.1 Programming PIC Microcontroller and Design Interface 34 3.4.2 Design the Hardware 35

3.4.3 Combine the Hardware and Software 36

3.5 Functional block diagram 37

IV RESULT AND ANALYSIS 39

4.1 Introduction 39

4.2 Project System Overview 40

4.3 Circuit Analysis 41

4.3.1 Power supply – voltage regulator 41

4.3.2 Push Button Circuit Analysis 42

4.3.3 SD Card Circuit Connection 43

4.3.4 STA013 and CS4334 Connection Circuit 44

4.4 Hardware 45

xi

V CONCLUSSION AND RECOMMENDATION 48

5.1 Introduction 48

5.2 Conclusion 49

5.3 Recommendation 50

REFERENCES 51

APPENDIX 52

xii

LIST OF TABLES

NO TITLE PAGE

2.1 Class of SD Card 9

2.2 STA013 Pin Connection 18

2.3 PCM1748 Terminal Function 24

4.1 SD Card Pin Configuration 43

xiii

LIST OF FIGURES

NO TITLE PAGE

2.1 PIC16F88 Pin Layouts 12

2.2 PIC 16F88 Block Diagram 13

2.3 STA013 Block Diagram 16

2.4 STA013 Typical Connection 17

2.5 MAX1674 Connection 20

2.6 Max1674 Pin Configurations 20

2.7 CS4330 Connection Diagram 22

2.8 PCM1748 Pin Assignments 24

2.9 Code Wizard 28

2.10 Wizards for RS232 and I2C Support 29

2.11 Ports Setup 30

3.1 Project’s Flowchart 33

3.2 Functional Block Diagram 37

4.1 System Overview 40

4.2 Voltage Regulator 41

4.3 Push Button 42

4.4 SD Card Circuit 43

4.5 Circuit Connections on Strip Board 45

4.6 Pushbutton 45

4.7 LED Show the Power On 46

xiv

LIST OF ABBREVIATION

MP3 - MPEG-1 audio layer 3

SD - Secure Digital

PIC – Peripheral Interface Controller

PSM – Projek Sarjana Muda

LCD – Liquid Crystal Display

PCB – Printed Circuit Board

IC – Integrated Circuit

LED – Light Emitting Diode

DAC – Digital to Analog Converter

VSM – Virtual System Modelling

xv

LIST OF APPENDIX

NO TITLE PAGE

1 PIC16F88 Pin out Description 52

2 Outline and Mechanical Data STA013 54

3 Source Code 56

CHAPTER I

INTRODUCTION

The Introduction chapter is explained about the whole project. That includes the

synopsis, objectives, problem statement, scopes of work, methodology and thesis outline

of the project.

1.1 Project Synopsis

In the past people would have accumulated music on various formats such as

tape, vinyl. All of these formats were analogue based, these days the focus has shifted

from analogue music formats to digital formats. Where music may be downloaded using

a series of peer-to-peer (P2P) networks. Digital format music collections are effectively

files that may be stored on computer hard drives, and may even be transferred to

portable media players like Apple’s iPod, or a plethora of other digital media players.

2

This MP3 project is to design the mp3 device that can read SD card and it will be

the memory of the device. The purpose of this MP3 Player is to store as many songs as

possible. So, by using the SD card as the memory we can easily upgraded the memory

up to 4GB or 8GB.

Nowadays, this SD card is very popular memory card and it is widely used in

hand phone, camera, PDA and others. This mp3 will use low power operation so it can

be used longer than conventional mp3 player. The circuit will get the power source

from a battery to start operate. The PIC will be programmed; the mp3 decoder chip will

read the data from the SD card and play the songs. Then it will display on the LCD

panel. By using the SD card we can easily transfer the songs from computer.

1.2 Project Objectives

• To built a low cost mp3 player with SD card using the PIC microcontroller.

• To design mp3 player circuit which able to read SD card, FAT file system and

stream mp3 data.

• To program the PIC and SD card.

3

1.3 Scopes of Work

This project aims to develop of an mp3 player that the memory using SD card so

that it can be easily upgraded. Have to understand the concept of microcontroller

because microcontroller will be the heart of the system that will communicate with the

SD card socket and other device.

Among of the scopes of work for this project are to create the source code for the

mp3 player using the CCS compiler and MPLAB, design the PCB circuit and some of

the part will be soldered on the PCB. Then create the LCD is created by using old

nokia3310 LCD. For the final part have to program the PIC have to be programmed so

that it can play the MP3 songs. Then have to interface between the hardware and

software.

1.4 Problem Statements

Nowadays, MP3 player is widely used by people all over the world. People who

love to listen to music usually will bring their mp3 player wherever they go. The space

to store the mp3 file will be limited as the memory of conventional mp3 is fixed. By

using the SD card we can buy SD card with the big memory capacity and listen to the

music as many as it can.

4

1.5 Thesis Outline

This report structure built on five chapters. Each chapter detailing the core of the

title and have continuity between each other. The following is the description of chapters

itself.

Chapter one is a simplified introduction that consists of several sub chapters that

literally overview about this project. This includes introduction, objectives, problem

statement, scope of work and lastly methodology used to accomplish this study.

Chapter two discuss the literature review that had been done during project.

Review start from what is MP3 and SD card, programmable integrated circuit, and MP3

decoder chip and software simulation. Then, the concept of study had been cleared up in

this chapter. Moreover, early assumptions had been made in chapter two.

Chapter three discussed the methodology used throughout this study.

Methodology starts with explanation of project block diagram and flow chart of the

project. Then, the hardware and software part will then explain.

5

Chapter four is discussed about results and circuit analysis. It explained about the

output and the result that have been gained from the project. The circuit analysis

explained about the analysis of the circuits that has been done in this project.

Chapter five discussed the conclusion and recommendation of this project. It

concludes all the works that have been done to complete this project.

CHAPTER II

LITERATURE REVIEW

2.1 What is MP3

MPEG-1 audio layer 3 or , more commonly referred to as MP3, is a digital audio

encoding format using a form of loss data compression. MPEG layer 3 is a type of audio

codec where processed by significant compression from the original audio source with

very little loss in sound quality.

The compression up to 12:1 produces a very little degradation. Tighter

compression can be achieved, but it will effect in sound degradation results. To obtain

certain compression, we must adjust the bit rates. The standard bit rates near cd quality

result are 128 or 112 kbit/s. The advantage of MP3 is that it can be broken up into

pieces, and each piece is still playable. The popularity of MP3 comes from its practical

uses. Music tracks in WAV format are extremely large in file size, averaging around

50MB in size.

7

Since it is so large, it is not practical to send WAV files through email or offer

them for download on the Internet. MP3, however, compresses WAV audio on average

of 10 to 12 times smaller than the original size. The result is audio tracks around 3 to 4

MB in size, perfect for downloading and sending through the Internet. Thus, custom

MP3 format CDs can be created with 10 to 12 times the amount of tracks of a normal

12-15 track audio CD, producing CDs with over 100 tracks easily.

The format is also popular for turning the PC into a jukebox of hundreds or

thousands of songs or loading them into a portable mp3 player and taking your music

collection wherever you want.

2.2 What is SD Card

Secure Digital (SD) is a non-volatile memory card format developed by

Matsushita, SanDisk, and Toshiba for use in portable devices. Today it is widely used in

digital cameras, handheld computers, PDAs, mobile phones, GPS receivers, and video

game consoles.

Standard SD card capacities range from 8 MB to 4 GB and for high capacity

SDHC cards 4 GB to 32 GB as of 2008. Today more than 1,100 companies involved in

the design, development, manufacture or sale of products using SD technology. SD

memory cards are available in a variety of formats, capacities, and speed classes. Like

other flash card technologies, most SD cards ship preformatted with the FAT or FAT 32

file system.

8

The ubiquity of this file system allows the card to be accessed on virtually any

host device with an SD reader. Also, standard FAT maintenance utilities such as.

ScanDisk can be used to repair or retrieve corrupted data.

However, because the card appears as a removable hard drive to the host system,

the card can be reformatted to any file system supported by the operating system. SD

cards are based on the older Multimedia Card (MMC) format, but have a number of

differences:

• The SD card is asymmetrically shaped in order not to be inserted upside down,

while an MMC would go in most of the way but not make contact if inverted.

• Most SD cards are physically thicker than MMCs. SD cards generally measure

32 mm × 24 mm × 2.1 mm, but can be as thin as 1.4 mm, just like MMCs (see

below).

• The contacts are recessed beneath the surface of the card, protecting the contacts

from contact with the fingers.

• SD cards typically have transfer rates in the range of 10-20 MBytes/s, but this is

always changing, particularly in light of recent improvements to the MMC

standard

Devices with SD slots can use the thinner MMCs, but the standard SD cards will

not fit into the thinner MMC slots. Mini SD and micro SD cards can be used directly in

SD slots with a simple passive adapter, since they differ in size and shape but not

electrical interface. With an active electronic adapter, SD cards can be used in

CompactFlash or PC card slots. Some SD cards include a USB connector for

compatibility with desktop and laptop computers, and card readers allow SD cards to be

accessed via connectivity ports such as USB, FireWire, and the parallel printer port.